diff options
-rw-r--r-- | .circleci/config.yml | 5 | ||||
-rw-r--r-- | compileopts/target.go | 7 | ||||
-rw-r--r-- | main_test.go | 10 |
3 files changed, 14 insertions, 8 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 15ca09e01..aa475a466 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,6 +28,7 @@ commands: qemu-user \ gcc-avr \ avr-libc + sudo apt-get install --no-install-recommends libc6-dev-i386 lib32gcc-8-dev install-node: steps: - run: @@ -133,7 +134,6 @@ commands: command: | sudo apt-get install \ gcc-arm-linux-gnueabihf \ - binutils-arm-none-eabi \ libc6-dev-armel-cross \ gcc-aarch64-linux-gnu \ libc6-dev-arm64-cross \ @@ -141,6 +141,7 @@ commands: qemu-user \ gcc-avr \ avr-libc + sudo apt-get install --no-install-recommends libc6-dev-i386 lib32gcc-6-dev - install-node - install-wasmtime - install-xtensa-toolchain: @@ -194,7 +195,6 @@ commands: command: | sudo apt-get install \ gcc-arm-linux-gnueabihf \ - binutils-arm-none-eabi \ libc6-dev-armel-cross \ gcc-aarch64-linux-gnu \ libc6-dev-arm64-cross \ @@ -202,6 +202,7 @@ commands: qemu-user \ gcc-avr \ avr-libc + sudo apt-get install --no-install-recommends libc6-dev-i386 lib32gcc-6-dev - install-node - install-wasmtime - install-xtensa-toolchain: diff --git a/compileopts/target.go b/compileopts/target.go index f95ecfd88..89e40252a 100644 --- a/compileopts/target.go +++ b/compileopts/target.go @@ -215,6 +215,7 @@ func LoadTarget(target string) (*TargetSpec, error) { } goarch := map[string]string{ // map from LLVM arch to Go arch "i386": "386", + "i686": "386", "x86_64": "amd64", "aarch64": "arm64", "armv7": "arm", @@ -260,9 +261,9 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { spec.GDB = "aarch64-linux-gnu-gdb" spec.Emulator = []string{"qemu-aarch64", "-L", "/usr/aarch64-linux-gnu"} } - if goarch == "386" { - spec.CFlags = []string{"-m32"} - spec.LDFlags = []string{"-m32"} + if goarch == "386" && runtime.GOARCH == "amd64" { + spec.CFlags = append(spec.CFlags, "-m32") + spec.LDFlags = append(spec.LDFlags, "-m32") } } return &spec, nil diff --git a/main_test.go b/main_test.go index ac01baafa..09c3919e1 100644 --- a/main_test.go +++ b/main_test.go @@ -78,6 +78,9 @@ func TestCompiler(t *testing.T) { } if runtime.GOOS == "linux" { + t.Run("X86Linux", func(t *testing.T) { + runPlatTests("i386--linux-gnu", matches, t) + }) t.Run("ARMLinux", func(t *testing.T) { runPlatTests("arm--linux-gnueabihf", matches, t) }) @@ -189,10 +192,11 @@ func runTest(path, target string, t *testing.T) { t.Fatal("failed to load target spec:", err) } if len(spec.Emulator) == 0 { - t.Fatal("no emulator available for target:", target) + cmd = exec.Command(binary) + } else { + args := append(spec.Emulator[1:], binary) + cmd = exec.Command(spec.Emulator[0], args...) } - args := append(spec.Emulator[1:], binary) - cmd = exec.Command(spec.Emulator[0], args...) } stdout := &bytes.Buffer{} cmd.Stdout = stdout |