From 91cd1ec737722ecb25f282aa8f85cf821bad1116 Mon Sep 17 00:00:00 2001 From: Jan Palus Date: Sun, 16 Oct 2022 23:59:43 +0200 Subject: [PATCH] apply x32 abi stripping patch only when building with rt --- llvm.spec | 2 ++ x32-compiler-rt.patch | 12 ++++++++++++ x32-gcc-toolchain.patch | 12 ------------ 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 x32-compiler-rt.patch diff --git a/llvm.spec b/llvm.spec index df98848..7f680b8 100644 --- a/llvm.spec +++ b/llvm.spec @@ -119,6 +119,7 @@ Patch8: %{name}-selective_bindings.patch Patch9: %{name}-libexecdir.patch Patch10: compiler-rt-paths.patch Patch11: cmake-utils-path-override.patch +Patch12: x32-compiler-rt.patch URL: https://llvm.org/ BuildRequires: bash BuildRequires: binutils-devel @@ -708,6 +709,7 @@ Integracja narzędzi Clang do formatowania i zmiany nazw z Vimem. %patch9 -p1 %if %{with rt} %patch10 -p1 +%patch12 -p1 %endif %patch11 -p1 diff --git a/x32-compiler-rt.patch b/x32-compiler-rt.patch new file mode 100644 index 0000000..e8b85ff --- /dev/null +++ b/x32-compiler-rt.patch @@ -0,0 +1,12 @@ +--- llvm-15.0.2.src/projects/compiler-rt/cmake/Modules/CompilerRTUtils.cmake.orig 2022-10-04 11:29:17.000000000 +0200 ++++ llvm-15.0.2.src/projects/compiler-rt/cmake/Modules/CompilerRTUtils.cmake 2022-10-16 22:33:08.014906010 +0200 +@@ -478,7 +478,8 @@ + + function(get_compiler_rt_target arch variable) + string(FIND ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} "-" dash_index) +- string(SUBSTRING ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${dash_index} -1 triple_suffix) ++ string(SUBSTRING ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${dash_index} -1 triple_suffix_with_abi) ++ string(REPLACE "-gnux32" "" triple_suffix ${triple_suffix_with_abi}) + if(COMPILER_RT_DEFAULT_TARGET_ONLY) + # Use exact spelling when building only for the target specified to CMake. + set(target "${COMPILER_RT_DEFAULT_TARGET_TRIPLE}") diff --git a/x32-gcc-toolchain.patch b/x32-gcc-toolchain.patch index 4087f7a..b551b90 100644 --- a/x32-gcc-toolchain.patch +++ b/x32-gcc-toolchain.patch @@ -29,15 +29,3 @@ } BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs)); BiarchTripleAliases.append(begin(X86Triples), end(X86Triples)); ---- llvm-15.0.2.src/projects/compiler-rt/cmake/Modules/CompilerRTUtils.cmake.orig 2022-10-04 11:29:17.000000000 +0200 -+++ llvm-15.0.2.src/projects/compiler-rt/cmake/Modules/CompilerRTUtils.cmake 2022-10-16 22:33:08.014906010 +0200 -@@ -478,7 +478,8 @@ - - function(get_compiler_rt_target arch variable) - string(FIND ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} "-" dash_index) -- string(SUBSTRING ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${dash_index} -1 triple_suffix) -+ string(SUBSTRING ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${dash_index} -1 triple_suffix_with_abi) -+ string(REPLACE "-gnux32" "" triple_suffix ${triple_suffix_with_abi}) - if(COMPILER_RT_DEFAULT_TARGET_ONLY) - # Use exact spelling when building only for the target specified to CMake. - set(target "${COMPILER_RT_DEFAULT_TARGET_TRIPLE}") -- 2.44.0