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
This commit is contained in:
Aaron Puchert 2023-05-12 16:44:19 +00:00 committed by Git OBS Bridge
parent 972647c912
commit 60ecb3fd2b
3 changed files with 39 additions and 19 deletions

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Tue May 9 21:37:34 UTC 2023 - Aaron Puchert <aaronpuchert@alice-dsl.net>
- 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 <code@bnavigator.de> Fri Mar 24 21:31:24 UTC 2023 - Ben Greiner <code@bnavigator.de>

View File

@ -39,11 +39,10 @@
%bcond_with openmp %bcond_with openmp
%endif %endif
# We use gold where we want to use ThinLTO, but where lld isn't supported (well). %ifarch s390x
%ifarch %{ix86} ppc64 s390x %bcond_with use_lld
%bcond_without gold
%else %else
%bcond_with gold %bcond_without use_lld
%endif %endif
%ifarch x86_64 %ifarch x86_64
@ -55,7 +54,7 @@
%endif %endif
# Disabled on ARM because it's awfully slow and often times out. (boo#1178070) # 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 %bcond_without thin_lto
%else %else
%bcond_with thin_lto %bcond_with thin_lto
@ -184,9 +183,6 @@ Requires(post): update-alternatives
Requires(postun):update-alternatives Requires(postun):update-alternatives
# llvm does not work on s390 # llvm does not work on s390
ExcludeArch: s390 ExcludeArch: s390
%if %{with gold}
BuildRequires: binutils-gold
%endif
%if %{with ffi} %if %{with ffi}
BuildRequires: pkgconfig(libffi) BuildRequires: pkgconfig(libffi)
%endif %endif
@ -382,14 +378,18 @@ Group: System/Libraries
This package contains the link-time optimizer for LLVM. This package contains the link-time optimizer for LLVM.
%package gold %package gold
Summary: Gold linker plugin for LLVM Summary: LLVM LTO plugin for ld.bfd and ld.gold
Group: Development/Tools/Building Group: Development/Tools/Building
Conflicts: llvm-gold-provider < %{version} Conflicts: llvm-gold-provider < %{version}
Provides: llvm-gold-provider = %{version} Provides: llvm-gold-provider = %{version}
Supplements: packageand(clang%{_sonum}:binutils)
Supplements: packageand(clang%{_sonum}:binutils-gold) Supplements: packageand(clang%{_sonum}:binutils-gold)
%description 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 %package -n libomp%{_sonum}-devel
Summary: MPI plugin for LLVM 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 \ ninja -v %{?_smp_mflags} clang llvm-tblgen clang-tblgen \
%if %{with thin_lto} %if %{with thin_lto}
llvm-ar llvm-ranlib \ llvm-ar llvm-ranlib \
%if %{with gold} %if %{with use_lld}
LLVMgold
%else
lld lld
%else
LLVMgold
%endif %endif
%endif %endif
@ -830,15 +830,10 @@ export LD_LIBRARY_PATH=${PWD}/build/%{_lib}
-DLLVM_ENABLE_LTO=Thin \ -DLLVM_ENABLE_LTO=Thin \
-DCMAKE_AR="${LLVM_AR}" \ -DCMAKE_AR="${LLVM_AR}" \
-DCMAKE_RANLIB="${LLVM_RANLIB}" \ -DCMAKE_RANLIB="${LLVM_RANLIB}" \
%if %{with gold} %if %{with use_lld}
-DCMAKE_LINKER=%{_bindir}/ld.gold \
-DLLVM_USE_LINKER=gold \
%else
-DCMAKE_LINKER=${LLD} \ -DCMAKE_LINKER=${LLD} \
-DLLVM_USE_LINKER=${LLD} \ -DLLVM_USE_LINKER=${LLD} \
%endif %endif
%else
-DCMAKE_LINKER=%{_bindir}/ld \
%endif %endif
%ifarch %arm ppc s390 %{ix86} %ifarch %arm ppc s390 %{ix86}
-DCMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -g1 -DNDEBUG" \ -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -g1 -DNDEBUG" \

View File

@ -55,3 +55,16 @@ Index: llvm-8.0.0rc3.src/lib/TableGen/CMakeLists.txt
ADDITIONAL_HEADER_DIRS ADDITIONAL_HEADER_DIRS
${LLVM_MAIN_INCLUDE_DIR}/llvm/TableGen ${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