supports linkerscript
This commit is contained in:
@@ -361,12 +361,18 @@ func useTarget(targetName string) (export Export, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle Linker - keep it for external usage
|
// Handle Linker - keep it for external usage
|
||||||
export.Linker = config.Linker
|
if config.Linker != "" {
|
||||||
|
export.Linker = filepath.Join(clangRoot, "bin", config.Linker)
|
||||||
|
}
|
||||||
|
if config.LinkerScript != "" {
|
||||||
|
ldflags = append(ldflags, "-T", config.LinkerScript)
|
||||||
|
}
|
||||||
|
ldflags = append(ldflags, "-L", env.LLGoROOT()) // search targets/*.ld
|
||||||
|
|
||||||
// Combine with config flags
|
// Combine with config flags
|
||||||
export.CFLAGS = config.CFlags
|
export.CFLAGS = config.CFlags
|
||||||
export.CCFLAGS = ccflags
|
export.CCFLAGS = ccflags
|
||||||
export.LDFLAGS = append(ldflags, filterCompatibleLDFlags(config.LDFlags)...)
|
export.LDFLAGS = append(ldflags, config.LDFlags...)
|
||||||
export.EXTRAFLAGS = []string{}
|
export.EXTRAFLAGS = []string{}
|
||||||
|
|
||||||
return export, nil
|
return export, nil
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ type Config struct {
|
|||||||
|
|
||||||
// Compiler and linker configuration
|
// Compiler and linker configuration
|
||||||
Linker string `json:"linker"`
|
Linker string `json:"linker"`
|
||||||
|
LinkerScript string `json:"linkerscript"`
|
||||||
CFlags []string `json:"cflags"`
|
CFlags []string `json:"cflags"`
|
||||||
LDFlags []string `json:"ldflags"`
|
LDFlags []string `json:"ldflags"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,6 +148,9 @@ func (l *Loader) mergeConfig(dst, src *Config) {
|
|||||||
if len(src.LDFlags) > 0 {
|
if len(src.LDFlags) > 0 {
|
||||||
dst.LDFlags = append(dst.LDFlags, src.LDFlags...)
|
dst.LDFlags = append(dst.LDFlags, src.LDFlags...)
|
||||||
}
|
}
|
||||||
|
if src.LinkerScript != "" {
|
||||||
|
dst.LinkerScript = src.LinkerScript
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTargetsDir returns the targets directory path
|
// GetTargetsDir returns the targets directory path
|
||||||
|
|||||||
Reference in New Issue
Block a user