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: go test -c does not respect gcflags sometimes #27681

Closed
aarzilli opened this issue Sep 14, 2018 · 17 comments
Closed

cmd/go: go test -c does not respect gcflags sometimes #27681

aarzilli opened this issue Sep 14, 2018 · 17 comments
Labels
Debugging FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@aarzilli
Copy link
Contributor

What version of Go are you using (go version)?

go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/a/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/a/n/go/"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build874739252=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go get github.com/aarzilli/testflags
cd $GOPATH/src/github.com/aarzilli/testflags
go test -c -gcflags 'all=-N -l'
objdump --dwarf testflags.test | grep -A 7 'DW_TAG_compile_unit' | grep 'DW_AT_name\|DW_AT_producer'

What did you expect to see?

All packages except runtime compiled with -N -l

What did you see instead?

    DW_AT_name         DW_FORM_string
    DW_AT_producer     DW_FORM_string
    <c>   DW_AT_name        : sync/atomic
    <2b>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <2efb0>   DW_AT_name        : internal/cpu
    <2efd0>   DW_AT_producer    : Go cmd/compile go1.11; -l
    <2f794>   DW_AT_name        : runtime/internal/sys
    <2f7bc>   DW_AT_producer    : Go cmd/compile go1.11; -l
    <300dc>   DW_AT_name        : runtime/internal/atomic
    <30107>   DW_AT_producer    : Go cmd/compile go1.11; -l
    <3024f>   DW_AT_name        : internal/bytealg
    <30273>   DW_AT_producer    : Go cmd/compile go1.11; -l
    <30732>   DW_AT_name        : runtime
    <3074d>   DW_AT_producer    : Go cmd/compile go1.11; -l
    <593d5>   DW_AT_name        : errors
    <593ef>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <594a7>   DW_AT_name        : internal/race
    <594c8>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <5955b>   DW_AT_name        : sync
    <59573>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <5a287>   DW_AT_name        : io
    <5a29d>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <5a67e>   DW_AT_name        : syscall
    <5a699>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <67e76>   DW_AT_name        : os
    <67e8c>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <6987c>   DW_AT_name        : internal/testlog
    <698a0>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <69a07>   DW_AT_name        : time
    <69a1f>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <6c810>   DW_AT_name        : internal/poll
    <6c831>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <6da1d>   DW_AT_name        : internal/syscall/unix
    <6da46>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <6db96>   DW_AT_name        : math
    <6dbae>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <6df47>   DW_AT_name        : math/bits
    <6df64>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <6e166>   DW_AT_name        : unicode/utf8
    <6e186>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <6eaa3>   DW_AT_name        : strconv
    <6eabe>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <721ee>   DW_AT_name        : unicode
    <72209>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <729bb>   DW_AT_name        : reflect
    <729d6>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <823d8>   DW_AT_name        : fmt
    <823ef>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <843c7>   DW_AT_name        : sort
    <843df>   DW_AT_producer    : Go cmd/compile go1.11
    <84e93>   DW_AT_name        : strings
    <84eae>   DW_AT_producer    : Go cmd/compile go1.11
    <85d64>   DW_AT_name        : flag
    <85d7c>   DW_AT_producer    : Go cmd/compile go1.11
    <8762a>   DW_AT_name        : testing
    <87645>   DW_AT_producer    : Go cmd/compile go1.11
    <8a141>   DW_AT_name        : bytes
    <8a15a>   DW_AT_producer    : Go cmd/compile go1.11
    <8ae44>   DW_AT_name        : runtime/debug
    <8ae65>   DW_AT_producer    : Go cmd/compile go1.11
    <8aeb4>   DW_AT_name        : context
    <8aecf>   DW_AT_producer    : Go cmd/compile go1.11
    <8af8c>   DW_AT_name        : runtime/trace
    <8afad>   DW_AT_producer    : Go cmd/compile go1.11
    <8b137>   DW_AT_name        : bufio
    <8b150>   DW_AT_producer    : Go cmd/compile go1.11
    <8b586>   DW_AT_name        : regexp/syntax
    <8b5a7>   DW_AT_producer    : Go cmd/compile go1.11
    <9042c>   DW_AT_name        : regexp
    <90446>   DW_AT_producer    : Go cmd/compile go1.11
    <92c2b>   DW_AT_name        : encoding/binary
    <92c4e>   DW_AT_producer    : Go cmd/compile go1.11
    <937a6>   DW_AT_name        : text/tabwriter
    <937c8>   DW_AT_producer    : Go cmd/compile go1.11
    <94380>   DW_AT_name        : compress/flate
    <943a2>   DW_AT_producer    : Go cmd/compile go1.11
    <97961>   DW_AT_name        : hash
    <97979>   DW_AT_producer    : Go cmd/compile go1.11
    <979bf>   DW_AT_name        : hash/crc32
    <979dd>   DW_AT_producer    : Go cmd/compile go1.11
    <97f88>   DW_AT_name        : compress/gzip
    <97fa9>   DW_AT_producer    : Go cmd/compile go1.11
    <9858d>   DW_AT_name        : path/filepath
    <985ae>   DW_AT_producer    : Go cmd/compile go1.11
    <9863d>   DW_AT_name        : io/ioutil
    <9865a>   DW_AT_producer    : Go cmd/compile go1.11
    <9885f>   DW_AT_name        : runtime/pprof
    <98880>   DW_AT_producer    : Go cmd/compile go1.11
    <9c2d2>   DW_AT_name        : testing/internal/testdeps
    <9c2ff>   DW_AT_producer    : Go cmd/compile go1.11
    <9cbca>   DW_AT_name        : github.com/aarzilli/testflags
    <9cbfb>   DW_AT_producer    : Go cmd/compile go1.11; -N -l
    <9ccf0>   DW_AT_name        : main
    <9cd08>   DW_AT_producer    : Go cmd/compile go1.11; -N -l

It's pretty weird that it only gets applied to some packages.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 14, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Sep 14, 2018
@aarzilli
Copy link
Contributor Author

This is a regression, it used to work in 1.10, and bisects to 2ce6da0

@gopherbot
Copy link

Change https://golang.org/cl/136275 mentions this issue: cmd/go: respect gcflags, ldflags in 'go test'

@jared2501
Copy link

Just ran into this issue - any chance we could get a fix as a patch to 1.11?

@ianlancetaylor
Copy link
Contributor

As far as I can see, this hasn't been fixed on tip yet. CC @bcmills

@gopherbot please open a backport to 1.11

@gopherbot
Copy link

Backport issue(s) opened: #28346 (for 1.11).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@jared2501
Copy link

Thanks Ian!

@heschi
Copy link
Contributor

heschi commented Nov 20, 2018

This is pretty bad for the debugging experience when it hits. Marking as a release blocker; feel free to undo it if I'm overstating things.

@bcmills
Copy link
Contributor

bcmills commented Dec 21, 2018

I believe @jayconrod is looking in to this.

@jayconrod jayconrod self-assigned this Dec 21, 2018
@webern
Copy link

webern commented Dec 31, 2018

I cannot tell from the Github issues what patch version of go1.11 the backport resolution of this issue is slated for. I would like to know when this will be/is fixed.

@ianlancetaylor
Copy link
Contributor

@webern This is not yet fixed in any version of Go. It has to be fixed on tip first, then we can consider when it will be backported to 1.11.

@FiloSottile
Copy link
Contributor

@jayconrod @aarzilli We are planning on cutting RC1 this week, do you think you can get the fix submitted between today and tomorrow?

@jayconrod
Copy link
Contributor

@FiloSottile We just need a small change in that CL, then it's ready to go. If the change isn't in by tomorrow morning, we can submit as-is, and I can submit a quick follow-up CL.

@webern
Copy link

webern commented Jan 3, 2019

So is the fix in go1.12beta1 on this page (https://golang.org/dl/)?
Thanks.

@aarzilli
Copy link
Contributor Author

aarzilli commented Jan 3, 2019

@webern no, 1.12beta1 was cut two weeks ago and this fix was merged 3 hours ago.

@jayconrod
Copy link
Contributor

@webern This will be in RC1 which will cut soon.

@gopherbot
Copy link

Change https://golang.org/cl/156377 mentions this issue: [release-branch.go1.11] cmd/go: respect gcflags, ldflags in 'go test'

@katiehockman
Copy link
Contributor

katiehockman commented Jan 7, 2019

For bookkeeping, this is another CL that was related to this issue: https://golang.org/cl/156327

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debugging FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

10 participants