Skip to content

Commit dd53a43

Browse files
committed
cmd/link/internal/ld: disable execute-only for external linking on openbsd/arm64
The Go arm64 assembler places constants into the text section of a binary. OpenBSD 7.3 enabled xonly by default on OpenBSD/arm64. This means that any externally linked Go binary now segfaults. Disable execute-only when invoking the external linker on openbsd/arm64, in order to work around this issue. Updates #59615 Change-Id: I1a291293da3c6e4409b21873d066ea15e9bfe280 Reviewed-on: https://go-review.googlesource.com/c/go/+/484555 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Aaron Bieber <[email protected]> Run-TryBot: Joel Sing <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
1 parent 35ec948 commit dd53a43

File tree

1 file changed

+6
-0
lines changed
  • src/cmd/link/internal/ld

1 file changed

+6
-0
lines changed

src/cmd/link/internal/ld/lib.go

+6
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,12 @@ func (ctxt *Link) hostlink() {
14071407
case objabi.Hopenbsd:
14081408
argv = append(argv, "-Wl,-nopie")
14091409
argv = append(argv, "-pthread")
1410+
if ctxt.Arch.InFamily(sys.ARM64) {
1411+
// Disable execute-only on openbsd/arm64 - the Go arm64 assembler
1412+
// currently stores constants in the text section rather than in rodata.
1413+
// See issue #59615.
1414+
argv = append(argv, "-Wl,--no-execute-only")
1415+
}
14101416
case objabi.Hwindows:
14111417
if windowsgui {
14121418
argv = append(argv, "-mwindows")

0 commit comments

Comments
 (0)