public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Justin Wheeler <jwheel@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/hugo] epel10: 🔧 spec(hugo): Fix ppc64le external PIE linking crash
Date: Fri, 06 Nov 2026 05:40:41 GMT	[thread overview]
Message-ID: <179394364116.1.6038287037626985719.rpms-hugo-57937049c69f@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/hugo
            Branch : epel10
            Commit : 57937049c69ff5af04e0e5106d9f23b47f6a36fb
            Author : Justin Wheeler <jwheel@fedoraproject.org>
            Date   : 2026-10-14T23:10:29-04:00
            Stats  : +99/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/hugo/c/57937049c69ff5af04e0e5106d9f23b47f6a36fb?branch=epel10

            Log:
            🔧 spec(hugo): Fix ppc64le external PIE linking crash

Hugo 0.168.0 on Fedora ppc64le with external PIE linking encounters a
SIGSEGV caused by assembly trampolines in `golang.org/x/sys` that don't
preserve pointer liveness across syscall invocations. Apply a downstream
patch that reverts the assembly trampolines to Go wrappers marked with
`//go:uintptrescapes`.

The patch is applied only on ppc64le via `%ifarch` guard. Other arches
continue using the upstream assembly trampolines.

Changes:
- Switch `%goprep` from `-p1` (auto-apply patches) to plain `%goprep`
  (no auto-apply) so vendor archive extraction precedes selective patch
  application.
- Add `Patch0` reference to patch file.
- Apply patch only on ppc64le after vendor extraction.
- Add new downstream patch file.

Verified: ppc64le build passes `%check` with patched
`vendor/golang.org/x/sys`.

Assisted-by: Claude Haiku 4.5 (200k context)
Signed-off-by: Justin Wheeler <jwheel@fedoraproject.org>

---
diff --git a/0001-unix-linux-revert-ppc64x-syscall-assembly-wrapper.patch b/0001-unix-linux-revert-ppc64x-syscall-assembly-wrapper.patch
new file mode 100644
index 0000000..103599a
--- /dev/null
+++ b/0001-unix-linux-revert-ppc64x-syscall-assembly-wrapper.patch
@@ -0,0 +1,91 @@
+Restore Go syscall wrappers for ppc64x PIE builds
+
+The assembly trampolines introduced by x/sys commit
+b6b8557e8e2974925aec7a136ba0e323eedc5f43 cause a crash during
+fatih/color initialization on Fedora ppc64le with external PIE linking.
+Restore the Go wrappers and their build constraints, but mark their
+uintptr arguments as escaping so pointers passed through these wrappers
+remain live (the issue the assembly change was intended to address).
+
+--- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
++++ b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
+@@ -13,16 +13,6 @@
+ // Just jump to package syscall's implementation for all these functions.
+ // The runtime may know about them.
+ 
+-TEXT ·Syscall(SB),NOSPLIT,$0-56
+-	MOVD	$syscall·Syscall(SB), R31
+-	MOVD	R31, CTR
+-	JMP	(CTR)
+-
+-TEXT ·Syscall6(SB),NOSPLIT,$0-80
+-	MOVD	$syscall·Syscall6(SB), R31
+-	MOVD	R31, CTR
+-	JMP	(CTR)
+-
+ TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
+ 	BL	runtime·entersyscall(SB)
+ 	MOVD	a1+8(FP), R3
+@@ -38,16 +28,6 @@
+ 	BL	runtime·exitsyscall(SB)
+ 	RET
+ 
+-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
+-	MOVD	$syscall·RawSyscall(SB), R31
+-	MOVD	R31, CTR
+-	JMP	(CTR)
+-
+-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
+-	MOVD	$syscall·RawSyscall6(SB), R31
+-	MOVD	R31, CTR
+-	JMP	(CTR)
+-
+ TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
+ 	MOVD	a1+8(FP), R3
+ 	MOVD	a2+16(FP), R4
+--- a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go
++++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go
+@@ -2,7 +2,7 @@
+ // Use of this source code is governed by a BSD-style
+ // license that can be found in the LICENSE file.
+ 
+-//go:build (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && gc
++//go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc
+ 
+ package unix
+ 
+--- /dev/null
++++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
+@@ -0,0 +1,32 @@
++// Copyright 2018 The Go Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style
++// license that can be found in the LICENSE file.
++
++//go:build linux && (ppc64le || ppc64) && gc
++
++package unix
++
++import "syscall"
++
++// Keep pointers converted to uintptr alive across the Go wrappers.
++// See https://go.dev/issue/81981.
++
++//go:uintptrescapes
++func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
++	return syscall.Syscall(trap, a1, a2, a3)
++}
++
++//go:uintptrescapes
++func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
++	return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6)
++}
++
++//go:uintptrescapes
++func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
++	return syscall.RawSyscall(trap, a1, a2, a3)
++}
++
++//go:uintptrescapes
++func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
++	return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6)
++}

diff --git a/hugo.spec b/hugo.spec
index 7fcbf87..23e4acb 100644
--- a/hugo.spec
+++ b/hugo.spec
@@ -38,6 +38,9 @@ Source2:        go-vendor-tools.toml
 # Needed for vendor/golibsass; go-vendor-tools does not grab C code from Go repositories:
 Source3:        libsass-3.6.6.tar.gz
 
+# Avoid x/sys syscall trampoline crashes with external PIE linking on ppc64le.
+Patch0:         0001-unix-linux-revert-ppc64x-syscall-assembly-wrapper.patch
+
 BuildRequires:  go-vendor-tools
 BuildRequires:  gcc-c++
 
@@ -45,9 +48,13 @@ BuildRequires:  gcc-c++
 The world’s fastest framework for building websites.
 
 %prep
-%goprep -p1
+%goprep
 tar -xf %{S:1}
 
+%ifarch ppc64le
+%patch -P 0 -p1
+%endif
+
 # Needed for vendor/golibsass; go-vendor-tools does not grab C code from Go repositories:
 mkdir vendor/github.com/bep/golibsass/libsass_src
 tar xvf %SOURCE3 -C vendor/github.com/bep/golibsass/libsass_src --strip-components=1

                 reply	other threads:[~2026-11-06  5:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179394364116.1.6038287037626985719.rpms-hugo-57937049c69f@fedoraproject.org \
    --to=jwheel@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox