[PATCH] D79247: [lld][WebAssembly] Honor --allow-undefined for data symbols too

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 13:00:59 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf03b6e785b34: [lld][WebAssembly] Honor --allow-undefined for data symbols too (authored by sbc100).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79247

Files:
  lld/test/wasm/undefined-data.ll
  lld/wasm/Relocations.cpp


Index: lld/wasm/Relocations.cpp
===================================================================
--- lld/wasm/Relocations.cpp
+++ lld/wasm/Relocations.cpp
@@ -21,13 +21,6 @@
 }
 
 static bool allowUndefined(const Symbol* sym) {
-  // Historically --allow-undefined doesn't work for data symbols since we don't
-  // have any way to represent these as imports in the final binary.  The idea
-  // behind allowing undefined symbols is to allow importing these symbols from
-  // the embedder and we can't do this for data symbols (at least not without
-  // compiling with -fPIC)
-  if (isa<DataSymbol>(sym))
-    return false;
   // Undefined functions with explicit import name are allowed to be undefined
   // at link time.
   if (auto *F = dyn_cast<UndefinedFunction>(sym))
Index: lld/test/wasm/undefined-data.ll
===================================================================
--- lld/test/wasm/undefined-data.ll
+++ lld/test/wasm/undefined-data.ll
@@ -1,6 +1,6 @@
 ; RUN: llc -filetype=obj %s -o %t.o
 ; RUN: not wasm-ld -o %t.wasm %t.o 2>&1 | FileCheck %s -check-prefix=UNDEF
-; RUN: not wasm-ld --allow-undefined -o %t.wasm %t.o 2>&1 | FileCheck %s -check-prefix=UNDEF
+; RUN: wasm-ld --allow-undefined -o %t.wasm %t.o
 ; RUN: not wasm-ld --shared -o %t.wasm %t.o 2>&1 | FileCheck %s -check-prefix=SHARED
 
 target triple = "wasm32-unknown-unknown"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79247.262460.patch
Type: text/x-patch
Size: 1362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200506/4113251d/attachment.bin>


More information about the llvm-commits mailing list