Commit 9de61e7c authored by Shenghou Ma's avatar Shenghou Ma

cmd/5l, cmd/ld: add support for R_ARM_GOT_PREL

Android NDK's gcc 4.6 generates this relocation for runtime/cgo.

R=rsc
CC=golang-dev
https://golang.org/cl/6450056
parent dd62bb47
...@@ -159,6 +159,17 @@ adddynrel(Sym *s, Reloc *r) ...@@ -159,6 +159,17 @@ adddynrel(Sym *s, Reloc *r)
r->add += targ->got; r->add += targ->got;
return; return;
case 256 + R_ARM_GOT_PREL: // GOT(S) + A - P
if(targ->dynimpname == nil || targ->dynexport) {
addgotsyminternal(targ);
} else {
addgotsym(targ);
}
r->type = D_PCREL;
r->sym = lookup(".got", 0);
r->add += targ->got + 4;
return;
case 256 + R_ARM_GOTOFF: // R_ARM_GOTOFF32 case 256 + R_ARM_GOTOFF: // R_ARM_GOTOFF32
r->type = D_GOTOFF; r->type = D_GOTOFF;
return; return;
......
...@@ -564,6 +564,7 @@ typedef struct { ...@@ -564,6 +564,7 @@ typedef struct {
#define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */ #define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */
#define R_ARM_CALL 28 #define R_ARM_CALL 28
#define R_ARM_V4BX 40 #define R_ARM_V4BX 40
#define R_ARM_GOT_PREL 96
#define R_ARM_GNU_VTENTRY 100 #define R_ARM_GNU_VTENTRY 100
#define R_ARM_GNU_VTINHERIT 101 #define R_ARM_GNU_VTINHERIT 101
#define R_ARM_RSBREL32 250 #define R_ARM_RSBREL32 250
......
...@@ -847,6 +847,7 @@ reltype(char *pn, int elftype, uchar *siz) ...@@ -847,6 +847,7 @@ reltype(char *pn, int elftype, uchar *siz)
case R('5', R_ARM_REL32): case R('5', R_ARM_REL32):
case R('5', R_ARM_CALL): case R('5', R_ARM_CALL):
case R('5', R_ARM_V4BX): case R('5', R_ARM_V4BX):
case R('5', R_ARM_GOT_PREL):
case R('6', R_X86_64_PC32): case R('6', R_X86_64_PC32):
case R('6', R_X86_64_PLT32): case R('6', R_X86_64_PLT32):
case R('6', R_X86_64_GOTPCREL): case R('6', R_X86_64_GOTPCREL):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment