https://sourceware.org/bugzilla/show_bug.cgi?id=29592
Bug ID: 29592 Summary: [2.39 Regression][bisected] Exec stack warning causes go programs with cgo to fail to link on mips Product: binutils Version: 2.39 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: matoro_bugzilla_glibc at matoro dot tk Target Milestone: --- 65daf5bed68f3e792e80f7c9a12871fd71da32a2 is the first bad commit commit 65daf5bed68f3e792e80f7c9a12871fd71da32a2 Author: Nick Clifton <ni...@redhat.com> Date: Wed Apr 20 13:37:51 2022 +0100 Add linker warning for when it creates an executable stack. PR 29072 On mips, since this commit, all linking prints the following warning: /usr/lib/gcc/mips64-unknown-linux-gnu/12.2.0/../../../../mips64-unknown-linux-gnu/bin/ld: warning: /usr/lib/gcc/mips64-unknown-linux-gnu/12.2.0/../../../../lib64/Scrt1.o: requires executable stack (because the .note.GNU-stack section is executable) This seems to be harmless most of the time. However this commit also seems to have made it impossible to link golang programs (including golang itself) when cgo is enabled (which is the default unless explicitly disabled with CGO_ENABLED=0). The linker will print the following error thousands of times, one for every single local symbol: + ./cmd/dist/dist bootstrap -a Building Go toolchain1 using /usr/lib/go-bootstrap. Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1. Building Go toolchain2 using go_bootstrap and Go toolchain1. Building Go toolchain3 using go_bootstrap and Go toolchain2. Building packages and commands for linux/mips64. # cmd/trace /var/tmp/portage/dev-lang/go-1.19.1/work/go/pkg/tool/linux_mips64/link: running mips64-unknown-linux-gnu-gcc failed: exit status 1 /var/tmp/portage/dev-lang/go-1.19.1/temp/go-link-3757955373/go.o: in function `internal/cpu.Initialize': /usr/lib/go/src/internal/cpu/cpu.go:123:(.text+0x14): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:124:(.text+0x30): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /var/tmp/portage/dev-lang/go-1.19.1/temp/go-link-3757955373/go.o: in function `internal/cpu.Initialize': /usr/lib/go/src/internal/cpu/cpu_mips64x.go:22:(.text+0x40): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /var/tmp/portage/dev-lang/go-1.19.1/temp/go-link-3757955373/go.o: in function `internal/cpu.doinit': /usr/lib/go/src/internal/cpu/cpu_mips64x.go:23:(.text+0x54): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu_mips64x.go:23:(.text+0x64): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu_mips64x.go:22:(.text+0x78): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu_mips64x.go:22:(.text+0x84): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu_mips64x.go:22:(.text+0x90): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu_mips64x.go:22:(.text+0xa4): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu_mips64x.go:22:(.text+0xb8): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu_mips64x.go:22:(.text+0xc4): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu_mips64x.go:27:(.text+0xcc): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu_mips64x.go:27:(.text+0xe4): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /var/tmp/portage/dev-lang/go-1.19.1/temp/go-link-3757955373/go.o: in function `internal/cpu.Initialize': /usr/lib/go/src/internal/cpu/cpu.go:125:(.text+0x100): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /var/tmp/portage/dev-lang/go-1.19.1/temp/go-link-3757955373/go.o: in function `internal/cpu.processOptions': /usr/lib/go/src/internal/cpu/cpu.go:148:(.text+0x130): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:180:(.text+0x34c): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:187:(.text+0x368): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x384): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x38c): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x3a4): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x3bc): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x3c4): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x3dc): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x3f4): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x3fc): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x414): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:175:(.text+0x41c): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:163:(.text+0x43c): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:163:(.text+0x444): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:163:(.text+0x45c): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC /usr/lib/go/src/internal/cpu/cpu.go:163:(.text+0x474): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC And so on for a huge length, eventually erroring. There is one final warning at the end: /usr/lib/gcc/mips64-unknown-linux-gnu/12.2.0/../../../../mips64-unknown-linux-gnu/bin/ld: warning: creating DT_TEXTREL in a PIE Linking C programs, other than the execstack warning, still works even after this commit; only golang programs are affected. -- You are receiving this mail because: You are on the CC list for the bug.