[PATCH] D59075: [WebAssembly] Don't mark lazy symbols as `IsUsedInRegularObj`
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 21:02:51 PST 2019
sbc100 created this revision.
Herald added subscribers: llvm-commits, MaskRay, sunfish, aheejin, jgravelle-google, arichardson, emaste, dschuff.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
sbc100 added reviewers: pcc, ruiu.
This matches the ELF does. Update the comment in ELF/Symbols.h and
duplicate it in wasm/Symbols.h
This a followup on rL355580 <https://reviews.llvm.org/rL355580> and rL355577 <https://reviews.llvm.org/rL355577>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D59075
Files:
lld/ELF/Symbols.h
lld/wasm/Driver.cpp
lld/wasm/SymbolTable.cpp
lld/wasm/Symbols.h
lld/wasm/Writer.cpp
Index: lld/wasm/Writer.cpp
===================================================================
--- lld/wasm/Writer.cpp
+++ lld/wasm/Writer.cpp
@@ -950,7 +950,7 @@
};
for (Symbol *Sym : Symtab->getSymbols())
- if (!Sym->isLazy() && Sym->IsUsedInRegularObj)
+ if (Sym->IsUsedInRegularObj)
AddSymbol(Sym);
for (ObjFile *File : Symtab->ObjectFiles) {
Index: lld/wasm/Symbols.h
===================================================================
--- lld/wasm/Symbols.h
+++ lld/wasm/Symbols.h
@@ -98,8 +98,14 @@
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.
Index: lld/wasm/SymbolTable.cpp
===================================================================
--- lld/wasm/SymbolTable.cpp
+++ lld/wasm/SymbolTable.cpp
@@ -442,7 +442,7 @@
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);
Index: lld/wasm/Driver.cpp
===================================================================
--- lld/wasm/Driver.cpp
+++ lld/wasm/Driver.cpp
@@ -1,4 +1,4 @@
-//===- Driver.cpp ---------------------------------------------------------===//
+//== Driver.cpp ---------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Index: lld/ELF/Symbols.h
===================================================================
--- lld/ELF/Symbols.h
+++ lld/ELF/Symbols.h
@@ -109,8 +109,8 @@
// 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59075.189650.patch
Type: text/x-patch
Size: 2754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190307/d8b71481/attachment.bin>
More information about the llvm-commits
mailing list