[PATCH] D15300: Fix wrong external references to __emutls_v.*

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 14:37:27 PST 2015


rnk added a comment.

I think the fact that you're excluding __emutls_v variables in AsmPrinter shows that this approach isn't a good one, and we need to go back and do it differently.

I think an IR preparation transform is going to be the cleanest, most portable way to do this.


================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:3088
@@ -3078,2 +3087,3 @@
+  }
   Entry.Node = DAG.getGlobalAddress(EmuTlsVar, dl, PtrVT);
   Entry.Ty = VoidPtrType;
----------------
chh wrote:
> rnk wrote:
> > If we only need the global variable to make this GlobalAddress node, there are other ways to do that, like DAG.getExternalSymbol and DAG.getMCSymbol.
> I tried to do that, but maybe I did not make it all correct for an external symbol.
> What I found out after my initial implementation is that get address of an external symbol would fail to link if the symbol is defined with internal linkage, for some linkers. That's what this patch to fix. So I would now make the symbol as real as necessary here to generate code to get the address.
> 
True, you have to do lots of target specific things to get PIC access right.


http://reviews.llvm.org/D15300





More information about the llvm-commits mailing list