[lld] r275669 - Simplify default symbol version management. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 15 20:08:27 PDT 2016
Author: ruiu
Date: Fri Jul 15 22:08:26 2016
New Revision: 275669
URL: http://llvm.org/viewvc/llvm-project?rev=275669&view=rev
Log:
Simplify default symbol version management. NFC.
Modified:
lld/trunk/ELF/Config.h
lld/trunk/ELF/SymbolListFile.cpp
lld/trunk/ELF/SymbolTable.cpp
Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=275669&r1=275668&r2=275669&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Fri Jul 15 22:08:26 2016
@@ -104,7 +104,6 @@ struct Configuration {
bool Threads;
bool Trace;
bool Verbose;
- bool VersionScriptGlobalByDefault = true;
bool WarnCommon;
bool ZCombreloc;
bool ZExecStack;
@@ -115,6 +114,7 @@ struct Configuration {
UnresolvedPolicy UnresolvedSymbols;
BuildIdKind BuildId = BuildIdKind::None;
ELFKind EKind = ELFNoneKind;
+ uint16_t DefaultSymbolVersion = llvm::ELF::VER_NDX_GLOBAL;
uint16_t EMachine = llvm::ELF::EM_NONE;
uint64_t EntryAddr = -1;
uint64_t ImageBase;
Modified: lld/trunk/ELF/SymbolListFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolListFile.cpp?rev=275669&r1=275668&r2=275669&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolListFile.cpp (original)
+++ lld/trunk/ELF/SymbolListFile.cpp Fri Jul 15 22:08:26 2016
@@ -19,6 +19,8 @@
#include "llvm/Support/MemoryBuffer.h"
using namespace llvm;
+using namespace llvm::ELF;
+
using namespace lld;
using namespace lld::elf;
@@ -117,7 +119,7 @@ void VersionScriptParser::parseLocal() {
expect("local:");
expect("*");
expect(";");
- Config->VersionScriptGlobalByDefault = false;
+ Config->DefaultSymbolVersion = VER_NDX_LOCAL;
}
void VersionScriptParser::parseVersionSymbols(StringRef Version) {
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=275669&r1=275668&r2=275669&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Fri Jul 15 22:08:26 2016
@@ -170,8 +170,7 @@ static uint8_t getMinVisibility(uint8_t
static uint16_t getVersionId(Symbol *Sym, StringRef Name) {
size_t VersionBegin = Name.find('@');
if (VersionBegin == StringRef::npos)
- return Config->VersionScriptGlobalByDefault ? VER_NDX_GLOBAL
- : VER_NDX_LOCAL;
+ return Config->DefaultSymbolVersion;
// If symbol name contains '@' or '@@' we can assign its version id right
// here. '@@' means the default version. It is usually the most recent one.
@@ -604,8 +603,7 @@ template <class ELFT> void SymbolTable<E
continue;
}
- if (B->symbol()->VersionId != VER_NDX_GLOBAL &&
- B->symbol()->VersionId != VER_NDX_LOCAL)
+ if (B->symbol()->VersionId != Config->DefaultSymbolVersion)
warning("duplicate symbol " + Name + " in version script");
B->symbol()->VersionId = V.Id;
}
@@ -618,8 +616,7 @@ template <class ELFT> void SymbolTable<E
continue;
for (SymbolBody *B : findAll(Name))
- if (B->symbol()->VersionId == VER_NDX_GLOBAL ||
- B->symbol()->VersionId == VER_NDX_LOCAL)
+ if (B->symbol()->VersionId == Config->DefaultSymbolVersion)
B->symbol()->VersionId = V.Id;
}
}
More information about the llvm-commits
mailing list