blob: dcbdf587527f8fe53a84eeca7804a2479412419a [file] [log] [blame]
Andrew Geissler90fd73c2021-03-05 15:25:55 -06001From a983bc6cd48fb0da939e3329cac18d7a3b29ecf8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 22 Feb 2021 17:54:01 -0800
4Subject: [PATCH] Revert "cmd/go: make sure CC and CXX are absolute"
5
6OE uses CC/CXX values which consists of cmpiler and options together,
7secondly, the environment is canned so this check add little value to OE
8based builds
9
10Fixes go-runtime build issues
11
12go install: CXX environment variable is relative; must be absolute path: powerpc64le-yoe-linux-musl-g++ -mlittle-endian -mhard-float -m64 -mabi=elfv2 -mcpu=power9 -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/mnt/b/yoe/master/build/tmp/work/ppc64p9le-yoe-linux-musl/go/1.16-r0/recipe-sysroot
13
14This reverts commit aa161e799df7e1eba99d2be10271e76b6f758142.
15
16Upstream-Status: Inappropriate [OE-Specific]
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 src/cmd/go/internal/envcmd/env.go | 5 -----
20 src/cmd/go/internal/work/init.go | 7 -------
21 src/cmd/go/testdata/script/env_write.txt | 24 ------------------------
22 3 files changed, 36 deletions(-)
23
24diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
25index 6937187522..29f9057c3f 100644
26--- a/src/cmd/go/internal/envcmd/env.go
27+++ b/src/cmd/go/internal/envcmd/env.go
28@@ -427,11 +427,6 @@ func checkEnvWrite(key, val string) error {
29 if !filepath.IsAbs(val) && val != "" {
30 return fmt.Errorf("GOPATH entry is relative; must be absolute path: %q", val)
31 }
32- // Make sure CC and CXX are absolute paths
33- case "CC", "CXX":
34- if !filepath.IsAbs(val) && val != "" && val != filepath.Base(val) {
35- return fmt.Errorf("%s entry is relative; must be absolute path: %q", key, val)
36- }
37 }
38
39 if !utf8.ValidString(val) {
40diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go
41index ba7c7c2fbb..3a6df5f758 100644
42--- a/src/cmd/go/internal/work/init.go
43+++ b/src/cmd/go/internal/work/init.go
44@@ -41,13 +41,6 @@ func BuildInit() {
45 cfg.BuildPkgdir = p
46 }
47
48- // Make sure CC and CXX are absolute paths
49- for _, key := range []string{"CC", "CXX"} {
50- if path := cfg.Getenv(key); !filepath.IsAbs(path) && path != "" && path != filepath.Base(path) {
51- base.Fatalf("go %s: %s environment variable is relative; must be absolute path: %s\n", flag.Args()[0], key, path)
52- }
53- }
54-
55 // For each experiment that has been enabled in the toolchain, define a
56 // build tag with the same name but prefixed by "goexperiment." which can be
57 // used for compiling alternative files for the experiment. This allows
58diff --git a/src/cmd/go/testdata/script/env_write.txt b/src/cmd/go/testdata/script/env_write.txt
59index bda1e57826..c99aadb7f2 100644
60--- a/src/cmd/go/testdata/script/env_write.txt
61+++ b/src/cmd/go/testdata/script/env_write.txt
62@@ -129,30 +129,6 @@ go env -w GOTMPDIR=
63 go env GOTMPDIR
64 stdout ^$
65
66-# go env -w rejects relative CC values
67-[!windows] go env -w CC=/usr/bin/clang
68-go env -w CC=clang
69-[!windows] ! go env -w CC=./clang
70-[!windows] ! go env -w CC=bin/clang
71-[!windows] stderr 'go env -w: CC entry is relative; must be absolute path'
72-
73-[windows] go env -w CC=$WORK\bin\clang
74-[windows] ! go env -w CC=.\clang
75-[windows] ! go env -w CC=bin\clang
76-[windows] stderr 'go env -w: CC entry is relative; must be absolute path'
77-
78-# go env -w rejects relative CXX values
79-[!windows] go env -w CC=/usr/bin/cpp
80-go env -w CXX=cpp
81-[!windows] ! go env -w CXX=./cpp
82-[!windows] ! go env -w CXX=bin/cpp
83-[!windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
84-
85-[windows] go env -w CXX=$WORK\bin\cpp
86-[windows] ! go env -w CXX=.\cpp
87-[windows] ! go env -w CXX=bin\cpp
88-[windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
89-
90 # go env -w/-u checks validity of GOOS/ARCH combinations
91 env GOOS=
92 env GOARCH=
93--
942.30.1
95