[PATCH] D27415: [ELF] - Replace MergeOutputSection with synthetic input section MergeSection.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 08:17:21 PST 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, evgeny777.

Change allows to get rid of MergeOutputSection. As a result now we can
place mergable sections with different attributes into single output section.
What is consistent to what gold/bfd do.

Patch currently changes the behavior only for non-script case.
It looks like we may be able to leave only single createKey() if land this.

One of problem I faced was sh_entsize field.
Oracle documentations says:

> Some sections hold a table of fixed-size entries, such as a symbol table. For such a section, this member gives the size in bytes of each entry. The member contains 0 if the section does not hold a table of fixed-size entries.

Logic implemented in this patch is next:

1. If all mergeable sections has the same sh_entsize then I use it
2. Otherwise I put zero.

That looks follows the specification. Gnu linkers looks put either first sh_entsize or 0.


https://reviews.llvm.org/D27415

Files:
  ELF/InputSection.cpp
  ELF/InputSection.h
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/SyntheticSections.cpp
  ELF/SyntheticSections.h
  test/ELF/merge-string-align.s
  test/ELF/merge-string.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27415.80270.patch
Type: text/x-patch
Size: 18523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161205/74ee1782/attachment.bin>


More information about the llvm-commits mailing list