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: --- [hjl@gnu-cfl-1 max-page-size]$ cat foo.c int data = 3; int foo (void) { return data; } [hjl@gnu-cfl-1 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 [hjl@gnu-cfl-1 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. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils