public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/jpegxl] rawhide: Fix build on RISC-V
@ 2026-11-25 11:40 Marcin Juszkiewicz
  0 siblings, 0 replies; only message in thread
From: Marcin Juszkiewicz @ 2026-11-25 11:40 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/jpegxl
Branch : rawhide
Commit : ba469e4fcd518642b7c18877163cfe69d98fa503
Author : Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
Date   : 2026-11-17T10:53:15+01:00
Stats  : +62/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/jpegxl/c/ba469e4fcd518642b7c18877163cfe69d98fa503?branch=rawhide

Log:
Fix build on RISC-V

---
diff --git a/0001-cmake-Do-not-use-mrelax-all-with-clang-on-RISCV64-38.patch b/0001-cmake-Do-not-use-mrelax-all-with-clang-on-RISCV64-38.patch
new file mode 100644
index 0000000..12e0430
--- /dev/null
+++ b/0001-cmake-Do-not-use-mrelax-all-with-clang-on-RISCV64-38.patch
@@ -0,0 +1,58 @@
+From 192294e15e1d27660d887bc3b9b5ead8e5aa6a93 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 8 Aug 2025 06:42:42 -0700
+Subject: [PATCH] cmake: Do not use -mrelax-all with clang on RISCV64 (#3826)
+
+This option causes clang 19+ to crash on riscv64
+
+For RISC-V -mrelax-all causes the assembler stage to convert
+all conditional branches into
+
+  bcc reg, reg, tmplabel
+  jmp target
+tmplabel:
+
+Unconditional jmp can reach targets a lot further than a conditional branch.
+Unfortunately, jmp also has a limited range so sometimes needs to be
+converted to an indirect jump which requires a scratch register.
+We do all branch relaxation early for RISC-V during the compilation
+stage so we can allocate the scratch register.
+
+If the assembler also does branch relaxation it will increase the size
+of the function and may cause unconditional jmps to go out of range.
+If this happens, linking will fail.
+
+Co-authored-by: Eugene Kliuchnikov <eustas@google.com>
+---
+ AUTHORS        | 1 +
+ CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/AUTHORS b/AUTHORS
+index 7407cc24..4a86560c 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -73,6 +73,7 @@ Jonathan Brown (Jonnyawsom3) <jonathanbr30@gmail.com>
+ Joshua Root <jmr@macports.org>
+ Kai Hollberg <Schweinepriester@users.noreply.github.com>
+ Kerry Su <me@sshockwave.net>
++Khem Raj <raj.khem@gmail.com>
+ Kleis Auke Wolthuizen <github@kleisauke.nl>
+ L. E. Segovia
+ ledoge
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7027dbb2..af103dc9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -365,7 +365,7 @@ else ()
+ 
+   # Machine flags.
+   add_compile_options(-funwind-tables)
+-  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
++  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "riscv")
+     add_compile_options("SHELL:-Xclang -mrelax-all")
+   endif()
+   if (CXX_CONSTRUCTOR_ALIASES_SUPPORTED)
+-- 
+2.55.0
+

diff --git a/jpegxl.spec b/jpegxl.spec
index fefac43..ae3756d 100644
--- a/jpegxl.spec
+++ b/jpegxl.spec
@@ -36,6 +36,10 @@ Source0:        https://github.com/libjxl/libjxl/archive/v%{version}/%{name}-%{v
 Source1:        third_party-%{version}.tar.gz
 Source2:        testdata-%{version}.tar.gz
 
+# -mrelax-all generates branches that RISC-V linker relaxation then breaks,
+# making every binary die at startup (SIGILL on hardware, SIGSEGV on qemu).
+Patch:          0001-cmake-Do-not-use-mrelax-all-with-clang-on-RISCV64-38.patch
+
 BuildRequires:  asciidoc
 BuildRequires:  cmake
 BuildRequires:  doxygen

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-25 11:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 11:40 [rpms/jpegxl] rawhide: Fix build on RISC-V Marcin Juszkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox