ELF2: Implement --as-needed.

This patch adds AsNeeded and IsUsed bool fields to SharedFile. AsNeeded bit
is set if the DSO is enclosed with --as-needed and --no-as-needed. IsUsed
bit is off by default. When we adds a symbol to the symbol table for dynamic
linking, we set its SharedFile's IsUsed bit.

If AsNeeded is set but IsUsed is not set, we don't want to write that
file's SO name to DT_NEEDED field.

http://reviews.llvm.org/D13579

llvm-svn: 249998
This commit is contained in:
Rui Ueyama
2015-10-11 20:59:12 +00:00
parent 78ed9b43fd
commit 35da9b6e1c
13 changed files with 106 additions and 17 deletions

View File

@@ -329,7 +329,7 @@ template <class ELFT> void SharedFile<ELFT>::parse() {
error(NameOrErr.getError());
StringRef Name = *NameOrErr;
SymbolBodies.emplace_back(Name, Sym);
SymbolBodies.emplace_back(this, Name, Sym);
}
}