[PATCH] D22366: [AMDGPU] Emit got relocs for linkonce[_odr] constant symbols

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 18:49:30 PDT 2016


tstellarAMD added inline comments.

================
Comment at: lib/Target/AMDGPU/SIISelLowering.cpp:1524-1525
@@ -1523,3 +1523,4 @@
                                const TargetMachine &TM) {
-  return GV->getType()->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS &&
+  return (GV->getType()->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS ||
+            GV->hasLinkOnceLinkage() || GV->hasLinkOnceODRLinkage()) &&
          !TM.shouldAssumeDSOLocal(*GV->getParent(), GV);
----------------
What we do currently is to emit read-only data to the .text section, and then have the compiler use fixups to resolve the offsets.  So, we don't really need to be emitting relocations or these type of symbols at all.

However, it's really not correct to emit read-only data to the .text section, so I think we should fix this.  We need to update the callback in AMDGPUTargetObjectFile.cpp to emit constant to the correct section (but only for isAmdHsaOS()), and then here we shouldn't be special casing linkonce/linkonce_odr we should be emitting GOTs for all constant address space variables that are not DSOLocal.


https://reviews.llvm.org/D22366





More information about the llvm-commits mailing list