]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: implement per-package asmflags, gcflags, ldflags, gccgoflags
authorRuss Cox <rsc@golang.org>
Wed, 8 Nov 2017 15:58:58 +0000 (10:58 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 9 Nov 2017 15:04:04 +0000 (15:04 +0000)
commit5993251c015dfa1e905bdf44bdb41572387edf90
tree04948dc09879e5058c534d519cb30ba57ead515f
parent98f1bfbb180b30e899b27ef5c5f53d16138dbd86
cmd/go: implement per-package asmflags, gcflags, ldflags, gccgoflags

It has always been problematic that there was no way to specify
tool flags that applied only to the build of certain packages;
it was only to specify flags for all packages being built.
The usual workaround was to install all dependencies of something,
then build just that one thing with different flags. Since the
dependencies appeared to be up-to-date, they were not rebuilt
with the different flags. The new content-based staleness
(up-to-date) checks see through this trick, because they detect
changes in flags. This forces us to address the underlying problem
of providing a way to specify per-package flags.

The solution is to allow -gcflags=pattern=flags, which means
that flags apply to packages matching pattern, in addition to the
usual -gcflags=flags, which is now redefined to apply only to
the packages named on the command line.

See #22527 for discussion and rationale.

Fixes #22527.

Change-Id: I6716bed69edc324767f707b5bbf3aaa90e8e7302
Reviewed-on: https://go-review.googlesource.com/76551
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
26 files changed:
src/cmd/compile/internal/gc/inl_test.go
src/cmd/compile/internal/gc/ssa_test.go
src/cmd/compile/internal/ssa/debug_test.go
src/cmd/dist/build.go
src/cmd/dist/buildtool.go
src/cmd/dist/test.go
src/cmd/go/alldocs.go
src/cmd/go/go_test.go
src/cmd/go/internal/cfg/cfg.go
src/cmd/go/internal/load/flag.go [new file with mode: 0644]
src/cmd/go/internal/load/flag_test.go [new file with mode: 0644]
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/load/search.go
src/cmd/go/internal/work/action.go
src/cmd/go/internal/work/build.go
src/cmd/go/internal/work/exec.go
src/cmd/go/internal/work/gc.go
src/cmd/go/internal/work/gccgo.go
src/cmd/go/internal/work/init.go
src/cmd/internal/goobj/goobj_test.go
src/cmd/link/internal/ld/dwarf_test.go
src/runtime/crash_test.go
src/runtime/race/output_test.go
src/runtime/runtime-gdb_test.go
src/runtime/runtime-lldb_test.go
test/inline_callers.go