diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-10-13 18:10:33 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-10-13 18:10:33 +0000 |
| commit | 93bfee5f70c06ff61183fd0e15e4fbe30fe1d4f3 (patch) | |
| tree | fecf00322b5e1a600d394c9bc99541f50764dc46 | |
| parent | 0d7e83bbc49373504cc634d9208422102c15d575 (diff) | |
| download | bcm5719-llvm-93bfee5f70c06ff61183fd0e15e4fbe30fe1d4f3.tar.gz bcm5719-llvm-93bfee5f70c06ff61183fd0e15e4fbe30fe1d4f3.zip | |
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.
llvm-svn: 250191
| -rw-r--r-- | lld/ELF/Driver.cpp | 2 | ||||
| -rw-r--r-- | lld/ELF/SymbolTable.cpp | 15 | ||||
| -rw-r--r-- | lld/ELF/SymbolTable.h | 2 |
3 files changed, 10 insertions, 9 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 346ab44e097..0c9ab316ecc 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -227,6 +227,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) { Config->OutputFile = "a.out"; // Write the result to the file. - Symtab.finalize(); + Symtab.scanShlibUndefined(); writeResult<ELFT>(&Symtab); } diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index a74913cc5fa..42837079bce 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -237,13 +237,14 @@ template <class ELFT> void SymbolTable<ELFT>::addMemberFile(Lazy *Body) { 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)) diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index a41d8d3b2cd..c306fb11f26 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -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); |

