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/link/internal/ld: TestElfBindNow failures on linux/loong64 #67063

Closed
abner-chenc opened this issue Apr 26, 2024 · 4 comments
Closed

cmd/link/internal/ld: TestElfBindNow failures on linux/loong64 #67063

abner-chenc opened this issue Apr 26, 2024 · 4 comments
Labels
NeedsFix The path to resolution is known, but the work has not been done.

Comments

@abner-chenc
Copy link
Contributor

Go version

go devel go1.23-f75980698d Fri Apr 26 19:02:10 2024 +0800 linux/loong64

Output of go env in your module/workspace:

chenguoqi@chenguoqi-fedora-24:~/golang/go-loong64-newworld$ go env
GO111MODULE=''
GOARCH='loong64'
GOBIN=''
GOCACHE='/tmp/abner-gocache'
GOENV='/home/data/chenguoqi/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='loong64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/data/chenguoqi/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/data/chenguoqi/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/data/chenguoqi/golang/go-loong64-newworld'
GOSUMDB='sum.golang.org'
GOTMPDIR='/tmp/abner-gotmp'
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/data/chenguoqi/golang/go-loong64-newworld/pkg/tool/linux_loong64'
GOVCS=''
GOVERSION='devel go1.23-f75980698d Fri Apr 26 19:02:10 2024 +0800'
GODEBUG=''
GCCGO='gccgo'
AR='ar'
CC='gcc'
CXX='g++'
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'

What did you do?

cd go/src/ && ./all.bash -a

What did you see happen?

=== CONT  TestDeadcode/structof_funcof
=== NAME  TestElfBindNow/bindnow-pie-linkmode-external
    elf_test.go:357: test .got: "bindnow-pie-linkmode-external" section not in readonly segment
    elf_test.go:359: section .got location: st=0x104120 en=0x1042c0
    elf_test.go:361: sec .got found in these segments: 
    elf_test.go:363:  "PT_LOAD"
    elf_test.go:365: 
        all segments: 
    elf_test.go:367: 0 t=PT_PHDR fl=PF_R st=0x40 en=0x2e0
    elf_test.go:367: 1 t=PT_INTERP fl=PF_R st=0x2e0 en=0x305
    elf_test.go:367: 2 t=PT_LOAD fl=PF_R st=0x0 en=0x138d0
    elf_test.go:367: 3 t=PT_LOAD fl=PF_X+PF_R st=0x14000 en=0x7e4ac
    elf_test.go:367: 4 t=PT_LOAD fl=PF_R st=0x80000 en=0x9d3a8
    elf_test.go:367: 5 t=PT_LOAD fl=PF_W+PF_R st=0xa0d10 en=0x1042c8
    elf_test.go:367: 6 t=PT_DYNAMIC fl=PF_W+PF_R st=0xffe30 en=0x100000
    elf_test.go:367: 7 t=PT_NOTE fl=PF_R st=0x308 en=0x3b0
    elf_test.go:367: 8 t=PT_TLS fl=PF_R st=0xa0d10 en=0xa0d10
    elf_test.go:367: 9 t=PT_GNU_EH_FRAME fl=PF_R st=0x9ce38 en=0x9cf3c
    elf_test.go:367: 10 t=PT_GNU_STACK fl=PF_W+PF_R st=0x0 en=0x0
    elf_test.go:367: 11 t=PT_GNU_RELRO fl=PF_R st=0xa0d10 en=0x100000
    elf_test.go:370: test bindnow-pie-linkmode-external failed
--- FAIL: TestElfBindNow (0.98s)
    --- PASS: TestElfBindNow/default (0.31s)
    --- FAIL: TestElfBindNow/bindnow-pie-linkmode-external (0.67s)
=== CONT  TestDeadcode/ifacemethod3

What did you expect to see?

Running all.bash successfully

@gopherbot
Copy link

Change https://go.dev/cl/581975 mentions this issue: cmd/link/internal/ld: temporarily skip TestElfBindNow on Loong64

@thanm thanm added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 26, 2024
@thanm
Copy link
Contributor

thanm commented Apr 26, 2024

Looks as though we have the same problem on the gotip-linux-riscv64 builder I might add.

I do see a commit in upstream binutils that should fix this.

@thanm
Copy link
Contributor

thanm commented Apr 26, 2024

Looking more closely at the BFD linker code:

https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/scripttempl/elf.sc;h=d5022fa502f24db23f396f337a6c8978fbc8415b;hb=6fde04116b4b835fa9ec3b3497fcac4e4a0637e2#l74

I don't think it makes sense to check for readonly ".got" in the external linking case, since the linker may decide not to put .got in readonly if it falls below a size threshold.

I am sending another CL that should take care of this.

@gopherbot
Copy link

Change https://go.dev/cl/581995 mentions this issue: cmd/link/internal/ld: more fixes to TestElfBindNow readonly .got check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants