From a35b983a5dafbd29c054bf73215b2ee07d47f036 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 31 Jul 2024 14:06:21 +0200 Subject: [PATCH] linux: use -musleabi* instead of -gnueabi* (or nothing) This more accurately describes the libc we are using. This also adds the environment to _all_ Linux systems, not just ARM. And selects the correct ABI (soft/hardfloat) that's in use. I don't know whether it has any practical implications, but LLVM appears to be using this information so it seems wise to use the correct values. --- compileopts/target.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/compileopts/target.go b/compileopts/target.go index 9388b849..b168da3c 100644 --- a/compileopts/target.go +++ b/compileopts/target.go @@ -418,8 +418,15 @@ func defaultTarget(options *Options) (*TargetSpec, error) { spec.Triple = llvmarch + "-" + llvmvendor + "-" + llvmos if options.GOOS == "windows" { spec.Triple += "-gnu" - } else if options.GOARCH == "arm" { - spec.Triple += "-gnueabihf" + } else if options.GOOS == "linux" { + // We use musl on Linux (not glibc) so we should use -musleabi* instead + // of -gnueabi*. + // The *hf suffix selects between soft/hard floating point ABI. + if spec.SoftFloat { + spec.Triple += "-musleabi" + } else { + spec.Triple += "-musleabihf" + } } // Add extra assembly files (needed for the scheduler etc).