cmd/ld: decode local entry offset from ppc64 symbols

ppc64 function symbols have both a global entry point and a local
entry point, where the difference is stashed in sym.other.  We'll need
this information to generate calls to ELF ABI functions.

Change-Id: Ibe343923f56801de7ebec29946c79690a9ffde57
Reviewed-on: https://go-review.googlesource.com/2002
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
This commit is contained in:
Austin Clements 2014-12-16 14:01:08 -05:00
parent ec767c10b3
commit e32fe2049d
2 changed files with 9 additions and 1 deletions

View File

@ -141,6 +141,7 @@ struct LSym
uchar hide;
uchar leaf; // arm only
uchar fnptr; // arm only
uchar localentry; // ppc64: instrs between global & local entry
uchar seenglobl;
uchar onlist; // on the textp or datap lists
int16 symid; // for writing .5/.6/.8 files

View File

@ -327,7 +327,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
int32 base;
uint64 add, info;
char *name;
int i, j, rela, is64, n;
int i, j, rela, is64, n, flag;
uchar hdrbuf[64];
uchar *p;
ElfHdrBytes *hdr;
@ -616,6 +616,13 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
diag("%s: duplicate definition of %s", pn, s->name);
s->external = 1;
}
if(obj->machine == ElfMachPower64) {
flag = sym.other >> 5;
if(2 <= flag && flag <= 6)
s->localentry = 1 << (flag - 2);
else if(flag == 7)
diag("%s: invalid sym.other 0x%x for %s", pn, sym.other, s->name);
}
}
// Sort outer lists by address, adding to textp.