diff options
| author | Khem Raj <raj.khem@gmail.com> | 2024-09-14 15:18:15 -0700 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2024-09-14 15:19:22 -0700 |
| commit | a9d92adace7d8dc296cb7cb22a9691b4f298eba8 (patch) | |
| tree | 7bc1ad9242297a89939189c32e3497f6385272ac | |
| parent | af469bd2a518b92c4da2deaf34a2b9c92d4beacd (diff) | |
| download | meta-openembedded-a9d92adace7d8dc296cb7cb22a9691b4f298eba8.tar.gz | |
libjxl: Do not use -mrelax-all on RISCV with clang
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-multimedia/libjxl/libjxl/0001-cmake-Do-not-use-mrelax-all-with-clang-on-RISCV64.patch | 56 | ||||
| -rw-r--r-- | meta-oe/recipes-multimedia/libjxl/libjxl_0.10.3.bb | 4 |
2 files changed, 59 insertions, 1 deletions
diff --git a/meta-oe/recipes-multimedia/libjxl/libjxl/0001-cmake-Do-not-use-mrelax-all-with-clang-on-RISCV64.patch b/meta-oe/recipes-multimedia/libjxl/libjxl/0001-cmake-Do-not-use-mrelax-all-with-clang-on-RISCV64.patch new file mode 100644 index 0000000000..287dfc8ca8 --- /dev/null +++ b/meta-oe/recipes-multimedia/libjxl/libjxl/0001-cmake-Do-not-use-mrelax-all-with-clang-on-RISCV64.patch | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | From 0cf439c243dfdb6eee6133ee87172235a42e59c9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 14 Sep 2024 22:04:06 +0000 | ||
| 4 | Subject: [PATCH] cmake: Do not use -mrelax-all with clang on RISCV64 | ||
| 5 | |||
| 6 | This option causes clang 19+ to crash on riscv64 | ||
| 7 | |||
| 8 | For RISC-V -mrelax-all causes the assembler stage to convert | ||
| 9 | all conditional branches into | ||
| 10 | |||
| 11 | bcc reg, reg, tmplabel | ||
| 12 | jmp target | ||
| 13 | tmplabel: | ||
| 14 | |||
| 15 | Unconditional jmp can reach targets a lot further than a conditional branch. | ||
| 16 | Unfortunately, jmp also has a limited range so sometimes needs to be | ||
| 17 | converted to an indirect jump which requires a scratch register. | ||
| 18 | We do all branch relaxation early for RISC-V during the compilation | ||
| 19 | stage so we can allocate the scratch register. | ||
| 20 | |||
| 21 | If the assembler also does branch relaxation it will increase the size | ||
| 22 | of the function and may cause unconditional jmps to go out of range. | ||
| 23 | If this happens, linking will fail. | ||
| 24 | |||
| 25 | Upstream-Status: Submitted [https://github.com/libjxl/libjxl/pull/3826] | ||
| 26 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 27 | --- | ||
| 28 | CMakeLists.txt | 2 +- | ||
| 29 | CONTRIBUTORS | 1 + | ||
| 30 | 2 files changed, 2 insertions(+), 1 deletion(-) | ||
| 31 | |||
| 32 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 33 | index 8b2ccb57..39bee096 100644 | ||
| 34 | --- a/CMakeLists.txt | ||
| 35 | +++ b/CMakeLists.txt | ||
| 36 | @@ -335,7 +335,7 @@ else () | ||
| 37 | |||
| 38 | # Machine flags. | ||
| 39 | add_compile_options(-funwind-tables) | ||
| 40 | - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| 41 | + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "riscv") | ||
| 42 | add_compile_options("SHELL:-Xclang -mrelax-all") | ||
| 43 | endif() | ||
| 44 | if (CXX_CONSTRUCTOR_ALIASES_SUPPORTED) | ||
| 45 | diff --git a/CONTRIBUTORS b/CONTRIBUTORS | ||
| 46 | index 848096f9..a88c6157 100644 | ||
| 47 | --- a/CONTRIBUTORS | ||
| 48 | +++ b/CONTRIBUTORS | ||
| 49 | @@ -10,6 +10,7 @@ Iulia-Maria Comșa | ||
| 50 | Jan Wassenberg | ||
| 51 | Jon Sneyers | ||
| 52 | Jyrki Alakuijala | ||
| 53 | +Khem Raj | ||
| 54 | Krzysztof Potempa | ||
| 55 | Lode Vandevenne | ||
| 56 | Luca Versari | ||
diff --git a/meta-oe/recipes-multimedia/libjxl/libjxl_0.10.3.bb b/meta-oe/recipes-multimedia/libjxl/libjxl_0.10.3.bb index 3b694e0497..6e6e5edfd7 100644 --- a/meta-oe/recipes-multimedia/libjxl/libjxl_0.10.3.bb +++ b/meta-oe/recipes-multimedia/libjxl/libjxl_0.10.3.bb | |||
| @@ -8,7 +8,9 @@ inherit cmake pkgconfig mime | |||
| 8 | 8 | ||
| 9 | DEPENDS = "highway brotli" | 9 | DEPENDS = "highway brotli" |
| 10 | 10 | ||
| 11 | SRC_URI = "gitsm://github.com/libjxl/libjxl.git;protocol=https;nobranch=1" | 11 | SRC_URI = "gitsm://github.com/libjxl/libjxl.git;protocol=https;nobranch=1 \ |
| 12 | file://0001-cmake-Do-not-use-mrelax-all-with-clang-on-RISCV64.patch \ | ||
| 13 | " | ||
| 12 | 14 | ||
| 13 | SRCREV = "4a3b22d2600f92d8706fb72d85d52bfee2acbd54" | 15 | SRCREV = "4a3b22d2600f92d8706fb72d85d52bfee2acbd54" |
| 14 | S = "${WORKDIR}/git" | 16 | S = "${WORKDIR}/git" |
