Repository navigation
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Go version
go1.26rc2
Output of go env in your module/workspace:
AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/egon/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/egon/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/1w/2x_sgq2j111d19xj1kpxkgp40000gn/T/go-build3668712380=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/Users/egon/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/egon/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/egon/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.26rc2'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
package main
var globalUninitialized int64 // should be in BSS
var globalInitialized int64 = 42 // should be in DATA
func main() {
println(globalUninitialized)
println(globalInitialized)
}
What did you see happen?
∫ GOOS=linux GOARCH=amd64 go build -o example example.go && go tool nm example | grep main.global
534490 D main.globalInitialized
55d510 D main.globalUninitialized
What did you expect to see?
∫ nm --version
llvm-nm, compatible with GNU nm
Apple LLVM version 17.0.0
Optimized build.
∫ nm example | grep main.global
0000000000534490 D main.globalInitialized
000000000055d510 B main.globalUninitialized
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
- StatusShow more project fieldsDone
Activity
egonelbre commentedon Jan 24, 2026
Debugging with AI pointed me to
go/src/cmd/internal/objfile/elf.go
Lines 48 to 55 in 1bd5dbf
And suggested that it should check for:
However, I do not have intimate knowledge with
elfto know whether that is always correct.gabyhelp commentedon Jan 24, 2026
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
ianlancetaylor commentedon Jan 24, 2026
That is the correct fix. Sent CL 739080. Thanks.
gopherbot commentedon Jan 24, 2026
Change https://go.dev/cl/739080 mentions this issue:
cmd/internal/objfile: use 'B' code for symbols in ELF NOBITS sectionsodeke-em commentedon Jun 24, 2026
Thanks for the report @egonelbre! To investigate this further, I sent out a test in CL https://go-review.googlesource.com/c/go/+/794080 that I'll kindly nudge @ianlancetaylor to add to the fix CL and it turns out that it fails too on windows per windows-386-result and windows-amd64-result
cmd/internal/objfile: use 'B' code for ELF and PE BSS symbols
cmd/internal/objfile: use 'B' code for ELF and PE BSS symbols