diff options
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> | 

