[v3] use -Wl,-z,relro if possible
Benjamin Kosnik
bkoz@redhat.com
Thu Jan 12 00:25:00 GMT 2006
For GNU ld that supports -z relro, use it when creating shared object.
This allows things like typeinfo, etc to go into
read-only-after-dynamic-relocation... advantages as outlined:
http://people.redhat.com/drepper/nonselsec.pdf
The compiler is currently producing stuff like this:
_ZTSSt13runtime_error:
.section .gnu.linkonce.d.rel.ro._ZTISt13runtime_error,"aw",@progb
_ZTVSt13runtime_error:
.section .gnu.linkonce.d.rel.ro._ZTVSt11logic_error,"aw",@progbits
There's no library size difference with this option, and no regressions.
%readelf -l libstdc++.so.6.0.7 | fgrep RELRO
GNU_RELRO 0x0d81fc 0x000d91fc 0x000d91fc 0x00e04 0x00e04 R 0x1
looks good...
tested x86/linux
-benjamin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p.20060111-1
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060112/a0c38ed1/attachment.ksh>
More information about the Gcc-patches
mailing list