go: fix on darwin, make go-1.7 build with clang-3.8. (#18001)

The darwin stdenv currently provides clang-3.7; however,

  a) go-1.7 currently expects a compiler that supports "-fdebug-prefix-map"
     arguments (which clang-3.8 supports but clang-3.7 does not) and

  b) even with clang-3.8, go-1.7 misinterprets the result of its runtime probes
     for support for the "-no-pie" flag, thereby failing to build runtime/cgo.

This patch resolves (a) by building go-1.7 with clang-3.8 and resolves (b) by
teaching go how to correctly probe "-no-pie" error messages from clang.
This commit is contained in:
Michael Stone 2016-08-26 03:36:06 -04:00 committed by Robin Gloster
parent df343d4824
commit b9a4da47c0
2 changed files with 7 additions and 2 deletions

View File

@ -98,6 +98,9 @@ stdenv.mkDerivation rec {
sed -i '/TestDisasmExtld/areturn' src/cmd/objdump/objdump_test.go sed -i '/TestDisasmExtld/areturn' src/cmd/objdump/objdump_test.go
sed -i 's/unrecognized/unknown/' src/cmd/link/internal/ld/lib.go
sed -i 's/unrecognized/unknown/' src/cmd/go/build.go
touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd
sed -i '1 a\exit 0' misc/cgo/errors/test.bash sed -i '1 a\exit 0' misc/cgo/errors/test.bash

View File

@ -4738,9 +4738,11 @@ in
inherit (darwin.apple_sdk.frameworks) Security Foundation; inherit (darwin.apple_sdk.frameworks) Security Foundation;
}; };
go_1_7 = callPackage ../development/compilers/go/1.7.nix { go_1_7 = callPackage ../development/compilers/go/1.7.nix ({
inherit (darwin.apple_sdk.frameworks) Security Foundation; inherit (darwin.apple_sdk.frameworks) Security Foundation;
}; } // stdenv.lib.optionalAttrs stdenv.isDarwin {
stdenv = stdenvAdapters.overrideCC pkgs.stdenv pkgs.clang_38;
});
go = self.go_1_7; go = self.go_1_7;