From abebed982a73d30185a8258fa98fb40b6abf65e6 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 5 Feb 2016 15:27:15 +0000 Subject: [PATCH] Rename IsUsedInDynamicReloc to MustBeInDynSym. The variable was marking various cases where a symbol must be included in the dynamic symbol table. Being used by a dynamic relocation was only one of them. llvm-svn: 259889 --- lld/ELF/OutputSections.cpp | 2 +- lld/ELF/SymbolTable.cpp | 2 +- lld/ELF/Symbols.cpp | 2 +- lld/ELF/Symbols.h | 11 +++++------ lld/ELF/Writer.cpp | 5 ++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 0565f36a5611..cb98326d4404 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -219,7 +219,7 @@ template void RelocationSection::addReloc(const DynamicReloc &Reloc) { SymbolBody *Sym = Reloc.Sym; if (!Reloc.UseSymVA && Sym) - Sym->setUsedInDynamicReloc(); + Sym->MustBeInDynSym = true; Relocs.push_back(Reloc); } diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index b5b902d3c5f1..7da4e2cd9688 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -268,7 +268,7 @@ template void SymbolTable::scanShlibUndefined() { for (StringRef U : File->getUndefinedSymbols()) if (SymbolBody *Sym = find(U)) if (Sym->isDefined()) - Sym->setUsedInDynamicReloc(); + Sym->MustBeInDynSym = true; } template class elf2::SymbolTable; diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index dec844277c11..4b238f8f31a8 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -128,7 +128,7 @@ template int SymbolBody::compare(SymbolBody *Other) { // symbols in the DSO at runtime. if (isShared() != Other->isShared()) if (isa>(isShared() ? Other : this)) - IsUsedInDynamicReloc = Other->IsUsedInDynamicReloc = true; + MustBeInDynSym = Other->MustBeInDynSym = true; if (L != R) return -1; diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index 1d67d3b31c58..84b880fde18d 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -83,8 +83,6 @@ public: bool isLazy() const { return SymbolKind == LazyKind; } bool isShared() const { return SymbolKind == SharedKind; } bool isUsedInRegularObj() const { return IsUsedInRegularObj; } - bool isUsedInDynamicReloc() const { return IsUsedInDynamicReloc; } - void setUsedInDynamicReloc() { IsUsedInDynamicReloc = true; } bool isTls() const { return IsTls; } bool isFunc() const { return IsFunc; } @@ -131,10 +129,9 @@ public: protected: SymbolBody(Kind K, StringRef Name, bool IsWeak, uint8_t Visibility, bool IsTls, bool IsFunc) - : SymbolKind(K), IsWeak(IsWeak), Visibility(Visibility), IsTls(IsTls), - IsFunc(IsFunc), Name(Name) { + : SymbolKind(K), IsWeak(IsWeak), Visibility(Visibility), + MustBeInDynSym(false), IsTls(IsTls), IsFunc(IsFunc), Name(Name) { IsUsedInRegularObj = K != SharedKind && K != LazyKind; - IsUsedInDynamicReloc = 0; } const unsigned SymbolKind : 8; @@ -147,9 +144,11 @@ protected: // it can be false. unsigned IsUsedInRegularObj : 1; +public: // If true, the symbol is added to .dynsym symbol table. - unsigned IsUsedInDynamicReloc : 1; + unsigned MustBeInDynSym : 1; +protected: unsigned IsTls : 1; unsigned IsFunc : 1; StringRef Name; diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index fa80226af145..bf613405c1f7 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -366,8 +366,7 @@ void Writer::scanRelocs( // See "Global Offset Table" in Chapter 5 in the following document // for detailed description: // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf - // FIXME: Why do we need to set this here? - Body->setUsedInDynamicReloc(); + Body->MustBeInDynSym = true; continue; } @@ -778,7 +777,7 @@ static bool includeInDynsym(const SymbolBody &B) { return false; if (Config->ExportDynamic || Config->Shared) return true; - return B.isUsedInDynamicReloc(); + return B.MustBeInDynSym; } // This class knows how to create an output section for a given