[lld] r299573 - Rename ScriptConfig::UndefinedSymbols ReferencedSymbols.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 11:02:30 PDT 2017


Author: ruiu
Date: Wed Apr  5 13:02:30 2017
New Revision: 299573

URL: http://llvm.org/viewvc/llvm-project?rev=299573&view=rev
Log:
Rename ScriptConfig::UndefinedSymbols ReferencedSymbols.

Symbols referenced by linker scripts are not necessarily be undefined,
so the previous name didn't convey the meaining of the variable.

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/ELF/LinkerScript.h
    lld/trunk/ELF/ScriptParser.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=299573&r1=299572&r2=299573&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Apr  5 13:02:30 2017
@@ -906,7 +906,7 @@ template <class ELFT> void LinkerDriver:
 
   // Some symbols (such as __ehdr_start) are defined lazily only when there
   // are undefined symbols for them, so we add these to trigger that logic.
-  for (StringRef Sym : Script->Opt.UndefinedSymbols)
+  for (StringRef Sym : Script->Opt.ReferencedSymbols)
     Symtab.addUndefined(Sym);
 
   for (auto *Arg : Args.filtered(OPT_wrap))

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=299573&r1=299572&r2=299573&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Wed Apr  5 13:02:30 2017
@@ -209,7 +209,7 @@ struct ScriptConfiguration {
   llvm::DenseMap<llvm::StringRef, MemoryRegion> MemoryRegions;
 
   // A list of undefined symbols referenced by the script.
-  std::vector<llvm::StringRef> UndefinedSymbols;
+  std::vector<llvm::StringRef> ReferencedSymbols;
 };
 
 class LinkerScript {

Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=299573&r1=299572&r2=299573&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Wed Apr  5 13:02:30 2017
@@ -913,17 +913,19 @@ Expr ScriptParser::readPrimary() {
   if (Tok == "SIZEOF_HEADERS")
     return [=] { return elf::getHeaderSize(); };
 
+  // Tok is the dot.
+  if (Tok == ".")
+    return [=] { return Script->getSymbolValue(Location, Tok); };
+
   // Tok is a literal number.
   uint64_t V;
   if (readInteger(Tok, V))
     return [=] { return V; };
 
   // Tok is a symbol name.
-  if (Tok != ".") {
-    if (!isValidCIdentifier(Tok))
-      setError("malformed number: " + Tok);
-    Script->Opt.UndefinedSymbols.push_back(Tok);
-  }
+  if (!isValidCIdentifier(Tok))
+    setError("malformed number: " + Tok);
+  Script->Opt.ReferencedSymbols.push_back(Tok);
   return [=] { return Script->getSymbolValue(Location, Tok); };
 }
 




More information about the llvm-commits mailing list