https://sourceware.org/bugzilla/show_bug.cgi?id=16323
Bug ID: 16323 Summary: strip changes PT_LOAD segment generated by gold Product: binutils Version: 2.25 (HEAD) Status: NEW Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com [hjl@gnu-6 pr16322]$ cat x.c extern void f1 (void); void * const p1[1] __attribute__ ((aligned(8))) = { &f1 }; [hjl@gnu-6 pr16322]$ make gcc -m32 -O2 -fPIC -c -o x.o x.c ld.gold -melf_i386 -shared --gc-sections -z relro -o libx.so x.o readelf -lS libx.so There are 12 section headers, starting at offset 0x1168: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .dynsym DYNSYM 000000f4 0000f4 000060 10 A 2 1 4 [ 2] .dynstr STRTAB 00000154 000154 00001f 00 A 0 0 1 [ 3] .hash HASH 00000174 000174 00002c 04 A 1 0 4 [ 4] .rel.dyn REL 000001a0 0001a0 000008 08 A 1 0 4 [ 5] .data.rel.ro PROGBITS 00001f88 000f88 000004 00 WA 0 0 8 [ 6] .dynamic DYNAMIC 00001f8c 000f8c 000070 08 WA 2 0 4 [ 7] .comment PROGBITS 00000000 001000 00002d 01 MS 0 0 1 [ 8] .note.gnu.gold-ve NOTE 00000000 001030 00001c 00 0 0 4 [ 9] .symtab SYMTAB 00000000 00104c 000080 10 10 3 4 [10] .strtab STRTAB 00000000 0010cc 00002c 00 0 0 1 [11] .shstrtab STRTAB 00000000 0010f8 000070 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) Elf file type is DYN (Shared object file) Entry point 0x0 There are 6 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000034 0x00000034 0x00000034 0x000c0 0x000c0 R 0x4 LOAD 0x000000 0x00000000 0x00000000 0x001a8 0x001a8 R 0x1000 LOAD 0x000f88 0x00001f88 0x00001f88 0x00078 0x00078 RW 0x1000 DYNAMIC 0x000f8c 0x00001f8c 0x00001f8c 0x00070 0x00070 RW 0x4 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0 GNU_RELRO 0x000f88 0x00001f88 0x00001f88 0x00078 0x00078 RW 0x8 Section to Segment mapping: Segment Sections... 00 01 .dynsym .dynstr .hash .rel.dyn 02 .data.rel.ro .dynamic 03 .dynamic 04 05 .data.rel.ro .dynamic [hjl@gnu-6 pr16322]$ strip libx.so [hjl@gnu-6 pr16322]$ readelf -SlW libx.so There are 10 section headers, starting at offset 0x10a8: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .dynsym DYNSYM 000000f4 0000f4 000060 10 A 2 1 4 [ 2] .dynstr STRTAB 00000154 000154 00001f 00 A 0 0 1 [ 3] .hash HASH 00000174 000174 00002c 04 A 1 0 4 [ 4] .rel.dyn REL 000001a0 0001a0 000008 08 A 1 0 4 [ 5] .data.rel.ro PROGBITS 00001f88 000f88 000004 00 WA 0 0 8 [ 6] .dynamic DYNAMIC 00001f8c 000f8c 000070 08 WA 2 0 4 [ 7] .comment PROGBITS 00000000 000ffc 00002d 01 MS 0 0 1 [ 8] .note.gnu.gold-version NOTE 00000000 00102c 00001c 00 0 0 4 [ 9] .shstrtab STRTAB 00000000 001048 000060 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) Elf file type is DYN (Shared object file) Entry point 0x0 There are 6 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000034 0x00000034 0x00000034 0x000c0 0x000c0 R 0x4 LOAD 0x000000 0x00000000 0x00000000 0x001a8 0x001a8 R 0x1000 LOAD 0x000f88 0x00001f88 0x00001f88 0x00074 0x00074 RW 0x1000 DYNAMIC 0x000f8c 0x00001f8c 0x00001f8c 0x00070 0x00070 RW 0x4 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0 GNU_RELRO 0x000f88 0x00001f88 0x00001f88 0x00078 0x00078 RW 0x8 Section to Segment mapping: Segment Sections... 00 01 .dynsym .dynstr .hash .rel.dyn 02 .data.rel.ro .dynamic 03 .dynamic 04 05 .data.rel.ro .dynamic [hjl@gnu-6 pr16322]$ strip changes LOAD 0x000f88 0x00001f88 0x00001f88 0x00078 0x00078 RW 0x1000 to LOAD 0x000f88 0x00001f88 0x00001f88 0x00074 0x00074 RW 0x1000 It makes GNU_RELRO 0x000f88 0x00001f88 0x00001f88 0x00078 0x00078 RW 0x8 bigger than its 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