diff options
| author | Davide Italiano <davide@freebsd.org> | 2016-03-15 22:24:58 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2016-03-15 22:24:58 +0000 |
| commit | 00a7cf9ffeeff953e88d8acf611a2d89f4063f06 (patch) | |
| tree | 773ec326d4d0a4796453560b66fc715513768d61 /lld/ELF/Driver.cpp | |
| parent | 00df42459e346a4b3c331bd0f00d06945380fa96 (diff) | |
| download | bcm5719-llvm-00a7cf9ffeeff953e88d8acf611a2d89f4063f06.tar.gz bcm5719-llvm-00a7cf9ffeeff953e88d8acf611a2d89f4063f06.zip | |
[ELF] Ignore _GLOBAL_OFFSET_TABLE_ symbol in shared libs.
This fixes PR26705.
Differential Revision: http://reviews.llvm.org/D18166
llvm-svn: 263594
Diffstat (limited to 'lld/ELF/Driver.cpp')
| -rw-r--r-- | lld/ELF/Driver.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index b7cf7a3374b..0c0e31ec714 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -343,14 +343,15 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) { Config->Rela = ELFT::Is64Bits; - if (!Config->Shared && !Config->Relocatable) { + if (Config->Entry.empty() && !Config->Shared && !Config->Relocatable && + Config->EMachine != EM_AMDGPU) // Add entry symbol. // // There is no entry symbol for AMDGPU binaries, so skip adding one to avoid // having and undefined symbol. - if (Config->Entry.empty() && Config->EMachine != EM_AMDGPU) - Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start"; + Config->Entry = Config->EMachine == EM_MIPS ? "__start" : "_start"; + if (!Config->Relocatable) // In the assembly for 32 bit x86 the _GLOBAL_OFFSET_TABLE_ symbol // is magical and is used to produce a R_386_GOTPC relocation. // The R_386_GOTPC relocation value doesn't actually depend on the @@ -364,7 +365,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) { // Given that the symbol is effectively unused, we just create a dummy // hidden one to avoid the undefined symbol error. Symtab.addIgnored("_GLOBAL_OFFSET_TABLE_"); - } if (!Config->Entry.empty()) { // Set either EntryAddr (if S is a number) or EntrySym (otherwise). |

