Repository: go
Issue: cmd/link: unresolvable R_RISCV_HI20 relocation against symbol `stderr@@GLIBC_2.27'
Labels: NeedsInvestigation,arch-riscv,compiler/runtime

### Go version

1.23.2 linux amd64

### Output of `go env` in your module/workspace:

```shell
GO111MODULE=''
GOARCH='riscv64'
GOBIN=''
GOCACHE='/workspace/build/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/workspace/build/pkg/mod'
GOOS='linux'
GOPATH='/workspace/build'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/workspace/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/workspace/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GCCGO='gccgo'
GORISCV64='rva20u64'
AR='riscv64-unknown-linux-gnu-ar'
CC='riscv64-unknown-linux-gnu-gcc'
CXX='riscv64-unknown-linux-gnu-g++'
CGO_ENABLED='1'
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 -pthread -fmessage-length=0 -ffile-prefix-map=/workspace/tmp/go-build4021815613=/tmp/go-build -gno-record-gcc-switches'
```


### What did you do?

I was compiling a large Go project, which includes cgo and has a Go cache size of approximately 15GB. Target arch is RISCV64. When linker called ld, there’s an issue related to glibc symbols.

### What did you see happen?

/workspace/go/pkg/tool/linux_amd64/link: running riscv64-unknown-linux-gnu-g++ failed: exit status 1
/usr/local/bin/riscv64-unknown-linux-gnu-g++ -Wl,-z,now -Wl,-z,nocopyreloc -o $WORK/b001/exe/a.out -rdynamic -Wl,--compress-debug-sections=zlib /workspace/tmp/go-link-3293404590/go.o /workspace/tmp/go-link-3293404590/000000.o /workspace/tmp/go-link-3293404590/000001.o /workspace/tmp/go-link-3293404590/000002.o /workspace/tmp/go-link-3293404590/000003.o /workspace/tmp/go-link-3293404590/000004.o /workspace/tmp/go-link-3293404590/000005.o /workspace/tmp/go-link-3293404590/000006.o /workspace/tmp/go-link-3293404590/000007.o /workspace/tmp/go-link-3293404590/000008.o /workspace/tmp/go-link-3293404590/000009.o /workspace/tmp/go-link-3293404590/000010.o /workspace/tmp/go-link-3293404590/000011.o /workspace/tmp/go-link-3293404590/000012.o /workspace/tmp/go-link-3293404590/000013.o /workspace/tmp/go-link-3293404590/000014.o /workspace/tmp/go-link-3293404590/000015.o /workspace/tmp/go-link-3293404590/000016.o /workspace/tmp/go-link-3293404590/000017.o /workspace/tmp/go-link-3293404590/000018.o /workspace/tmp/go-link-3293404590/000019.o /workspace/tmp/go-link-3293404590/000020.o /workspace/tmp/go-link-3293404590/000021.o /workspace/tmp/go-link-3293404590/000022.o /workspace/tmp/go-link-3293404590/000023.o /workspace/tmp/go-link-3293404590/000024.o /workspace/tmp/go-link-3293404590/000025.o /workspace/tmp/go-link-3293404590/000026.o /workspace/tmp/go-link-3293404590/000027.o /workspace/tmp/go-link-3293404590/000028.o /workspace/tmp/go-link-3293404590/000029.o /workspace/tmp/go-link-3293404590/000030.o /workspace/tmp/go-link-3293404590/000031.o /workspace/tmp/go-link-3293404590/000032.o /workspace/tmp/go-link-3293404590/000033.o /workspace/tmp/go-link-3293404590/000034.o /workspace/tmp/go-link-3293404590/000035.o /workspace/tmp/go-link-3293404590/000036.o /workspace/tmp/go-link-3293404590/000037.o /workspace/tmp/go-link-3293404590/000038.o /workspace/tmp/go-link-3293404590/000039.o /workspace/tmp/go-link-3293404590/000040.o /workspace/tmp/go-link-3293404590/000041.o /workspace/tmp/go-link-3293404590/000042.o /workspace/tmp/go-link-3293404590/000043.o /workspace/tmp/go-link-3293404590/000044.o /workspace/tmp/go-link-3293404590/000045.o /workspace/tmp/go-link-3293404590/000046.o /workspace/tmp/go-link-3293404590/000047.o /workspace/tmp/go-link-3293404590/000048.o /workspace/tmp/go-link-3293404590/000049.o /workspace/tmp/go-link-3293404590/000050.o /workspace/tmp/go-link-3293404590/000051.o /workspace/tmp/go-link-3293404590/000052.o /workspace/tmp/go-link-3293404590/000053.o /workspace/tmp/go-link-3293404590/000054.o -O2 -g --sysroot=/usr/local/sysroot -lresolv -O2 -g --sysroot=/usr/local/sysroot -O2 -g --sysroot=/usr/local/sysroot -ldl -O2 -g --sysroot=/usr/local/sysroot -lpthread -O2 -g --sysroot=/usr/local/sysroot -O2 -g --sysroot=/usr/local/sysroot -O2 -g --sysroot=/usr/local/sysroot -ldl -ldl -O2 -g --sysroot=/usr/local/sysroot -ldl -O2 -g --sysroot=/usr/local/sysroot /workspace/build/pkg/mod/code.byted.org/iesarch/gozstd@v1.17.4/libzstd_linux_riscv64.a -no-pie
/usr/local/lib/gcc/riscv64-unknown-linux-gnu/13.2.1/../../../../riscv64-unknown-linux-gnu/bin/ld: unresolvable R_RISCV_HI20 relocation against symbol `stderr@@GLIBC_2.27'
/usr/local/lib/gcc/riscv64-unknown-linux-gnu/13.2.1/../../../../riscv64-unknown-linux-gnu/bin/ld: unresolvable R_RISCV_HI20 relocation against symbol `stderr@@GLIBC_2.27'
/usr/local/lib/gcc/riscv64-unknown-linux-gnu/13.2.1/../../../../riscv64-unknown-linux-gnu/bin/ld: unresolvable R_RISCV_HI20 relocation against symbol `stderr@@GLIBC_2.27'
collect2: error: ld returned 1 exit status

### What did you expect to see?

Maybe Go generated an incorrect relocation type for the symbol reference to stderr.