[PATCH] D27040: [ELF] - Add support for access to most of synthetic sections from linkerscript.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 05:04:39 PST 2016


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

This is important for FreeBSD EFI  bootloaders one of which has next script:

    .sdata        : {
      *(.got.plt .got)
  ...
    }

So it wants to place got.plt and got into single section of name .sdata.
That was not supported before as there was no way to get access to 
synthetic sections from script.

To do that we need to add them early to Symtab<ELFT>::X->Sections.
That involves next problems:

1. Not all sections are required in output finally. For example we do not need

to emit got content when it has no entries. Patch solves that in next way:
after script do its job of layouting, removeUnusedSynthetics() is called.
Main intention to check the condition for each synthetic and remove it from output
if it is not needed.

2. Adding sections early involves possible change in ordering. That is why this patch

does not do support for all sections at ones. Otherwise too many tests fill fail (up to 150).
It still breaks order for .eh_frame, that is why few relative testcases were fixes.
I believe that is not a problem.

If we land this - we might be able to add all rest sections in next patches
and get rid off addPredefinedSections() fully I think.


https://reviews.llvm.org/D27040

Files:
  ELF/SyntheticSections.cpp
  ELF/SyntheticSections.h
  ELF/Writer.cpp
  test/ELF/eh-align-cie.s
  test/ELF/eh-frame-hdr-augmentation.s
  test/ELF/eh-frame-marker.s
  test/ELF/eh-frame-merge.s
  test/ELF/linkerscript/phdrs.s
  test/ELF/synthetic-got.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27040.79053.patch
Type: text/x-patch
Size: 18731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161123/0f59ed32/attachment.bin>


More information about the llvm-commits mailing list