From 9b4071237f91a47f1ff0507b9f58827c653cc0eb Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 14 Feb 2019 11:40:27 +0100 Subject: [PATCH] arm: switch to hardfloat ABI for Linux This avoids an error on the Raspberry Pi 3. --- .travis.yml | 4 ++-- main_test.go | 4 ++-- target.go | 11 +++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2734e824..50694ad2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,9 +18,9 @@ addons: - llvm-7-dev - clang-7 - libclang-7-dev - - gcc-arm-linux-gnueabi + - gcc-arm-linux-gnueabihf - binutils-arm-none-eabi - - libc6-dev-armel-cross + - libc6-dev-armhf-cross - gcc-aarch64-linux-gnu - libc6-dev-arm64-cross - qemu-system-arm diff --git a/main_test.go b/main_test.go index 2e395d4c..62383407 100644 --- a/main_test.go +++ b/main_test.go @@ -68,7 +68,7 @@ func TestCompiler(t *testing.T) { continue // TODO: improve CGo } t.Run(path, func(t *testing.T) { - runTest(path, tmpdir, "arm--linux-gnueabi", t) + runTest(path, tmpdir, "arm--linux-gnueabihf", t) }) } @@ -78,7 +78,7 @@ func TestCompiler(t *testing.T) { continue // TODO: improve CGo } t.Run(path, func(t *testing.T) { - runTest(path, tmpdir, "aarch64--linux-gnueabi", t) + runTest(path, tmpdir, "aarch64--linux-gnu", t) }) } } diff --git a/target.go b/target.go index f50c91d7..562d143e 100644 --- a/target.go +++ b/target.go @@ -162,6 +162,9 @@ func LoadTarget(target string) (*TargetSpec, error) { llvmarch = goarch } target = llvmarch + "--" + llvmos + if goarch == "arm" { + target += "-gnueabihf" + } return defaultTarget(goos, goarch, target) } @@ -226,10 +229,10 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { if goarch != runtime.GOARCH { // Some educated guesses as to how to invoke helper programs. if goarch == "arm" && goos == "linux" { - spec.Linker = "arm-linux-gnueabi-gcc" - spec.Objcopy = "arm-linux-gnueabi-objcopy" - spec.GDB = "arm-linux-gnueabi-gdb" - spec.Emulator = []string{"qemu-arm", "-L", "/usr/arm-linux-gnueabi"} + spec.Linker = "arm-linux-gnueabihf-gcc" + spec.Objcopy = "arm-linux-gnueabihf-objcopy" + spec.GDB = "arm-linux-gnueabihf-gdb" + spec.Emulator = []string{"qemu-arm", "-L", "/usr/arm-linux-gnueabihf"} } if goarch == "arm64" && goos == "linux" { spec.Linker = "aarch64-linux-gnu-gcc"