using gcc-3.4.6 and building a PIE binary with -z relro results in an ELF that, when stripped, causes the PT_GNU_RELRO to shrink the memsize more than the filesize ... perhaps this is a dupe of Bug 3281 ...
$ gcc-3.4.6 dumpelf.c -o dumpelf -fPIE -Wl,-z,relro $ readelf -Wl dumpelf | grep GNU_REL GNU_RELRO 0x007d50 0x00607d50 0x00607d50 0x0002b0 0x0002b0 R 0x1 $ strip dumpelf $ readelf -Wl dumpelf | grep GNU_REL GNU_RELRO 0x007d50 0x00607d50 0x00607d50 0x000288 0x000280 R 0x1 the filesize (0x288) is larger than the memsize (0x280) looking at the relevant section headers: [17] .ctors PROGBITS 00607d50 007d50 000010 00 WA 0 0 8 [18] .dtors PROGBITS 00607d60 007d60 000010 00 WA 0 0 8 [19] .jcr PROGBITS 00607d70 007d70 000008 00 WA 0 0 8 [20] .data.rel.ro PROGBITS 00607d80 007d80 0000a0 00 WA 0 0 32 [21] .dynamic DYNAMIC 00607e20 007e20 000190 10 WA 5 0 8 [22] .got PROGBITS 00607fb0 007fb0 000028 08 WA 0 0 8 we see the filesize of the PT is correct (0x7d50 + 0x288 covers all these sections) but the memsize of the PT does not include the last few entries of the .got (0x7d50 + 0x280 is 0x8 bytes short of the end of the .got) -- Summary: strip shrinks PT_GNU_RELRO on PIE objects Product: binutils Version: 2.18 Status: NEW Severity: normal Priority: P2 Component: binutils AssignedTo: unassigned at sources dot redhat dot com ReportedBy: vapier at gentoo dot org CC: bug-binutils at gnu dot org GCC host triplet: x86_64-linux-gnu http://sourceware.org/bugzilla/show_bug.cgi?id=5037 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils