cmd/cgo: make _cgo_flags consistent across runs
commite1b55b0a4394009b54af31d2ebe7c03db0a62733
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Jun 2017 13:59:02 +0000 (14 13:59 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Jun 2017 13:59:02 +0000 (14 13:59 +0000)
tree6ce4306631e5e2799767b4aab2de1bd3f442eb58
parent4d9382b7a6655fa9bb6d746b8d70eb561c8fdf0f
cmd/cgo: make _cgo_flags consistent across runs

    The go tool will pass -I objdir as one of the flags, where objdir is
    the temporary build directory. Remove that from _cgo_flags: we don't
    need it, and it will be different each time.

    Sort the flags to avoid the unpredictable map iteration order.

    This matters for gccgo because for a package that uses cgo, the go
    tool when building for gccgo will store the _cgo_flags file in the
    archive. That means that we want to generate identical _cgo_flags for
    every run.

    The test for this is the cmd/go testsuite, to follow in a future CL.

    Reviewed-on: https://go-review.googlesource.com/45692

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249199 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
libgo/go/cmd/cgo/gcc.go
libgo/go/cmd/cgo/out.go