[PATCH] D59075: [WebAssembly] Don't mark lazy symbols as `IsUsedInRegularObj`

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 13:09:57 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL355737: [WebAssembly] Don't mark lazy symbols as `IsUsedInRegularObj` (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D59075?vs=189651&id=189912#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D59075

Files:
  lld/trunk/ELF/Symbols.h
  lld/trunk/wasm/SymbolTable.cpp
  lld/trunk/wasm/Symbols.h
  lld/trunk/wasm/Writer.cpp


Index: lld/trunk/wasm/SymbolTable.cpp
===================================================================
--- lld/trunk/wasm/SymbolTable.cpp
+++ lld/trunk/wasm/SymbolTable.cpp
@@ -191,7 +191,7 @@
   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 @@
                                                  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 @@
                     << "\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 @@
 
   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/trunk/wasm/Writer.cpp
===================================================================
--- lld/trunk/wasm/Writer.cpp
+++ lld/trunk/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/trunk/wasm/Symbols.h
===================================================================
--- lld/trunk/wasm/Symbols.h
+++ lld/trunk/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/trunk/ELF/Symbols.h
===================================================================
--- lld/trunk/ELF/Symbols.h
+++ lld/trunk/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.189912.patch
Type: text/x-patch
Size: 3491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190308/22045c30/attachment.bin>


More information about the llvm-commits mailing list