]> Cypherpunks repositories - gostls13.git/commitdiff
liblink, sync/atomic: fix arm build
authorRuss Cox <rsc@golang.org>
Wed, 17 Sep 2014 00:53:38 +0000 (20:53 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 17 Sep 2014 00:53:38 +0000 (20:53 -0400)
The liblink code to insert the FUNCDATA for a stack map
from the Go prototype was not correct for ARM
(different data structure layout).

Also, sync/atomic was missing some Go prototypes
for ARM-specific functions.

TBR=r
CC=golang-codereviews
https://golang.org/cl/143160045

include/link.h
src/liblink/obj5.c
src/liblink/objfile.c
src/sync/atomic/64bit_arm.go

index 8c73eab51e27ee09bc53a6d2e456d601f4b5f3a5..292b077394356d96904dc431205b705f6df39360 100644 (file)
@@ -471,6 +471,7 @@ struct LinkArch
        int     D_PARAM;
        int     D_SCONST;
        int     D_STATIC;
+       int     D_OREG;
 
        int     ACALL;
        int     ADATA;
index a571d8f1661688359b09b2685556cb8786eb5ec4..e192b082b54d728bfe2e8f6e659f582f516e2878 100644 (file)
@@ -1061,6 +1061,7 @@ LinkArch linkarm = {
        .D_PARAM = D_PARAM,
        .D_SCONST = D_SCONST,
        .D_STATIC = D_STATIC,
+       .D_OREG = D_OREG,
 
        .ACALL = ABL,
        .ADATA = ADATA,
index 7d4b28c9ac72d81f41672ddc5807f6950ab8d1fd..9b1e1b7a8fd244056bff622adcf62097f35ee3c8 100644 (file)
@@ -268,7 +268,12 @@ writeobj(Link *ctxt, Biobuf *b)
                        p->as = ctxt->arch->AFUNCDATA;
                        p->from.type = ctxt->arch->D_CONST;
                        p->from.offset = FUNCDATA_ArgsPointerMaps;
-                       p->to.type = ctxt->arch->D_EXTERN;
+                       if(ctxt->arch->thechar == '6' || ctxt->arch->thechar == '8')
+                               p->to.type = ctxt->arch->D_EXTERN;
+                       else {
+                               p->to.type = ctxt->arch->D_OREG;
+                               p->to.name = ctxt->arch->D_EXTERN;
+                       }
                        p->to.sym = linklookup(ctxt, smprint("%s.args_stackmap", s->name), s->version);
                }
        }
index c08f214c7ef7b03507115264d29be757dd794fb2..0aab7160e9c802a715c10ebba40c14f59dc22517 100644 (file)
@@ -44,3 +44,9 @@ func swapUint64(addr *uint64, new uint64) (old uint64) {
        }
        return
 }
+
+// Additional ARM-specific assembly routines.
+// Declaration here to give assembly routines correct stack maps for arguments.
+func armCompareAndSwapUint32(addr *uint32, old, new uint32) (swapped bool)
+func armCompareAndSwapUint64(addr *uint64, old, new uint64) (swapped bool)
+func generalCAS64(addr *uint64, old, new uint64) (swapped bool)