Skip to content

Commit cd83fd7

Browse files
committed
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.
1 parent 9f44f49 commit cd83fd7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

compileopts/target.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,15 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
418418
spec.Triple = llvmarch + "-" + llvmvendor + "-" + llvmos
419419
if options.GOOS == "windows" {
420420
spec.Triple += "-gnu"
421-
} else if options.GOARCH == "arm" {
422-
spec.Triple += "-gnueabihf"
421+
} else if options.GOOS == "linux" {
422+
// We use musl on Linux (not glibc) so we should use -musleabi* instead
423+
// of -gnueabi*.
424+
// The *hf suffix selects between soft/hard floating point ABI.
425+
if spec.SoftFloat {
426+
spec.Triple += "-musleabi"
427+
} else {
428+
spec.Triple += "-musleabihf"
429+
}
423430
}
424431

425432
// Add extra assembly files (needed for the scheduler etc).

0 commit comments

Comments
 (0)