[PATCH] D12788: [elf2] Combine adjacent compatible OutputSections in PT_LOADs.

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 15:48:02 PDT 2015


Bigcheese updated this revision to Diff 34746.
Bigcheese added a comment.

>   std::unique_ptr<llvm::FileOutputBuffer> Buffer;

> 

> +

> 

>   llvm::SpecificBumpPtrAllocator<OutputSection<ELFT>> CAlloc;

>    

> 

> Why?


Separating out logically related members.

> +    if (Sec->getSize()) {

> 

> All sh_alloc segments come before all others, so it might be

>  possible/cleaner to write this with

> 

> if (outputSectionHasPHDR<ELFT>(Sec)) {

> 

> And just close the last program header out of the loop, no?


There are zero sized allocated sections (.data, .bss) in some tests that have different flags, and would create zero sized PHDRs. This ignores them.

Closing the last program header outside of the loop makes that PT_LOAD include all of the non SHF_ALLOC sections.


http://reviews.llvm.org/D12788

Files:
  ELF/Writer.cpp
  test/elf2/basic.s
  test/elf2/basic32.s
  test/elf2/basic32be.s
  test/elf2/basic64be.s
  test/elf2/shared.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12788.34746.patch
Type: text/x-patch
Size: 12316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150914/2a859b9a/attachment.bin>


More information about the llvm-commits mailing list