bool Threads;
bool Trace;
bool Verbose;
- bool VersionScriptGlobalByDefault = true;
bool WarnCommon;
bool ZCombreloc;
bool ZExecStack;
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;
#include "llvm/Support/MemoryBuffer.h"
using namespace llvm;
+using namespace llvm::ELF;
+
using namespace lld;
using namespace lld::elf;
expect("local:");
expect("*");
expect(";");
- Config->VersionScriptGlobalByDefault = false;
+ Config->DefaultSymbolVersion = VER_NDX_LOCAL;
}
void VersionScriptParser::parseVersionSymbols(StringRef Version) {
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.
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;
}
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;
}
}