[PATCH] D106385: [lld][WebAssembly] Error on import of TLS symbols in shared libraries

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 12:36:46 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd51f74acdf39: [lld][WebAssembly] Error on import of TLS symbols in shared libraries (authored by sbc100).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106385

Files:
  lld/test/wasm/tls-import.s
  lld/wasm/Relocations.cpp


Index: lld/wasm/Relocations.cpp
===================================================================
--- lld/wasm/Relocations.cpp
+++ lld/wasm/Relocations.cpp
@@ -146,6 +146,15 @@
               " cannot be used against symbol " + toString(*sym) +
               "; recompile with -fPIC");
         break;
+      case R_WASM_MEMORY_ADDR_TLS_SLEB:
+      case R_WASM_MEMORY_ADDR_TLS_SLEB64:
+        if (!sym->isDefined()) {
+          error(toString(file) +
+                ": TLS symbol is undefined, but TLS symbols cannot yet be "
+                "imported: `" +
+                toString(*sym) + "`");
+        }
+        break;
       case R_WASM_TABLE_INDEX_I32:
       case R_WASM_TABLE_INDEX_I64:
       case R_WASM_MEMORY_ADDR_I32:
Index: lld/test/wasm/tls-import.s
===================================================================
--- /dev/null
+++ lld/test/wasm/tls-import.s
@@ -0,0 +1,23 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: not wasm-ld -shared --experimental-pic --shared-memory -o %t.wasm %t.o 2>&1 | FileCheck %s
+
+# CHECK: error: {{.*}}.o: TLS symbol is undefined, but TLS symbols cannot yet be imported: `foo`
+
+.globl _start
+_start:
+  .functype _start () -> ()
+  i32.const foo at TLSREL
+  drop
+  end_function
+
+.section  .custom_section.target_features,"",@
+  .int8 3
+  .int8 43
+  .int8 7
+  .ascii  "atomics"
+  .int8 43
+  .int8 11
+  .ascii  "bulk-memory"
+  .int8 43
+  .int8 15
+  .ascii "mutable-globals"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106385.360236.patch
Type: text/x-patch
Size: 1486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210720/eae1fd35/attachment.bin>


More information about the llvm-commits mailing list