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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 18:28:04 PDT 2019


MaskRay added a comment.

In D59531#1480947 <https://reviews.llvm.org/D59531#1480947>, @jakehehrlich wrote:

> @ruiu and others. I'm still good to land this as is. Are you ok with me landing this?


If the intention is just to fix `.note.gnu.property`, we don't have to differentiate `OneProgramHeaderPerNoteSection` and `MultiNoteSegmentLayout`. We can just merge consecutive `SHT_NOTE` sections if `Last->Align == Current->Align && Last->Size % Last->Align == 0`. Assuming the compilers emit 4-byte aligned notes followed by 8-byte aligned notes, we will have at most 2 `PT_NOTE` segments and will not incur the 56-byte (Phdr size) per note overhead every time they add a new note section.

BTW, binutils has introduced a new segment type `PT_GNU_PROPERTY` to address the alignment issue (https://sourceware.org/bugzilla/show_bug.cgi?id=23900). I think it may be too early for us to follow suit.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59531/new/

https://reviews.llvm.org/D59531





More information about the llvm-commits mailing list