https://sourceware.org/bugzilla/show_bug.cgi?id=16322
Bug ID: 16322 Summary: ld fails to generate GNU_RELRO segment Product: binutils Version: 2.25 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com [hjl@gnu-6 relro-6]$ cat x.c extern void f1 (void); #if 1 void * const p1 __attribute__ ((aligned(32))) = &f1; #else void * const p1 = &f1; #endif [hjl@gnu-6 relro-6]$ make libx.so LD=ld gcc -fuse-ld=gold -B./ -O2 -fPIC -c -o x.o x.c ld -shared --gc-sections -z relro -o libx.so x.o [hjl@gnu-6 relro-6]$ readelf -SWl libx.so There are 12 section headers, starting at offset 0x1078: Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] .hash HASH 0000000000000120 000120 000030 04 A 2 0 8 [ 2] .dynsym DYNSYM 0000000000000150 000150 0000a8 18 A 3 2 8 [ 3] .dynstr STRTAB 00000000000001f8 0001f8 00001f 00 A 0 0 1 [ 4] .rela.dyn RELA 0000000000000218 000218 000018 18 A 2 0 8 [ 5] .eh_frame PROGBITS 0000000000000230 000230 000000 00 A 0 0 8 [ 6] .data.rel.ro PROGBITS 0000000000200f00 000f00 000008 00 WA 0 0 32 [ 7] .dynamic DYNAMIC 0000000000200f08 000f08 0000e0 10 WA 3 0 8 [ 8] .comment PROGBITS 0000000000000000 000fe8 00002c 01 MS 0 0 1 [ 9] .shstrtab STRTAB 0000000000000000 001014 000064 00 0 0 1 [10] .symtab SYMTAB 0000000000000000 001378 0001b0 18 11 16 8 [11] .strtab STRTAB 0000000000000000 001528 000042 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), l (large) 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 4 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000230 0x000230 R 0x200000 LOAD 0x000f00 0x0000000000200f00 0x0000000000200f00 0x0000e8 0x0000e8 RW 0x200000 DYNAMIC 0x000f08 0x0000000000200f08 0x0000000000200f08 0x0000e0 0x0000e0 RW 0x8 GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x10 Section to Segment mapping: Segment Sections... 00 .hash .dynsym .dynstr .rela.dyn 01 .data.rel.ro .dynamic 02 .dynamic 03 [hjl@gnu-6 relro-6]$ -- 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