]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: decode local entry offset from ppc64 symbols
authorAustin Clements <austin@google.com>
Tue, 16 Dec 2014 19:01:08 +0000 (14:01 -0500)
committerAustin Clements <austin@google.com>
Wed, 7 Jan 2015 20:34:55 +0000 (20:34 +0000)
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>
include/link.h
src/cmd/ld/ldelf.c

index 9e75350a80bf8a19c33aaa5ddc7d3d53ee37ac61..190df7f373755250d720b3d314dfae93c946cdba 100644 (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
index 894b9ee2f4de6fb82f34d8bd259dde8bad196e17..90da4aeb8ffc512def5ba3a18113b80e7660a36a 100644 (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.