[llvm] [WebAssembly] Add path to PIC mode for wasm tables (PR #67545)
    Paulo Matos via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Sep 27 23:03:08 PDT 2023
    
    
  
================
@@ -1724,8 +1724,14 @@ SDValue WebAssemblyTargetLowering::LowerGlobalAddress(SDValue Op,
     fail(DL, DAG, "Invalid address space for WebAssembly target");
 
   unsigned OperandFlags = 0;
-  if (isPositionIndependent()) {
-    const GlobalValue *GV = GA->getGlobal();
+  const GlobalValue *GV = GA->getGlobal();
+  // is PIC but not a WebAssembly table.
+  // Since WebAssembly tables cannot yet be shared accross modules, we don't need special
+  // treatment for tables in PIC mode.
+  if (isPositionIndependent() && 
+      !(GV->getValueType()->isArrayTy() && 
+        WebAssembly::isWebAssemblyReferenceType(GV->getValueType()->getArrayElementType()))) {
----------------
pmatos wrote:
That makes sense - will do that.
https://github.com/llvm/llvm-project/pull/67545
    
    
More information about the llvm-commits
mailing list