Commit e32fe204 authored by Austin Clements's avatar Austin Clements

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/2002Reviewed-by: default avatarRuss Cox <rsc@golang.org>
Reviewed-by: default avatarMinux Ma <minux@golang.org>
parent ec767c10
...@@ -141,6 +141,7 @@ struct LSym ...@@ -141,6 +141,7 @@ struct LSym
uchar hide; uchar hide;
uchar leaf; // arm only uchar leaf; // arm only
uchar fnptr; // arm only uchar fnptr; // arm only
uchar localentry; // ppc64: instrs between global & local entry
uchar seenglobl; uchar seenglobl;
uchar onlist; // on the textp or datap lists uchar onlist; // on the textp or datap lists
int16 symid; // for writing .5/.6/.8 files int16 symid; // for writing .5/.6/.8 files
......
...@@ -327,7 +327,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn) ...@@ -327,7 +327,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
int32 base; int32 base;
uint64 add, info; uint64 add, info;
char *name; char *name;
int i, j, rela, is64, n; int i, j, rela, is64, n, flag;
uchar hdrbuf[64]; uchar hdrbuf[64];
uchar *p; uchar *p;
ElfHdrBytes *hdr; ElfHdrBytes *hdr;
...@@ -616,6 +616,13 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn) ...@@ -616,6 +616,13 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
diag("%s: duplicate definition of %s", pn, s->name); diag("%s: duplicate definition of %s", pn, s->name);
s->external = 1; 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. // Sort outer lists by address, adding to textp.
......
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