[PATCH] D52744: Add support for GOT relocation support to Hexagon

Sid Manning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 2 08:06:14 PDT 2018


sidneym added inline comments.


================
Comment at: ELF/InputSection.cpp:549
+  case R_HEXAGON_GOT:
+    return Sym.getGotVA() - In.GotPlt->getVA();
   case R_MIPS_GOTREL:
----------------
ruiu wrote:
> You are not using `A` nor `P`, so this expression is a constant. Is this code correct?
The ABI describes the added relocations (type G) as the, "offset into global offset table for the entry of a symbol".   Access to the symbol starts first by getting the base of the global offset table, 
r2=add(pc,##_GLOBAL_OFFSET_TABLE_ at PCREL)
Then the entry:
r0 = memw (r2+##bar at GOT)

The immediate ##bar at GOT is calculated as Sym.getGotVA() - In.GotPLT->getVA().  I checked this with some existing hexagon code and everything seemed ok.




Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D52744





More information about the llvm-commits mailing list