targets supports code-model, target-abi, relocation-model
This commit is contained in:
@@ -78,6 +78,7 @@ m5stack \
|
||||
m5stamp-c3 \
|
||||
m5stick-c \
|
||||
macropad-rp2040 \
|
||||
maixbit \
|
||||
makerfabs-esp32c3spi35 \
|
||||
matrixportal-m4 \
|
||||
mch2022 \
|
||||
|
||||
@@ -22,9 +22,6 @@ type Export struct {
|
||||
LDFLAGS []string
|
||||
|
||||
// Additional fields from target configuration
|
||||
LLVMTarget string
|
||||
CPU string
|
||||
Features string
|
||||
BuildTags []string
|
||||
GOOS string
|
||||
GOARCH string
|
||||
@@ -525,6 +522,22 @@ func useTarget(targetName string) (export Export, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle code generation configuration
|
||||
if config.CodeModel != "" {
|
||||
ccflags = append(ccflags, "-mcmodel="+config.CodeModel)
|
||||
}
|
||||
if config.TargetABI != "" {
|
||||
ccflags = append(ccflags, "-mabi="+config.TargetABI)
|
||||
}
|
||||
if config.RelocationModel != "" {
|
||||
switch config.RelocationModel {
|
||||
case "pic":
|
||||
ccflags = append(ccflags, "-fPIC")
|
||||
case "static":
|
||||
ccflags = append(ccflags, "-fno-pic")
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Linker - keep it for external usage
|
||||
if config.Linker != "" {
|
||||
export.Linker = filepath.Join(clangRoot, "bin", config.Linker)
|
||||
|
||||
@@ -20,6 +20,11 @@ type Config struct {
|
||||
LinkerScript string `json:"linkerscript"`
|
||||
CFlags []string `json:"cflags"`
|
||||
LDFlags []string `json:"ldflags"`
|
||||
|
||||
// Code generation configuration
|
||||
CodeModel string `json:"code-model"`
|
||||
TargetABI string `json:"target-abi"`
|
||||
RelocationModel string `json:"relocation-model"`
|
||||
}
|
||||
|
||||
// RawConfig represents the raw JSON configuration before inheritance resolution
|
||||
|
||||
@@ -137,6 +137,18 @@ func (l *Loader) mergeConfig(dst, src *Config) {
|
||||
if src.Linker != "" {
|
||||
dst.Linker = src.Linker
|
||||
}
|
||||
if src.LinkerScript != "" {
|
||||
dst.LinkerScript = src.LinkerScript
|
||||
}
|
||||
if src.CodeModel != "" {
|
||||
dst.CodeModel = src.CodeModel
|
||||
}
|
||||
if src.TargetABI != "" {
|
||||
dst.TargetABI = src.TargetABI
|
||||
}
|
||||
if src.RelocationModel != "" {
|
||||
dst.RelocationModel = src.RelocationModel
|
||||
}
|
||||
|
||||
// Merge slices (append, don't replace)
|
||||
if len(src.BuildTags) > 0 {
|
||||
@@ -148,9 +160,6 @@ func (l *Loader) mergeConfig(dst, src *Config) {
|
||||
if len(src.LDFlags) > 0 {
|
||||
dst.LDFlags = append(dst.LDFlags, src.LDFlags...)
|
||||
}
|
||||
if src.LinkerScript != "" {
|
||||
dst.LinkerScript = src.LinkerScript
|
||||
}
|
||||
}
|
||||
|
||||
// GetTargetsDir returns the targets directory path
|
||||
|
||||
Reference in New Issue
Block a user