bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/24490] New: -z max-page-size=0x200000 -z separate-code creates h


From: hjl.tools at gmail dot com
Subject: [Bug ld/24490] New: -z max-page-size=0x200000 -z separate-code creates huge binary
Date: Fri, 26 Apr 2019 15:18:55 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=24490

            Bug ID: 24490
           Summary: -z max-page-size=0x200000 -z separate-code creates
                    huge binary
           Product: binutils
           Version: 2.33 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

address@hidden max-page-size]$ cat foo.c
int data = 3;

int
foo (void)
{
  return data;
}
address@hidden max-page-size]$ make
gcc -g -Wall -fpic   -c -o foo.o foo.c
./ld -z max-page-size=0x200000 -m elf_x86_64 -z separate-code -shared -o
libfoo2.so foo.o
readelf -lW libfoo2.so

Elf file type is DYN (Shared object file)
Entry point 0x200000
There are 9 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x0002e8
0x0002e8 R   0x200000
  LOAD           0x200000 0x0000000000200000 0x0000000000200000 0x00000f
0x00000f R E 0x200000
  LOAD           0x400000 0x0000000000400000 0x0000000000400000 0x000068
0x000068 R   0x200000
  LOAD           0x400f08 0x0000000000600f08 0x0000000000600f08 0x000114
0x000114 RW  0x200000
  DYNAMIC        0x400f08 0x0000000000600f08 0x0000000000600f08 0x0000f0
0x0000f0 RW  0x8
  NOTE           0x400000 0x0000000000400000 0x0000000000400000 0x000030
0x000030 R   0x8
  GNU_PROPERTY   0x400000 0x0000000000400000 0x0000000000400000 0x000030
0x000030 R   0x8
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW  0x10
  GNU_RELRO      0x400f08 0x0000000000600f08 0x0000000000600f08 0x0000f8
0x0000f8 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     .hash .gnu.hash .dynsym .dynstr .rela.dyn 
   01     .text 
   02     .note.gnu.property .eh_frame 
   03     .dynamic .got .got.plt .data 
   04     .dynamic 
   05     .note.gnu.property 
   06     .note.gnu.property 
   07     
   08     .dynamic .got 
ls -l libfoo2.so
-rwxrwxr-x 1 hjl hjl 4201160 Apr 26 08:14 libfoo2.so
address@hidden max-page-size]$ 

Since all PT_LOAD segments are very small, they can be fit into a
single 4K or 2MB page.  Ld should use the smallest of minpagesize
and maxpagesize which can cover the whole PT_LOAD segment.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]