Skip to content

Commit 1ef1aa7

Browse files
aykevldeadprogram
authored andcommitted
mips: fix big-endian (GOARCH=mips) support
I made an awkward mistake, mixing up GOOS and GOARCH. So here is a fix, with an associated test.
1 parent 83c98a2 commit 1ef1aa7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

compileopts/target.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
338338
case "mips", "mipsle":
339339
spec.CPU = "mips32r2"
340340
spec.CFlags = append(spec.CFlags, "-fno-pic")
341-
if options.GOOS == "mips" {
341+
if options.GOARCH == "mips" {
342342
llvmarch = "mips" // big endian
343343
} else {
344344
llvmarch = "mipsel" // little endian

main_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ func TestBuild(t *testing.T) {
177177
})
178178
}
179179
}
180+
t.Run("MIPS big-endian", func(t *testing.T) {
181+
// Run a single test for GOARCH=mips to see whether it works at all.
182+
// Big-endian MIPS isn't fully supported yet, but simple examples
183+
// should work.
184+
t.Parallel()
185+
options := optionsFromOSARCH("linux/mips/softfloat", sema)
186+
runTest("alias.go", options, t, nil, nil)
187+
})
180188
t.Run("WebAssembly", func(t *testing.T) {
181189
t.Parallel()
182190
runPlatTests(optionsFromTarget("wasm", sema), tests, t)

0 commit comments

Comments
 (0)