diff --git a/internal/crosscompile/crosscompile.go b/internal/crosscompile/crosscompile.go index 05880d8d..0297363a 100644 --- a/internal/crosscompile/crosscompile.go +++ b/internal/crosscompile/crosscompile.go @@ -422,6 +422,11 @@ func useTarget(targetName string) (export Export, err error) { return export, fmt.Errorf("failed to resolve target %s: %w", targetName, err) } + target := config.LLVMTarget + if target == "" { + return export, fmt.Errorf("target '%s' does not have a valid LLVM target triple", targetName) + } + // Check for ESP Clang support for target-based builds clangRoot, err := getESPClangRoot() if err != nil { @@ -445,11 +450,6 @@ func useTarget(targetName string) (export Export, err error) { var ccflags []string var ldflags []string - target := config.LLVMTarget - if target == "" { - target = llvm.GetTargetTriple(config.GOOS, config.GOARCH) - } - cflags := []string{"-Wno-override-module"} if config.LLVMTarget != "" { cflags = append(cflags, "--target="+config.LLVMTarget) diff --git a/internal/crosscompile/crosscompile_test.go b/internal/crosscompile/crosscompile_test.go index 72b4839f..ded63e0e 100644 --- a/internal/crosscompile/crosscompile_test.go +++ b/internal/crosscompile/crosscompile_test.go @@ -193,7 +193,7 @@ func TestUseTarget(t *testing.T) { { name: "Cortex-M Target", targetName: "cortex-m", - expectError: false, + expectError: true, expectLLVM: "", expectCPU: "", },