[PATCH] D40029: [ELF] Only add contiguous isRelro sections to PT_GNU_RELRO PHDR

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 07:58:45 PST 2017


peter.smith updated this revision to Diff 123802.
peter.smith added a comment.

Updating diff based on mail comments llvm-commits, rather than paste everything in here, the comments start from these points. 
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171113/503153.html
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171120/503888.html

My summary of the comments is:

- It is better to give an error message when the relro sections are not contiguous.
- Ignore zero sized sections when checking for contiguous relro sections.
- We should only attempt to rename the .bss.rel.ro section when a script is in use as we would like to use bss as much as possible.

The changes I've made for this update:

- Give an error message if relro sections are not contiguous.
- If the linker script has SECTIONS and a .data.rel.ro OutputSection then use the name .data.rel.ro.bss instead of .bss.rel.ro. I've used the reasoning that the vast majority of linker scripts are not going to mess about with linker defined sections, where as an explicit .data.rel.ro is a sign that someone wanting GNU linker script compatibility. I'm happy to change this if there is a better heuristic.


https://reviews.llvm.org/D40029

Files:
  ELF/Writer.cpp
  test/ELF/relro-non-contiguous-zerosize.s
  test/ELF/relro-non-contiguous.s
  test/ELF/relro-script.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40029.123802.patch
Type: text/x-patch
Size: 6628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171121/cc587654/attachment.bin>


More information about the llvm-commits mailing list