Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: -toolexec program inconsistently used for C toolchain #64580

Open
bcmills opened this issue Dec 6, 2023 · 2 comments
Open

cmd/go: -toolexec program inconsistently used for C toolchain #64580

bcmills opened this issue Dec 6, 2023 · 2 comments
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Member

bcmills commented Dec 6, 2023

Go version

go version devel go1.22-098f059d Mon Dec 4 23:03:04 2023 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/usr/local/google/home/bcmills/.cache/go-build'
GOENV='/usr/local/google/home/bcmills/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/usr/local/google/home/bcmills/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/usr/local/google/home/bcmills'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/google/home/bcmills/sdk/gotip'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/google/home/bcmills/sdk/gotip/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.22-098f059d Mon Dec 4 23:03:04 2023 +0000'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4055144386=/tmp/go-build -gno-record-gcc-switches'

What did you do?

  1. Note that in the cmd/go/internal/work package, both Builder.toolID and Builder.gccToolID wrap the invocation of the tool with cfg.BuildToolexec:
  2. Run CC=gcc gotip build -toolexec='/bin/time --format "%E %C"' -x -a runtime/cgo.
  3. Grep the output of (2) for gcc invocations.

What did you expect to see?

/bin/time output for gcc commands executed while building runtime/cgo, or gcc commands consistently not wrapped with the -toolexec command.

What did you see instead?

  • The /bin/time … gcc invocation in Builder.gccToolID is not included in the -x log, and its output is not printed like other toolexec output.
  • The gcc invocations elsewhere in the build process are not wrapped with /bin/time as requested.
CC=gcc gotip build -toolexec='/bin/time --format "%E %C"' -x -a runtime/cgo 2>&1 | grep gcc
TERM='dumb' gcc -I /usr/local/google/home/bcmills/sdk/gotip/src/runtime/cgo -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x001.o -c _cgo_export.c
TERM='dumb' gcc -I /usr/local/google/home/bcmills/sdk/gotip/src/runtime/cgo -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x002.o -c cgo.cgo2.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x003.o -c gcc_context.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x004.o -c gcc_fatalf.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x005.o -c gcc_libinit.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x006.o -c gcc_linux_amd64.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x007.o -c gcc_mmap.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x008.o -c gcc_setenv.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x009.o -c gcc_sigaction.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x010.o -c gcc_stack_unix.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x011.o -c gcc_traceback.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x012.o -c gcc_util.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x013.o -c linux_syscall.c
TERM='dumb' gcc -I . -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_x014.o -c gcc_amd64.S
TERM='dumb' gcc -I /usr/local/google/home/bcmills/sdk/gotip/src/runtime/cgo -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I $WORK/b001/ -O2 -g -Wall -Werror -fno-stack-protector -ffile-prefix-map=/usr/local/google/home/bcmills/sdk/gotip=/_/GOROOT -frandom-seed=q-EwsxrCJu7ItAw7sEU- -o $WORK/b001/_cgo_main.o -c _cgo_main.c
TERM='dumb' gcc -I ./sdk/gotip/src/runtime/cgo -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -o $WORK/b001/_cgo_.o $WORK/b001/_cgo_main.o $WORK/b001/_x001.o $WORK/b001/_x002.o $WORK/b001/_x003.o $WORK/b001/_x004.o $WORK/b001/_x005.o $WORK/b001/_x006.o $WORK/b001/_x007.o $WORK/b001/_x008.o $WORK/b001/_x009.o $WORK/b001/_x010.o $WORK/b001/_x011.o $WORK/b001/_x012.o $WORK/b001/_x013.o $WORK/b001/_x014.o -O2 -g -lpthread
@bcmills
Copy link
Member Author

bcmills commented Dec 6, 2023

(Found via #64423.)

@bcmills
Copy link
Member Author

bcmills commented Dec 6, 2023

It looks like this was a regression in https://go.dev/cl/314276.

The toolexec wrapper was originally applied to the gccgo tool, which is fairly consistent with applying it to cmd/compile. Probably we should go back to not using it at all for gcc commands other than gccgo.

@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Dec 6, 2023
@bcmills bcmills modified the milestones: Go1.23, Backlog Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

1 participant