[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:04:01 PST 2019


sbc100 updated this revision to Diff 189651.
sbc100 added a comment.

- revert


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59075/new/

https://reviews.llvm.org/D59075

Files:
  lld/ELF/Symbols.h
  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/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.189651.patch
Type: text/x-patch
Size: 2285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190307/7e094fc7/attachment.bin>


More information about the llvm-commits mailing list