[lld] r355737 - [WebAssembly] Don't mark lazy symbols as `IsUsedInRegularObj`
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 8 13:10:48 PST 2019
Author: sbc
Date: Fri Mar 8 13:10:48 2019
New Revision: 355737
URL: http://llvm.org/viewvc/llvm-project?rev=355737&view=rev
Log:
[WebAssembly] Don't mark lazy symbols as `IsUsedInRegularObj`
This matches the ELF does. Update the comment in ELF/Symbols.h and
duplicate it in wasm/Symbols.h
This a followup on rL355580 and rL355577.
Differential Revision: https://reviews.llvm.org/D59075
Modified:
lld/trunk/ELF/Symbols.h
lld/trunk/wasm/SymbolTable.cpp
lld/trunk/wasm/Symbols.h
lld/trunk/wasm/Writer.cpp
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=355737&r1=355736&r2=355737&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Fri Mar 8 13:10:48 2019
@@ -109,8 +109,8 @@ public:
// True if the symbol was used for linking and thus need to be added to the
// output file's symbol table. This is true for all symbols except for
- // unreferenced DSO symbols and bitcode symbols that are unreferenced except
- // by other bitcode objects.
+ // unreferenced DSO symbols, lazy (archive) symbols, and bitcode symbols that
+ // are unreferenced except by other bitcode objects.
unsigned IsUsedInRegularObj : 1;
// If this flag is true and the symbol has protected or default visibility, it
Modified: lld/trunk/wasm/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/SymbolTable.cpp?rev=355737&r1=355736&r2=355737&view=diff
==============================================================================
--- lld/trunk/wasm/SymbolTable.cpp (original)
+++ lld/trunk/wasm/SymbolTable.cpp Fri Mar 8 13:10:48 2019
@@ -191,7 +191,7 @@ DefinedFunction *SymbolTable::addSynthet
LLVM_DEBUG(dbgs() << "addSyntheticFunction: " << Name << "\n");
assert(!find(Name));
SyntheticFunctions.emplace_back(Function);
- return replaceSymbol<DefinedFunction>(insert(Name, nullptr).first, Name,
+ return replaceSymbol<DefinedFunction>(insertName(Name).first, Name,
Flags, nullptr, Function);
}
@@ -199,7 +199,7 @@ DefinedData *SymbolTable::addSyntheticDa
uint32_t Flags) {
LLVM_DEBUG(dbgs() << "addSyntheticDataSymbol: " << Name << "\n");
assert(!find(Name));
- return replaceSymbol<DefinedData>(insert(Name, nullptr).first, Name, Flags);
+ return replaceSymbol<DefinedData>(insertName(Name).first, Name, Flags);
}
DefinedGlobal *SymbolTable::addSyntheticGlobal(StringRef Name, uint32_t Flags,
@@ -208,7 +208,7 @@ DefinedGlobal *SymbolTable::addSynthetic
<< "\n");
assert(!find(Name));
SyntheticGlobals.emplace_back(Global);
- return replaceSymbol<DefinedGlobal>(insert(Name, nullptr).first, Name, Flags,
+ return replaceSymbol<DefinedGlobal>(insertName(Name).first, Name, Flags,
nullptr, Global);
}
@@ -442,7 +442,7 @@ void SymbolTable::addLazy(ArchiveFile *F
Symbol *S;
bool WasInserted;
- std::tie(S, WasInserted) = insert(Name, nullptr);
+ std::tie(S, WasInserted) = insertName(Name);
if (WasInserted) {
replaceSymbol<LazySymbol>(S, Name, 0, File, *Sym);
Modified: lld/trunk/wasm/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Symbols.h?rev=355737&r1=355736&r2=355737&view=diff
==============================================================================
--- lld/trunk/wasm/Symbols.h (original)
+++ lld/trunk/wasm/Symbols.h Fri Mar 8 13:10:48 2019
@@ -98,8 +98,14 @@ public:
WasmSymbolType getWasmType() const;
bool isExported() const;
- // True if this symbol was referenced by a regular (non-bitcode) object.
+ // True if the symbol was used for linking and thus need to be added to the
+ // output file's symbol table. This is true for all symbols except for
+ // unreferenced DSO symbols, lazy (archive) symbols, and bitcode symbols that
+ // are unreferenced except by other bitcode objects.
unsigned IsUsedInRegularObj : 1;
+
+ // True if ths symbol is explicity marked for export (i.e. via the -e/--export
+ // command line flag)
unsigned ForceExport : 1;
// True if this symbol is specified by --trace-symbol option.
Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=355737&r1=355736&r2=355737&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Fri Mar 8 13:10:48 2019
@@ -950,7 +950,7 @@ void Writer::assignSymtab() {
};
for (Symbol *Sym : Symtab->getSymbols())
- if (!Sym->isLazy() && Sym->IsUsedInRegularObj)
+ if (Sym->IsUsedInRegularObj)
AddSymbol(Sym);
for (ObjFile *File : Symtab->ObjectFiles) {
More information about the llvm-commits
mailing list