diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-12-11 17:23:28 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-12-11 17:23:28 +0000 |
| commit | 63fcc5cccc8aa124858a9a79e275bdc5955bf5c0 (patch) | |
| tree | 4bfa8092c5c021652cfeeaee994cbe899df548a6 /lld/ELF/Driver.cpp | |
| parent | 6d89f407db60a17ba723fba2ec2d72864b7a0177 (diff) | |
| download | bcm5719-llvm-63fcc5cccc8aa124858a9a79e275bdc5955bf5c0.tar.gz bcm5719-llvm-63fcc5cccc8aa124858a9a79e275bdc5955bf5c0.zip | |
Create reserved symbols early so they can be versioned.
This fixes pr35570.
We were creating these symbols after parsing version scripts, so they
could not be versioned.
We cannot move the version script parsing later because we need it for
lto.
One option is to move both addReservedSymbols and
createSyntheticSections earlier. The disadvantage is that some
sections created by createSyntheticSections replace other input
sections. For example, gdb index replaces .debug_gnu_pubnames, so it
wants to run after gc sections so that it can set S->Live to false.
What this patch does instead is to move just the ElfHeader creation
early.
llvm-svn: 320390
Diffstat (limited to 'lld/ELF/Driver.cpp')
| -rw-r--r-- | lld/ELF/Driver.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 12466e00b46..0e7d02e349e 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1046,6 +1046,15 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) { if (Args.hasArg(OPT_exclude_libs)) excludeLibs<ELFT>(Args, Files); + // Create ElfHeader early. We need a dummy section in + // addReservedSymbols to mark the created symbols as not absolute. + Out::ElfHeader = make<OutputSection>("", 0, SHF_ALLOC); + Out::ElfHeader->Size = sizeof(typename ELFT::Ehdr); + + // We need to create some reserved symbols such as _end. Create them. + if (!Config->Relocatable) + addReservedSymbols<ELFT>(); + // Apply version scripts. Symtab->scanVersionScript(); |

