report error if target cpu is not set

This commit is contained in:
Li Jie
2025-08-22 07:40:52 +08:00
parent d0f89e456c
commit 44cb4f2649

View File

@@ -427,6 +427,11 @@ func useTarget(targetName string) (export Export, err error) {
return export, fmt.Errorf("target '%s' does not have a valid LLVM target triple", targetName)
}
cpu := config.CPU
if cpu == "" {
return export, fmt.Errorf("target '%s' does not have a valid CPU configuration", targetName)
}
// Check for ESP Clang support for target-based builds
clangRoot, err := getESPClangRoot()
if err != nil {
@@ -461,7 +466,6 @@ func useTarget(targetName string) (export Export, err error) {
// The following parameters are inspired by tinygo/builder/library.go
// Handle CPU configuration
cpu := config.CPU
if cpu != "" {
// X86 has deprecated the -mcpu flag, so we need to use -march instead.
// However, ARM has not done this.