diff options
| author | George Rimar <grimar@accesssoftek.com> | 2016-08-19 15:36:32 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2016-08-19 15:36:32 +0000 |
| commit | e1937bb524b7c6fd07f13a1ff42bc942fc05458e (patch) | |
| tree | 1d4372ae3d2d6a75aaac030e51723ede01a31415 /lld/ELF/Writer.cpp | |
| parent | 9989f80ae8f831888f8d263220cce3bb9585564b (diff) | |
| download | bcm5719-llvm-e1937bb524b7c6fd07f13a1ff42bc942fc05458e.tar.gz bcm5719-llvm-e1937bb524b7c6fd07f13a1ff42bc942fc05458e.zip | |
[ELF] - Give automatically generated __start_* and __stop_* symbols default visibility.
This patch is opposite to D19024, which made this symbols to be hidden by default.
Unfortunately FreeBSD loader wants to see
start_set_modmetadata_set/stop_set_modmetadata_set in the dynamic symbol table.
They were not placed there because had hidden visibility.
Patch makes them to have default visibility again.
Differential revision: https://reviews.llvm.org/D23552
llvm-svn: 279262
Diffstat (limited to 'lld/ELF/Writer.cpp')
| -rw-r--r-- | lld/ELF/Writer.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index ecbbc0a3352..b39897f8200 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -519,7 +519,7 @@ static Symbol *addOptionalSynthetic(StringRef Name, return nullptr; if (!S->isUndefined() && !S->isShared()) return S->symbol(); - return Symtab<ELFT>::X->addSynthetic(Name, Sec, Val); + return Symtab<ELFT>::X->addSynthetic(Name, Sec, Val, STV_HIDDEN); } template <class ELFT> @@ -527,7 +527,7 @@ static void addSynthetic(StringRef Name, OutputSectionBase<ELFT> *Sec, typename ELFT::uint Val) { SymbolBody *S = Symtab<ELFT>::X->find(Name); if (!S || S->isUndefined() || S->isShared()) - Symtab<ELFT>::X->addSynthetic(Name, Sec, Val); + Symtab<ELFT>::X->addSynthetic(Name, Sec, Val, STV_HIDDEN); } // The beginning and the ending of .rel[a].plt section are marked // with __rel[a]_iplt_{start,end} symbols if it is a statically linked @@ -554,7 +554,8 @@ template <class ELFT> void Writer<ELFT>::addReservedSymbols() { // so that it points to an absolute address which is relative to GOT. // See "Global Data Symbols" in Chapter 6 in the following document: // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf - Symtab<ELFT>::X->addSynthetic("_gp", Out<ELFT>::Got, MipsGPOffset); + Symtab<ELFT>::X->addSynthetic("_gp", Out<ELFT>::Got, MipsGPOffset, + STV_HIDDEN); // On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between // start of function and 'gp' pointer into GOT. @@ -701,7 +702,8 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { // Even the author of gold doesn't remember why gold behaves that way. // https://sourceware.org/ml/binutils/2002-03/msg00360.html if (Out<ELFT>::DynSymTab) - Symtab<ELFT>::X->addSynthetic("_DYNAMIC", Out<ELFT>::Dynamic, 0); + Symtab<ELFT>::X->addSynthetic("_DYNAMIC", Out<ELFT>::Dynamic, 0, + STV_HIDDEN); // Define __rel[a]_iplt_{start,end} symbols if needed. addRelIpltSymbols(); @@ -893,11 +895,11 @@ void Writer<ELFT>::addStartStopSymbols(OutputSectionBase<ELFT> *Sec) { StringRef Stop = Saver.save("__stop_" + S); if (SymbolBody *B = Symtab<ELFT>::X->find(Start)) if (B->isUndefined()) - Symtab<ELFT>::X->addSynthetic(Start, Sec, 0); + Symtab<ELFT>::X->addSynthetic(Start, Sec, 0, B->getVisibility()); if (SymbolBody *B = Symtab<ELFT>::X->find(Stop)) if (B->isUndefined()) - Symtab<ELFT>::X->addSynthetic(Stop, Sec, - DefinedSynthetic<ELFT>::SectionEnd); + Symtab<ELFT>::X->addSynthetic( + Stop, Sec, DefinedSynthetic<ELFT>::SectionEnd, B->getVisibility()); } template <class ELFT> |

