[PATCH] D37584: Add target-independent backend modifications for pagerando

Stephen Crane via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 17:01:53 PST 2017


rinon marked 3 inline comments as done.
rinon added inline comments.


================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1751
+  auto *GOTSym = OutContext.getOrCreateSymbol("_GLOBAL_OFFSET_TABLE_");
+  EmitLabelReference(GOTSym, PtrSize);
+
----------------
peter.smith wrote:
> It may be worth taking some care over using _GLOBAL_OFFSET_TABLE_. It is a linker convention to define _GLOBAL_OFFSET_TABLE_ to be the base of the .GOT but it might not always hold. For example earlier versions of lld set _GLOBAL_OFFSET_TABLE_ to 0 as the relocation types used by the compiler didn't look up the symbol value. Some backends (not Arm or AArch64) recognize the symbol and do something special with it as well.
> 
> I think what you have will work for gold on Arm and AArch64 but it may be worth letting targets override it with a "get me the got base" relocation. 
> 
>   
I added a function to TargetObjectFileLowering for ELF, since other formats don't use a GOT. Targets can override this if they need a special symbol. Sound alright?


https://reviews.llvm.org/D37584





More information about the llvm-commits mailing list