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

Luc Blaeser via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 00:41:09 PDT 2024


================
@@ -170,6 +170,19 @@ void scanRelocations(InputChunk *chunk) {
         if (requiresGOTAccess(sym))
           addGOTEntry(sym);
         break;
+      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. It would require replacing the constant by using
+        // a GOT global.
+        if (sym->isUndefined())
+          error(toString(file) + ": relocation " +
+                relocTypeToString(reloc.Type) +
+                " is not supported against an undefined symbol `" +
+                toString(*sym) + "`");
+        break;
----------------
luc-blaeser wrote:

Thank you. I adjusted this.

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


More information about the llvm-commits mailing list