// This struct contains symbols version definition that
// can be found in version script if it is used for link.
-struct Version {
- Version(llvm::StringRef Name, size_t Id) : Name(Name), Id(Id) {}
+struct VersionDefinition {
+ VersionDefinition(llvm::StringRef Name, size_t Id) : Name(Name), Id(Id) {}
llvm::StringRef Name;
size_t Id;
std::vector<llvm::StringRef> Globals;
llvm::StringRef Sysroot;
llvm::StringSet<> TraceSymbol;
std::string RPath;
- std::vector<Version> SymbolVersions;
+ std::vector<VersionDefinition> SymbolVersions;
std::vector<llvm::StringRef> DynamicList;
std::vector<llvm::StringRef> SearchPaths;
std::vector<llvm::StringRef> Undefined;
template <class ELFT> void VersionDefinitionSection<ELFT>::finalize() {
FileDefNameOff = Out<ELFT>::DynStrTab->addString(getFileDefName());
- for (Version &V : Config->SymbolVersions)
+ for (VersionDefinition &V : Config->SymbolVersions)
V.NameOff = Out<ELFT>::DynStrTab->addString(V.Name);
this->Header.sh_size =
void VersionDefinitionSection<ELFT>::writeTo(uint8_t *Buf) {
writeOne(Buf, 1, getFileDefName(), FileDefNameOff);
- for (Version &V : Config->SymbolVersions) {
+ for (VersionDefinition &V : Config->SymbolVersions) {
Buf += sizeof(Elf_Verdef) + sizeof(Elf_Verdaux);
writeOne(Buf, V.Id, V.Name, V.NameOff);
}
class SymbolBody;
struct SectionPiece;
-struct Version;
template <class ELFT> class SymbolTable;
template <class ELFT> class SymbolTableSection;
template <class ELFT> class StringTableSection;
void run();
private:
- void parseVersion(StringRef Version);
- void parseGlobal(StringRef Version);
+ void parseVersion(StringRef VerStr);
+ void parseGlobal(StringRef VerStr);
void parseLocal();
};
-size_t elf::defineSymbolVersion(StringRef Version) {
+size_t elf::defineSymbolVersion(StringRef VerStr) {
// Identifiers start at 2 because 0 and 1 are reserved
// for VER_NDX_LOCAL and VER_NDX_GLOBAL constants.
size_t VersionId = Config->SymbolVersions.size() + 2;
- Config->SymbolVersions.push_back(elf::Version(Version, VersionId));
+ Config->SymbolVersions.push_back({VerStr, VersionId});
return VersionId;
}
-void VersionScriptParser::parseVersion(StringRef Version) {
- defineSymbolVersion(Version);
+void VersionScriptParser::parseVersion(StringRef VerStr) {
+ defineSymbolVersion(VerStr);
if (skip("global:") || peek() != "local:")
- parseGlobal(Version);
+ parseGlobal(VerStr);
if (skip("local:"))
parseLocal();
expect("}");
// "Ver2 { global: foo; local: *; } Ver1;" has "Ver1" as a parent. This
// version hierarchy is, probably against your instinct, purely for human; the
// runtime doesn't care about them at all. In LLD, we simply skip the token.
- if (!Version.empty() && peek() != ";")
+ if (!VerStr.empty() && peek() != ";")
next();
expect(";");
}
expect(";");
}
-void VersionScriptParser::parseGlobal(StringRef Version) {
+void VersionScriptParser::parseGlobal(StringRef VerStr) {
std::vector<StringRef> *Globals;
- if (Version.empty())
+ if (VerStr.empty())
Globals = &Config->VersionScriptGlobals;
else
Globals = &Config->SymbolVersions.back().Globals;
}
while (!atEOF() && !Error) {
- StringRef Version = next();
- if (Version == "{") {
+ StringRef VerStr = next();
+ if (VerStr == "{") {
setError(Msg);
return;
}
expect("{");
- parseVersion(Version);
+ parseVersion(VerStr);
}
}
if (Default)
Version = Version.drop_front();
- for (elf::Version &V : Config->SymbolVersions)
+ for (VersionDefinition &V : Config->SymbolVersions)
if (V.Name == Version)
return Default ? V.Id : (V.Id | VERSYM_HIDDEN);
// version tags in reverse order. We use the first match we find (the last
// matching version tag in the file).
for (size_t I = 0, E = Config->SymbolVersions.size(); I < E; ++I) {
- Version &V = Config->SymbolVersions[I];
+ VersionDefinition &V = Config->SymbolVersions[I];
for (StringRef Name : V.Globals) {
if (hasWildcard(Name))
continue;
}
for (size_t I = Config->SymbolVersions.size() - 1; I != (size_t)-1; --I) {
- Version &V = Config->SymbolVersions[I];
+ VersionDefinition &V = Config->SymbolVersions[I];
for (StringRef Name : V.Globals)
if (hasWildcard(Name))
for (SymbolBody *B : findAll(Name))
class InputFile;
class LazyObjectFile;
class SymbolBody;
-struct Version;
template <class ELFT> class ObjectFile;
template <class ELFT> class OutputSection;
template <class ELFT> class OutputSectionBase;