-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.arch-loong64Issues solely affecting the loongson architecture.Issues solely affecting the loongson architecture.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Go version
go version go1.25.1 linux/loong64
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='loong64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/build/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/build/.config/go/env'
GOEXE=''
GOEXPERIMENT='nodwarf5'
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -mabi=lp64d -pthread -fmessage-length=0 -ffile-prefix-map=/tmp/go-build965872925=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='loong64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/build/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/build/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/build/go/src/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/build/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/build/go/src/go/pkg/tool/linux_loong64'
GOVCS=''
GOVERSION='go1.25.1 X:nodwarf5'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
Attempted to build Go from source on Arch Linux for Loong64, of which the gcc is built with -mcmodel=medium.
All tests run, but two specific sub-tests under the "##### Testing cgo" section fail.
The failure occurs in the go tool dist test phase for cgo internal linking tests.
It seems that the internal linker of go doesn't support loong64's medium code model (with relocation R_LARCH_CALL36).
What did you see happen?
The following tests fail with the error:
go tool dist test -run=^cmd/cgo/internal/test:internalgo tool dist test -run=^cmd/cgo/internal/test:internal-pie
Error message (from the first failing test):
##### Testing cgo
# go tool dist test -run=^cmd/cgo/internal/test:internal$
`/build/go/src/go/bin/go test -tags=internal -ldflags=-linkmode=internal -count=1 -timeout=30m0s -short cmd/cgo/internal/test`
# cmd/cgo/internal/test.test
/usr/lib/gcc/loongarch64-unknown-linux-gnu/15.2.1/libgcc.a(_absvsi2.o/): unknown relocation type 110; compiled without -fpic?
FAIL cmd/cgo/internal/test [build failed]
FAIL
2025/09/21 08:27:24 Failed: exit status 1
……
# go tool dist test -run=^cmd/cgo/internal/test:internal-pie$
`/build/go/src/go/bin/go test -tags=internal,internal_pie -ldflags=-linkmode=internal -buildmode=pie -count=1 -timeout=30m0s -short cmd/cgo/internal/test`
# cmd/cgo/internal/test.test
/usr/lib/gcc/loongarch64-unknown-linux-gnu/15.2.1/libgcc.a(_absvsi2.o/): unknown relocation type 110; compiled without -fpic?
FAIL cmd/cgo/internal/test [build failed]
FAIL
2025/09/21 08:27:24 Failed: exit status 1
What did you expect to see?
All cgo tests, including those using internal linking (-linkmode=internal), should pass successfully with the medium code model. relocation type 110 should be supported.
mrwormhole
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.arch-loong64Issues solely affecting the loongson architecture.Issues solely affecting the loongson architecture.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Done