forked from OSchip/llvm-project
Simplify default symbol version management. NFC.
llvm-svn: 275669
This commit is contained in:
parent
a834ff260a
commit
2506866ff6
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -170,8 +170,7 @@ static uint8_t getMinVisibility(uint8_t VA, uint8_t VB) {
|
|||
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<ELFT>::scanVersionScript() {
|
|||
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<ELFT>::scanVersionScript() {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue