[lld] r287198 - Use uint16_t instead of size_t for symbol version ID.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 16 19:39:22 PST 2016
Author: ruiu
Date: Wed Nov 16 21:39:21 2016
New Revision: 287198
URL: http://llvm.org/viewvc/llvm-project?rev=287198&view=rev
Log:
Use uint16_t instead of size_t for symbol version ID.
Because it is uint16_t in the ELF spec. Using size_t was confusing.
Modified:
lld/trunk/ELF/Config.h
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=287198&r1=287197&r2=287198&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Wed Nov 16 21:39:21 2016
@@ -58,9 +58,9 @@ struct SymbolVersion {
// This struct contains symbols version definition that
// can be found in version script if it is used for link.
struct VersionDefinition {
- VersionDefinition(llvm::StringRef Name, size_t Id) : Name(Name), Id(Id) {}
+ VersionDefinition(llvm::StringRef Name, uint16_t Id) : Name(Name), Id(Id) {}
llvm::StringRef Name;
- size_t Id;
+ uint16_t Id;
std::vector<SymbolVersion> Globals;
size_t NameOff; // Offset in string table.
};
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=287198&r1=287197&r2=287198&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Nov 16 21:39:21 2016
@@ -1802,7 +1802,7 @@ unsigned ScriptParser::readPhdrType() {
void ScriptParser::readVersionDeclaration(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->VersionDefinitions.size() + 2;
+ uint16_t VersionId = Config->VersionDefinitions.size() + 2;
Config->VersionDefinitions.push_back({VerStr, VersionId});
if (consume("global:") || peek() != "local:")
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=287198&r1=287197&r2=287198&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Nov 16 21:39:21 2016
@@ -648,7 +648,7 @@ template <class ELFT> void SymbolTable<E
// Set symbol versions to symbols. This function handles patterns
// containing no wildcard characters.
template <class ELFT>
-void SymbolTable<ELFT>::assignExactVersion(SymbolVersion Ver, size_t VersionId,
+void SymbolTable<ELFT>::assignExactVersion(SymbolVersion Ver, uint16_t VersionId,
StringRef VersionName) {
if (Ver.HasWildcards)
return;
@@ -677,7 +677,7 @@ void SymbolTable<ELFT>::assignExactVersi
template <class ELFT>
void SymbolTable<ELFT>::assignWildcardVersion(SymbolVersion Ver,
- size_t VersionId) {
+ uint16_t VersionId) {
if (!Ver.HasWildcards)
return;
StringMatcher M({Ver.Name});
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=287198&r1=287197&r2=287198&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Wed Nov 16 21:39:21 2016
@@ -103,9 +103,9 @@ private:
void initDemangledSyms();
void handleAnonymousVersion();
- void assignExactVersion(SymbolVersion Ver, size_t VersionId,
+ void assignExactVersion(SymbolVersion Ver, uint16_t VersionId,
StringRef VersionName);
- void assignWildcardVersion(SymbolVersion Ver, size_t VersionId);
+ void assignWildcardVersion(SymbolVersion Ver, uint16_t VersionId);
struct SymIndex {
SymIndex(int Idx, bool Traced) : Idx(Idx), Traced(Traced) {}
More information about the llvm-commits
mailing list