1
0
mirror of https://github.com/golang/go synced 2024-11-25 11:17:56 -07:00

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
This commit is contained in:
Shenghou Ma 2012-07-30 18:48:00 -04:00
parent dd62bb4753
commit 9de61e7c8c
3 changed files with 15 additions and 2 deletions

View File

@ -158,11 +158,22 @@ adddynrel(Sym *s, Reloc *r)
r->sym = S;
r->add += targ->got;
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
r->type = D_GOTOFF;
return;
case 256 + R_ARM_GOTPC: // R_ARM_BASE_PREL
r->type = D_PCREL;
r->sym = lookup(".got", 0);

View File

@ -564,6 +564,7 @@ typedef struct {
#define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */
#define R_ARM_CALL 28
#define R_ARM_V4BX 40
#define R_ARM_GOT_PREL 96
#define R_ARM_GNU_VTENTRY 100
#define R_ARM_GNU_VTINHERIT 101
#define R_ARM_RSBREL32 250

View File

@ -847,6 +847,7 @@ reltype(char *pn, int elftype, uchar *siz)
case R('5', R_ARM_REL32):
case R('5', R_ARM_CALL):
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_PLT32):
case R('6', R_X86_64_GOTPCREL):