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
This commit is contained in:
Rui Ueyama 2015-10-13 18:10:33 +00:00
parent 0d7e83bbc4
commit 93bfee5f70
3 changed files with 10 additions and 9 deletions

View File

@ -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);
}

View File

@ -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))

View File

@ -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);