diff --git a/context.go b/context.go index ba21a64..5285828 100644 --- a/context.go +++ b/context.go @@ -37,6 +37,8 @@ type Context struct { gcflags []string // flags passed to the compiler ldflags []string // flags passed to the linker + + linkmode, buildmode string // link and build modes } // GOOS configures the Context to use goos as the target os. @@ -88,9 +90,10 @@ func (p *Project) NewContext(opts ...func(*Context) error) (*Context, error) { GcToolchain(), } ctx := Context{ - Project: p, - workdir: mktmpdir(), - pkgs: make(map[string]*Package), + Project: p, + workdir: mktmpdir(), + pkgs: make(map[string]*Package), + buildmode: "exe", } for _, opt := range append(defaults, opts...) { diff --git a/gc.go b/gc.go index bed57e4..c93fd1e 100644 --- a/gc.go +++ b/gc.go @@ -85,7 +85,7 @@ func (t *gcToolchain) Ld(pkg *Package, searchpaths []string, outfile, afile stri } args = append(args, "-extld="+gcc()) if gc15 { - args = append(args, "-buildmode=exe") + args = append(args, "-buildmode", pkg.buildmode) } args = append(args, afile) if err := mkdir(filepath.Dir(outfile)); err != nil {