diff --git a/main.go b/main.go index d371e466..7466b8ad 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,9 @@ type BuildConfig struct { // Helper function for Compiler object. func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, action func(string) error) error { + if config.gc == "" && spec.GC != "" { + config.gc = spec.GC + } compilerConfig := compiler.Config{ Triple: spec.Triple, GC: config.gc, diff --git a/target.go b/target.go index b8f73ddf..117dac35 100644 --- a/target.go +++ b/target.go @@ -21,6 +21,7 @@ type TargetSpec struct { Inherits []string `json:"inherits"` Triple string `json:"llvm-target"` BuildTags []string `json:"build-tags"` + GC string `json:"gc"` Compiler string `json:"compiler"` Linker string `json:"linker"` RTLib string `json:"rtlib"` // compiler runtime library (libgcc, compiler-rt) @@ -44,6 +45,9 @@ func (spec *TargetSpec) copyProperties(spec2 *TargetSpec) { spec.Triple = spec2.Triple } spec.BuildTags = append(spec.BuildTags, spec2.BuildTags...) + if spec2.GC != "" { + spec.GC = spec2.GC + } if spec2.Compiler != "" { spec.Compiler = spec2.Compiler }