[lld] [lld][WebAssembly] Report Unsupported PIC Relocations as Errors (PR #104926)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 09:54:21 PDT 2024


================
@@ -173,6 +173,22 @@ void scanRelocations(InputChunk *chunk) {
       }
     }
 
+    if (sym->isUndefined()) {
+      switch (reloc.Type) {
+      case R_WASM_TABLE_INDEX_REL_SLEB:
+      case R_WASM_TABLE_INDEX_REL_SLEB64:
+      case R_WASM_MEMORY_ADDR_REL_SLEB:
+      case R_WASM_MEMORY_ADDR_REL_SLEB64:
+        // These relocation types are only present in the code section and
+        // are not supported for undefined symbols. It would require replacing
+        // the constant by using a GOT global.
----------------
sbc100 wrote:

How about:

```
These relocation types are for symbols that exists relative to `__memory_base` or `__table_base` and as such
only make sense for defined symbols.
```



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


More information about the llvm-commits mailing list