fix: export libc cflags for compiler-rt

fix: libc include dir

fix: xtensa internal src dir

fix: xtensa internal src dir

fix: ignore wasm target

fix: export libc cflags to global cflags

fix: rtlib libc include dir

fix: ignore some errors for libc

fix: don's search system path for libc

fix: adjust compiling options

ci: add libc

fix: libc cflags

fix: test path

fix: libc cflags

fix: libc cflags
This commit is contained in:
Haolan
2025-09-01 17:28:01 +08:00
parent cb2fa5dd2d
commit 1d3ecb287a
8 changed files with 246 additions and 188 deletions

View File

@@ -2,6 +2,7 @@ package compile
import (
"os"
"path/filepath"
"strings"
"testing"
@@ -18,12 +19,12 @@ func TestIsCompile(t *testing.T) {
},
}
if cfg.IsCompiled(".") || cfg.Groups[0].IsCompiled(".") {
if cfg.Groups[0].IsCompiled(".") {
t.Errorf("unexpected result: should false")
}
})
t.Run("IsCompile Exists", func(t *testing.T) {
tmpFile, err := os.CreateTemp(".", "test*.a")
tmpFile, err := os.CreateTemp("", "test*.a")
if err != nil {
t.Error(err)
return
@@ -37,7 +38,7 @@ func TestIsCompile(t *testing.T) {
},
}
if !cfg.IsCompiled(".") && !cfg.Groups[0].IsCompiled(".") {
if cfg.Groups[0].IsCompiled(filepath.Dir(tmpFile.Name())) {
t.Errorf("unexpected result: should true")
}
})
@@ -54,7 +55,10 @@ func TestCompile(t *testing.T) {
group := CompileGroup{
OutputFileName: tmpFile.Name(),
}
err = group.Compile(".", "clang", "lld", nil, nil)
err = group.Compile(".", CompileOptions{
CC: "clang",
Linker: "lld",
})
if err != nil {
t.Errorf("unexpected result: should nil")
}
@@ -74,7 +78,10 @@ func TestCompile(t *testing.T) {
group := CompileGroup{
OutputFileName: "nop.a",
}
err = group.Compile(".", "clang", "lld", nil, nil)
err = group.Compile(".", CompileOptions{
CC: "clang",
Linker: "lld",
})
if err == nil {
t.Errorf("unexpected result: should not nil")
}
@@ -104,11 +111,18 @@ func TestCompile(t *testing.T) {
OutputFileName: "nop.a",
Files: []string{tmpFile.Name()},
}
err = group.Compile(".", "clang", "lld", []string{"-nostdinc"}, nil)
err = group.Compile(".", CompileOptions{
CC: "clang",
Linker: "lld",
CCFLAGS: []string{"-nostdinc"},
})
if err == nil {
t.Errorf("unexpected result: should not nil")
}
err = group.Compile(".", "clang", "lld", nil, nil)
err = group.Compile(".", CompileOptions{
CC: "clang",
Linker: "lld",
})
if err != nil {
t.Errorf("unexpected result: should not nil")
}