[PATCH] D59531: [ELF] Produce multiple PT_NOTE segments as needed

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 19:20:13 PDT 2019


jakehehrlich created this revision.
jakehehrlich added reviewers: ruiu, phosek, jhenderson, pcc.
Herald added subscribers: jdoerfert, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Right now note sections that are next to each other are put into the same PT_NOTE program header. This produces an issue when alignments are not accounted for. This change produces the smallest number of program headers while still maintaining the original section order.

See https://reviews.llvm.org/D59120 and the email thread for associated discussion. The long and short of it is that we have to have more than one PT_NOTE segment to account for alignment of headers. This change maintains order while adding as few headers as is required (unless I got my math wrong) but we could yet further reduce the number of segments by sorting the OutputSections in order of decreasing alignment (as I proposed before but was shown to be wrong as a complete solution).


Repository:
  rL LLVM

https://reviews.llvm.org/D59531

Files:
  lld/ELF/Writer.cpp
  lld/test/ELF/build-id.s
  lld/test/ELF/large-align-notes.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59531.191234.patch
Type: text/x-patch
Size: 4707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190319/68ffd892/attachment.bin>


More information about the llvm-commits mailing list