From 60ecb3fd2ba57dd3290e08873ec8634c81484c4d9e01da48d1fa1b5e1d55566d Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Fri, 12 May 2023 16:44:19 +0000 Subject: [PATCH] Accepting request 1086802 from home:aaronpuchert:branches:devel:tools:compiler - Don't use gold for linking anymore: on s390x we use ld.bfd with LLVMgold.so, on ppc64 we disable ThinLTO for now. (boo#1210688) - Using ld.bfd on s390x exposed an issue with the existing llvm_build_tablegen_component_as_shared_library.patch: linking llvm-tblgen with libLLVM.so means we also have to link libraries used for that (like LLVMTableGenGlobalISel) with libLLVM.so. - Rewrite summary and description for llvm-gold to point out that it can also be used with ld.bfd, recommend with binutils. OBS-URL: https://build.opensuse.org/request/show/1086802 OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=34 --- llvm13.changes | 12 +++++++ llvm13.spec | 33 ++++++++----------- ...tablegen_component_as_shared_library.patch | 13 ++++++++ 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/llvm13.changes b/llvm13.changes index 554824b..36f4c67 100644 --- a/llvm13.changes +++ b/llvm13.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Tue May 9 21:37:34 UTC 2023 - Aaron Puchert + +- Don't use gold for linking anymore: on s390x we use ld.bfd with + LLVMgold.so, on ppc64 we disable ThinLTO for now. (boo#1210688) +- Using ld.bfd on s390x exposed an issue with the existing + llvm_build_tablegen_component_as_shared_library.patch: linking + llvm-tblgen with libLLVM.so means we also have to link libraries + used for that (like LLVMTableGenGlobalISel) with libLLVM.so. +- Rewrite summary and description for llvm-gold to point out that + it can also be used with ld.bfd, recommend with binutils. + ------------------------------------------------------------------- Fri Mar 24 21:31:24 UTC 2023 - Ben Greiner diff --git a/llvm13.spec b/llvm13.spec index aebacf1..9536c9e 100644 --- a/llvm13.spec +++ b/llvm13.spec @@ -39,11 +39,10 @@ %bcond_with openmp %endif -# We use gold where we want to use ThinLTO, but where lld isn't supported (well). -%ifarch %{ix86} ppc64 s390x -%bcond_without gold +%ifarch s390x +%bcond_with use_lld %else -%bcond_with gold +%bcond_without use_lld %endif %ifarch x86_64 @@ -55,7 +54,7 @@ %endif # Disabled on ARM because it's awfully slow and often times out. (boo#1178070) -%ifarch %{ix86} ppc64 ppc64le s390x x86_64 +%ifarch %{ix86} ppc64le s390x x86_64 %bcond_without thin_lto %else %bcond_with thin_lto @@ -184,9 +183,6 @@ Requires(post): update-alternatives Requires(postun):update-alternatives # llvm does not work on s390 ExcludeArch: s390 -%if %{with gold} -BuildRequires: binutils-gold -%endif %if %{with ffi} BuildRequires: pkgconfig(libffi) %endif @@ -382,14 +378,18 @@ Group: System/Libraries This package contains the link-time optimizer for LLVM. %package gold -Summary: Gold linker plugin for LLVM +Summary: LLVM LTO plugin for ld.bfd and ld.gold Group: Development/Tools/Building Conflicts: llvm-gold-provider < %{version} Provides: llvm-gold-provider = %{version} +Supplements: packageand(clang%{_sonum}:binutils) Supplements: packageand(clang%{_sonum}:binutils-gold) %description gold -This package contains the Gold linker plugin for LLVM. +This package contains a plugin for link-time optimization in binutils linkers. + +Despite the name, it can also be used with ld.bfd. It is required for using +Clang with -flto=full or -flto=thin when linking with one of those linkers. %package -n libomp%{_sonum}-devel Summary: MPI plugin for LLVM @@ -765,10 +765,10 @@ avail_mem=$(awk '/MemAvailable/ { print $2 }' /proc/meminfo) ninja -v %{?_smp_mflags} clang llvm-tblgen clang-tblgen \ %if %{with thin_lto} llvm-ar llvm-ranlib \ -%if %{with gold} - LLVMgold -%else +%if %{with use_lld} lld +%else + LLVMgold %endif %endif @@ -830,15 +830,10 @@ export LD_LIBRARY_PATH=${PWD}/build/%{_lib} -DLLVM_ENABLE_LTO=Thin \ -DCMAKE_AR="${LLVM_AR}" \ -DCMAKE_RANLIB="${LLVM_RANLIB}" \ -%if %{with gold} - -DCMAKE_LINKER=%{_bindir}/ld.gold \ - -DLLVM_USE_LINKER=gold \ -%else +%if %{with use_lld} -DCMAKE_LINKER=${LLD} \ -DLLVM_USE_LINKER=${LLD} \ %endif -%else - -DCMAKE_LINKER=%{_bindir}/ld \ %endif %ifarch %arm ppc s390 %{ix86} -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -g1 -DNDEBUG" \ diff --git a/llvm_build_tablegen_component_as_shared_library.patch b/llvm_build_tablegen_component_as_shared_library.patch index 42379e6..17d827f 100644 --- a/llvm_build_tablegen_component_as_shared_library.patch +++ b/llvm_build_tablegen_component_as_shared_library.patch @@ -55,3 +55,16 @@ Index: llvm-8.0.0rc3.src/lib/TableGen/CMakeLists.txt ADDITIONAL_HEADER_DIRS ${LLVM_MAIN_INCLUDE_DIR}/llvm/TableGen +Index: llvm-13.0.1.src/utils/TableGen/GlobalISel/CMakeLists.txt +=================================================================== +--- llvm-13.0.1.src.orig/utils/TableGen/GlobalISel/CMakeLists.txt ++++ llvm-13.0.1.src/utils/TableGen/GlobalISel/CMakeLists.txt +@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS + TableGen + ) + +-add_llvm_library(LLVMTableGenGlobalISel STATIC DISABLE_LLVM_LINK_LLVM_DYLIB ++add_llvm_library(LLVMTableGenGlobalISel STATIC + CodeExpander.cpp + GIMatchDag.cpp + GIMatchDagEdge.cpp