]> Cypherpunks repositories - gostls13.git/commitdiff
runtime, cmd/ld, cmd/5l, run.bash: enable external linking on FreeBSD/ARM.
authorShenghou Ma <minux.ma@gmail.com>
Mon, 21 Apr 2014 04:08:59 +0000 (00:08 -0400)
committerShenghou Ma <minux.ma@gmail.com>
Mon, 21 Apr 2014 04:08:59 +0000 (00:08 -0400)
Update #7331

LGTM=dave, iant
R=golang-codereviews, dave, gobot, iant
CC=golang-codereviews
https://golang.org/cl/89520043

src/cmd/5l/obj.c
src/cmd/ld/elf.c
src/pkg/runtime/rt0_freebsd_arm.s
src/run.bash

index a866b1f69be5598ee28187439aff70f4cd2ca983..86a0ece2e4dbeee2b334750559b2966781d765ed 100644 (file)
@@ -62,6 +62,7 @@ archinit(void)
                        sysfatal("cannot use -linkmode=external with -H %s", headstr(HEADTYPE));
                break;
        case Hlinux:
+       case Hfreebsd:
                break;
        }
 
index 3b0f578814fb6df2ec29845b0c2f9739edee3e72..785949759445eb10eb73f23520d9c7ed604f4ea8 100644 (file)
@@ -55,8 +55,8 @@ elfinit(void)
 
        // 32-bit architectures
        case '5':
-               // we only use EABI on linux/arm
-               if(HEADTYPE == Hlinux)
+               // we use EABI on both linux/arm and freebsd/arm.
+               if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd)
                        hdr.flags = 0x5000002; // has entry point, Version5 EABI
                // fallthrough
        default:
index d110876395afad5eee0139f59cd73cdea1372abd..56219f89995b20fbb6ede5802c40521f348e7608 100644 (file)
@@ -11,3 +11,8 @@ TEXT _rt0_arm_freebsd(SB),NOSPLIT,$-4
        MOVW    $4(R13), R1             // argv
        MOVM.DB.W [R0-R1], (R13)
        B       _rt0_go(SB)
+
+TEXT main(SB),NOSPLIT,$-4
+       MOVM.DB.W [R0-R1], (R13)
+       MOVW    $_rt0_go(SB), R4
+       B               (R4)
index f0fb928b2c6391d6337c86fce4c0c6ba46eaeda9..0f3e4e0f36c97dcaaa9b33ed04a675b917005f14 100755 (executable)
@@ -127,13 +127,18 @@ darwin-386 | darwin-amd64)
        *) go test -ldflags '-linkmode=external'  || exit 1;;
        esac
        ;;
-dragonfly-386 | dragonfly-amd64 | freebsd-386 | freebsd-amd64 | linux-386 | linux-amd64 | linux-arm | netbsd-386 | netbsd-amd64)
+dragonfly-386 | dragonfly-amd64 | freebsd-386 | freebsd-amd64 | freebsd-arm | linux-386 | linux-amd64 | linux-arm | netbsd-386 | netbsd-amd64)
        go test -ldflags '-linkmode=external' || exit 1
        go test -ldflags '-linkmode=auto' ../testtls || exit 1
        go test -ldflags '-linkmode=external' ../testtls || exit 1
        
        case "$GOHOSTOS-$GOARCH" in
        netbsd-386 | netbsd-amd64) ;; # no static linking
+       freebsd-arm) ;; # -fPIC compiled tls code will use __tls_get_addr instead
+                       # of __aeabi_read_tp, however, on FreeBSD/ARM, __tls_get_addr
+                       # is implemented in rtld-elf, so -fPIC isn't compatible with
+                       # static linking on FreeBSD/ARM with clang. (cgo depends on
+                       # -fPIC fundamentally.)
        *)
                go test -ldflags '-linkmode=external -extldflags "-static -pthread"' ../testtls || exit 1
                ;;