[lld] r250191 - ELF2: Avoid using "finalize" as a function name.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 13 11:10:34 PDT 2015
Author: ruiu
Date: Tue Oct 13 13:10:33 2015
New Revision: 250191
URL: http://llvm.org/viewvc/llvm-project?rev=250191&view=rev
Log:
ELF2: Avoid using "finalize" as a function name.
"finalize" does not give a hint about what that function is actually
going to do. This patch make it more specific by renaming scanShlibUndefined.
Also add a comment that we basically ignore undefined symbols in DSOs except
this function.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=250191&r1=250190&r2=250191&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Oct 13 13:10:33 2015
@@ -227,6 +227,6 @@ template <class ELFT> void LinkerDriver:
Config->OutputFile = "a.out";
// Write the result to the file.
- Symtab.finalize();
+ Symtab.scanShlibUndefined();
writeResult<ELFT>(&Symtab);
}
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=250191&r1=250190&r2=250191&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Oct 13 13:10:33 2015
@@ -237,13 +237,14 @@ template <class ELFT> void SymbolTable<E
addFile(std::move(File));
}
-template <class ELFT> void SymbolTable<ELFT>::finalize() {
- // This code takes care of the case in which shared libraries depend on
- // the user program (not the other way, which is usual). Shared libraries
- // may have undefined symbols, expecting that the user program provides
- // the definitions for them. An example is BSD's __progname symbol.
- // We need to put such symbols to the main program's .dynsym so that
- // shared libraries can find them.
+// This function takes care of the case in which shared libraries depend on
+// the user program (not the other way, which is usual). Shared libraries
+// may have undefined symbols, expecting that the user program provides
+// the definitions for them. An example is BSD's __progname symbol.
+// We need to put such symbols to the main program's .dynsym so that
+// shared libraries can find them.
+// Except this, we ignore undefined symbols in DSOs.
+template <class ELFT> void SymbolTable<ELFT>::scanShlibUndefined() {
for (std::unique_ptr<SharedFile<ELFT>> &File : SharedFiles)
for (StringRef U : File->getUndefinedSymbols())
if (SymbolBody *Sym = find(U))
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=250191&r1=250190&r2=250191&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Tue Oct 13 13:10:33 2015
@@ -52,7 +52,7 @@ public:
void addSyntheticSym(StringRef Name, OutputSection<ELFT> &Section,
typename llvm::object::ELFFile<ELFT>::uintX_t Value);
void addIgnoredSym(StringRef Name);
- void finalize();
+ void scanShlibUndefined();
private:
Symbol *insert(SymbolBody *New);
More information about the llvm-commits
mailing list