[lld] [lld][WebAssembly] Handle stub symbol dependencies when an explicit import name is used (PR #80169)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 09:19:10 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 16c4843d3263050b359733a05e86cc4a09361aed 1fc5bc55edaefac18bce78407e2b40edb42b1751 -- lld/wasm/Driver.cpp lld/wasm/SymbolTable.cpp lld/wasm/SymbolTable.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp
index d984987591..fcbc33f534 100644
--- a/lld/wasm/Driver.cpp
+++ b/lld/wasm/Driver.cpp
@@ -952,22 +952,21 @@ static bool addStubSymbolDeps(const StubFile *stub_file, Symbol *sym,
   // The first stub library to define a given symbol sets this and
   // definitions in later stub libraries are ignored.
   if (sym->forceImport)
-    return false;  // Already handled
+    return false; // Already handled
   sym->forceImport = true;
   if (sym->traced)
     message(toString(stub_file) + ": importing " + sym->getName());
   else
-    LLVM_DEBUG(llvm::dbgs()
-               << toString(stub_file) << ": importing " << sym->getName() << "\n");
+    LLVM_DEBUG(llvm::dbgs() << toString(stub_file) << ": importing "
+                            << sym->getName() << "\n");
   bool depsAdded = false;
   for (const auto dep : deps) {
-    auto* needed = symtab->find(dep);
+    auto *needed = symtab->find(dep);
     if (!needed) {
       error(toString(stub_file) + ": undefined symbol: " + dep +
             ". Required by " + toString(*sym));
     } else if (needed->isUndefined()) {
-      error(toString(stub_file) +
-            ": undefined symbol: " + toString(*needed) +
+      error(toString(stub_file) + ": undefined symbol: " + toString(*needed) +
             ". Required by " + toString(*sym));
     } else {
       if (needed->traced)
@@ -1008,7 +1007,8 @@ static void processStubLibraries() {
           if (sym && sym->traced)
             message(toString(stub_file) + ": stub symbol not needed: " + name);
           else
-            LLVM_DEBUG(llvm::dbgs() << "stub symbol not needed: `" << name << "`\n");
+            LLVM_DEBUG(llvm::dbgs()
+                       << "stub symbol not needed: `" << name << "`\n");
         }
       }
 
diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index b6b52b1f18..8a1c0ab1d4 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -507,7 +507,6 @@ static void setImportAttributes(T *existing,
   }
 }
 
-
 static void traceImport(std::optional<StringRef> importName, InputFile *file) {
   if (importName.has_value()) {
     auto name = importName.value();

``````````

</details>


https://github.com/llvm/llvm-project/pull/80169


More information about the llvm-commits mailing list