From fb427b4aeb3bf807d9115ff7628052da0d2ccf086b9b9fe4f04492acc4d4cc92 Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Sun, 3 Apr 2022 20:07:39 +0000 Subject: [PATCH 1/9] Accepting request 966691 from home:aaronpuchert:llvm-next - Split up Clang libraries: libclang.so is no longer so-versioned alongside LLVM but will stay at libclang.so.13 for now. So we put it into a separate package from libclang-cpp.so. Since we can't have multiple LLVM versions generate the same package, we prefix it for the non-default LLVM with a mechanism inspired by the GCC packaging. - Use the same mechanism to for libc++ and package Clang scripts only for the default version. This means we'll no longer have to touch the package when a new major version comes out. - Make sure we properly clean up the clang scripts if we're not packaging them. - Let python3-clang use libclang.so.XX, which means we can always build it and makes it depend on libclang instead of clang-devel. - Fix some rpmlint issues: we don't need explicit library dependencies that are detected automatically, and we add proper library dependencies to the *-devel packages. - Merge llvm-LTO-devel into llvm-devel. That's where the header files already are, and they are hard to separate. - Let libomp-devel no longer depend on libLLVM, and let llvm-devel no longer depend on libomp-devel. They are independent. - Let llvm-devel no longer depend on llvm-polly-devel but let llvm-polly-devel depend on llvm-devel. We got that wrong. - Remove libLTO from baselibs, it doesn't seem to be needed. - Only suggest documentation packages. OBS-URL: https://build.opensuse.org/request/show/966691 OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=14 --- baselibs.conf | 6 +- llvm13.changes | 28 ++++++ llvm13.spec | 243 ++++++++++++++++++++++++------------------------- 3 files changed, 147 insertions(+), 130 deletions(-) diff --git a/baselibs.conf b/baselibs.conf index 7aee1bc..b33738a 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1,12 +1,8 @@ libLLVM13 -libclang13 -libLTO13 +libclang-cpp13 llvm13-devel provides "llvm-devel- = " conflicts "otherproviders(llvm-devel-)" clang13-devel provides "clang-devel- = " conflicts "otherproviders(clang-devel-)" -llvm13-LTO-devel - provides "llvm-LTO-devel- = " - conflicts "otherproviders(llvm-LTO-devel-)" diff --git a/llvm13.changes b/llvm13.changes index 45a987e..dbb2970 100644 --- a/llvm13.changes +++ b/llvm13.changes @@ -1,3 +1,31 @@ +------------------------------------------------------------------- +Sun Apr 3 13:42:27 UTC 2022 - Aaron Puchert + +- Split up Clang libraries: libclang.so is no longer so-versioned + alongside LLVM but will stay at libclang.so.13 for now. So we + put it into a separate package from libclang-cpp.so. Since we + can't have multiple LLVM versions generate the same package, we + prefix it for the non-default LLVM with a mechanism inspired by + the GCC packaging. +- Use the same mechanism to for libc++ and package Clang scripts + only for the default version. This means we'll no longer have to + touch the package when a new major version comes out. +- Make sure we properly clean up the clang scripts if we're not + packaging them. +- Let python3-clang use libclang.so.XX, which means we can always + build it and makes it depend on libclang instead of clang-devel. +- Fix some rpmlint issues: we don't need explicit library + dependencies that are detected automatically, and we add proper + library dependencies to the *-devel packages. +- Merge llvm-LTO-devel into llvm-devel. That's where the header + files already are, and they are hard to separate. +- Let libomp-devel no longer depend on libLLVM, and let llvm-devel + no longer depend on libomp-devel. They are independent. +- Let llvm-devel no longer depend on llvm-polly-devel but let + llvm-polly-devel depend on llvm-devel. We got that wrong. +- Remove libLTO from baselibs, it doesn't seem to be needed. +- Only suggest documentation packages. + ------------------------------------------------------------------- Sat Feb 19 15:23:13 UTC 2022 - Aaron Puchert diff --git a/llvm13.spec b/llvm13.spec index dc426a2..e4fe70d 100644 --- a/llvm13.spec +++ b/llvm13.spec @@ -21,8 +21,10 @@ %define _tagver %_relver%{?_rc:-rc%_rc} %define _minor 13.0 %define _sonum 13 +%define _itsme13 1 # Integer version used by update-alternatives %define _uaver 1301 +%define _soclang 13 %define _socxx 1 %ifarch x86_64 aarch64 %arm @@ -62,10 +64,14 @@ %bcond_with ffi %bcond_with oprofile %bcond_with valgrind -%bcond_without clang_scripts %bcond_without polly %bcond_without lld +%define _plv %{!?product_libs_llvm_ver:%{_sonum}}%{?product_libs_llvm_ver} + +# Expands to -n if we're providing the distribution default for the given package. +%define multisource() %{expand:%%{?_itsme%{expand:%%{!?product_libs_llvm_ver_%{1}:%%{_plv}}%%{?product_libs_llvm_ver_%{1}}}:-n}} + # set_jobs type memory # Set max__jobs so that every job of the given type has at least the # given amount of memory. @@ -150,11 +156,8 @@ BuildRequires: python-rpm-macros BuildRequires: python3-base BuildRequires: pkgconfig(libedit) BuildRequires: pkgconfig(zlib) -# Avoid multiple provider errors -Requires: libLLVM%{_sonum} Requires(post): update-alternatives Requires(postun):update-alternatives -Recommends: %{name}-doc # llvm does not work on s390 ExcludeArch: s390 %if %{with gold} @@ -169,6 +172,7 @@ BuildRequires: pkgconfig(valgrind) %if %{with oprofile} BuildRequires: oprofile-devel %endif +Suggests: %{name}-doc %description LLVM is a compiler infrastructure designed for compile-time, @@ -189,16 +193,11 @@ This package contains the shared libraries needed for LLVM. Summary: Header Files for LLVM Group: Development/Libraries/C and C++ Requires: %{name} = %{version} -%if %{with openmp} -Requires: libomp%{_sonum}-devel -%endif +Requires: libLLVM%{_sonum} = %{version} +Requires: libLTO%{_sonum} = %{version} Requires: libstdc++-devel Requires: libtool -Requires: llvm%{_sonum}-LTO-devel Requires: llvm%{_sonum}-gold -%if %{with polly} -Requires: llvm%{_sonum}-polly-devel -%endif Requires: pkgconfig Conflicts: llvm-devel-provider < %{version} %if %{suse_version} <= 1500 @@ -207,6 +206,8 @@ Conflicts: llvm5 Conflicts: llvm7 %endif Conflicts: cmake(LLVM) +Obsoletes: llvm%{_sonum}-LTO-devel <= %{version} +Provides: llvm%{_sonum}-LTO-devel = %{version} Provides: llvm-devel-provider = %{version} %if %{with ffi} Requires: pkgconfig(libffi) @@ -239,16 +240,13 @@ This package contains documentation for the LLVM infrastructure. Summary: CLANG frontend for LLVM Group: Development/Languages/C and C++ URL: https://clang.llvm.org/ -# Avoid multiple provider errors -Requires: libLTO%{_sonum} -Requires: libclang%{_sonum} Requires(post): update-alternatives Requires(postun):update-alternatives -Recommends: clang%{_sonum}-doc Recommends: clang-tools Recommends: gcc Recommends: glibc-devel Recommends: libstdc++-devel +Suggests: clang%{_sonum}-doc Suggests: libc++-devel %description -n clang%{_sonum} @@ -289,14 +287,28 @@ This package contains tools and scripts for using Clang, including: * scripts for using the Clang static analyzer: scan-build and scan-view, * a script for using find-all-symbols: run-find-all-symbols. -%package -n libclang%{_sonum} -Summary: Library files needed for clang -# Avoid multiple provider errors +%package %{multisource libclang%{_soclang}} libclang%{_soclang} +Summary: Clang stable C API for indexing and code completion Group: System/Libraries -Requires: libLLVM%{_sonum} +Provides: libclang%{_soclang} = %{version} +Conflicts: libclang%{_soclang} < %{version} -%description -n libclang%{_sonum} -This package contains the shared libraries needed for clang. +%description %{multisource libclang%{_soclang}} libclang%{_soclang} +This library exposes a limited C API for indexing and code completion for +code written in languages of the C family. +It is designed to be stable across major versions of LLVM. + +It corresponds to the header files in %{_includedir}/clang-c. + +%package -n libclang-cpp%{_sonum} +Summary: Clang full C++ API +Group: System/Libraries + +%description -n libclang-cpp%{_sonum} +This library exposes the full C++ API to Clang that is used to implement +all Clang tools. It is not stable across major LLVM versions. + +It corresponds to the header files in %{_includedir}/clang. %package -n clang%{_sonum}-devel Summary: CLANG frontend for LLVM (devel package) @@ -304,6 +316,8 @@ Group: Development/Libraries/C and C++ Requires: %{name}-devel = %{version} Requires: clang%{_sonum} = %{version} Requires: clang-tools >= %{version} +Requires: libclang%{_soclang} >= %{version} +Requires: libclang-cpp%{_sonum} = %{version} Conflicts: cmake(Clang) %description -n clang%{_sonum}-devel @@ -327,31 +341,14 @@ This package contains documentation for the Clang compiler. %package -n libLTO%{_sonum} Summary: Link-time optimizer for LLVM -# Avoid multiple provider errors Group: System/Libraries -Requires: libLLVM%{_sonum} %description -n libLTO%{_sonum} This package contains the link-time optimizer for LLVM. -%package LTO-devel -Summary: Link-time optimizer for LLVM (devel package) -# Avoid multiple provider errors -Group: Development/Libraries/C and C++ -Requires: %{name}-devel = %{version} -Requires: libLTO%{_sonum} -Conflicts: libLTO.so < %{version} -Provides: libLTO.so = %{version} - -%description LTO-devel -This package contains the link-time optimizer for LLVM. -(development files) - %package gold Summary: Gold linker plugin for LLVM -# Avoid multiple provider errors Group: Development/Tools/Building -Requires: libLLVM%{_sonum} Conflicts: llvm-gold-provider < %{version} Provides: llvm-gold-provider = %{version} Supplements: packageand(clang%{_sonum}:binutils-gold) @@ -361,61 +358,57 @@ This package contains the Gold linker plugin for LLVM. %package -n libomp%{_sonum}-devel Summary: MPI plugin for LLVM -# Avoid multiple provider errors Group: Development/Libraries/C and C++ -Requires: libLLVM%{_sonum} Conflicts: libomp-devel < %{version} Provides: libomp-devel = %{version} %description -n libomp%{_sonum}-devel This package contains the OpenMP MPI plugin for LLVM. -%if %{with libcxx} -%package -n libc++%{_socxx} +%package %{multisource libcxx%{_socxx}} libc++%{_socxx} Summary: C++ standard library implementation Group: System/Libraries URL: https://libcxx.llvm.org/ Requires: libc++abi%{_socxx} = %{version} +Provides: libc++%{_socxx} = %{version} -%description -n libc++%{_socxx} +%description %{multisource libcxx%{_socxx}} libc++%{_socxx} This package contains libc++, a new implementation of the C++ standard library, targeting C++11. -%package -n libc++-devel +%package %{multisource libcxx_devel} libc++-devel Summary: C++ standard library implementation (devel package) -# Avoid multiple provider errors Group: Development/Libraries/C and C++ -Requires: libc++%{_socxx} = %{version} +Requires: libc++%{_socxx} >= %{version} Requires: libc++abi-devel = %{version} Conflicts: libc++.so < %{version} Provides: libc++.so = %{version} -%description -n libc++-devel +%description %{multisource libcxx_devel} libc++-devel This package contains libc++, a new implementation of the C++ standard library, targeting C++11. (development files) -%package -n libc++abi%{_socxx} +%package %{multisource libcxxabi%{_socxx}} libc++abi%{_socxx} Summary: C++ standard library ABI Group: System/Libraries URL: https://libcxxabi.llvm.org/ +Provides: libc++abi%{_socxx} = %{version} -%description -n libc++abi%{_socxx} +%description %{multisource libcxxabi%{_socxx}} libc++abi%{_socxx} This package contains the ABI for libc++, a new implementation of the C++ standard library, targeting C++11. -%package -n libc++abi-devel +%package %{multisource libcxx_devel} libc++abi-devel Summary: C++ standard library ABI (devel package) Group: Development/Libraries/C and C++ -Requires: libc++-devel -Requires: libc++abi%{_socxx} = %{version} +Requires: libc++abi%{_socxx} >= %{version} Conflicts: libc++abi.so < %{version} Provides: libc++abi.so = %{version} -%description -n libc++abi-devel +%description %{multisource libcxx_devel} libc++abi-devel This package contains the ABI for libc++, a new implementation of the C++ standard library, targeting C++11. (development files) -%endif %package vim-plugins Summary: Vim plugins for LLVM @@ -428,16 +421,16 @@ BuildArch: noarch %description vim-plugins This package contains vim plugins for LLVM like syntax highlighting. -%package -n python3-clang +%package -n python3-clang%{_sonum} Summary: Python bindings for libclang Group: Development/Libraries/Python -Requires: clang%{_sonum}-devel = %{version} +Requires: libclang%{_soclang} >= %{version} Requires: python3-base Conflicts: %{python3_sitearch}/clang/ Provides: %{python3_sitearch}/clang/ BuildArch: noarch -%description -n python3-clang +%description -n python3-clang%{_sonum} This package contains the Python bindings to clang (C language) frontend for LLVM. @@ -477,8 +470,6 @@ BuildRequires: pkgconfig(ncurses) BuildRequires: pkgconfig(panel) BuildRequires: pkgconfig(python3) BuildRequires: pkgconfig(zlib) -# Avoid multiple provider errors -Requires: liblldb%{_sonum} = %{version} Requires(post): update-alternatives Requires(postun):update-alternatives Recommends: python3-lldb%{_sonum} @@ -492,17 +483,13 @@ disassembler. %package -n liblldb%{_sonum} Summary: LLDB software debugger runtime library -# Avoid multiple provider errors Group: System/Libraries -Requires: libLLVM%{_sonum} -Requires: libclang%{_sonum} %description -n liblldb%{_sonum} This subpackage contains the main LLDB component. %package -n lldb%{_sonum}-devel Summary: Development files for LLDB -# Avoid multiple provider errors Group: Development/Libraries/C and C++ Requires: clang%{_sonum}-devel = %{version} Requires: liblldb%{_sonum} = %{version} @@ -520,7 +507,6 @@ This package contains the development files for LLDB. Summary: Python bindings for liblldb Group: Development/Libraries/Python BuildRequires: swig >= 3.0.11 -# Avoid multiple provider errors Requires: liblldb%{_sonum} = %{version} Requires: python3-base Requires: python3-six @@ -553,6 +539,7 @@ level parallelism and expose SIMDization opportunities. %package polly-devel Summary: Development files for Polly Group: Development/Libraries/C and C++ +Requires: llvm%{_sonum}-devel = %{version} Requires: llvm%{_sonum}-polly = %{version} Conflicts: llvm-polly-devel-provider < %{version} Provides: llvm-polly-devel-provider = %{version} @@ -919,17 +906,47 @@ rm -r %{buildroot}%{_docdir}/llvm-clang/_sources popd # install python bindings -# The python bindings use the unversioned libclang.so, -# so it doesn't make sense to have multiple versions of it -%if %{with clang_scripts} install -d %{buildroot}%{python3_sitelib}/clang pushd tools/clang/bindings/python cp clang/*.py %{buildroot}%{python3_sitelib}/clang +# Make the bindings use the current so number, so that we don't need an unversioned libclang.so. +sed -i "s/file = 'libclang\.so'/file = 'libclang.so.%{_soclang}'/" %{buildroot}%{python3_sitelib}/clang/cindex.py install -d %{buildroot}%{_docdir}/python-clang/examples/cindex cp -r examples %{buildroot}%{_docdir}/python-clang install -d %{buildroot}%{_docdir}/python-clang/tests/cindex/INPUTS cp -r tests %{buildroot}%{_docdir}/python-clang popd + +# Scripts for clang use unversioned executables, so it doesn't make sense to +# have multiple versions of them. We package them only for the default version. +%if %{_plv} == %{_sonum} +%if "%{_libexecdir}" != "%{_prefix}/libexec" +mv %{buildroot}%{_prefix}/libexec/{c++,ccc}-analyzer %{buildroot}%{_bindir} +mv %{buildroot}%{_prefix}/libexec/{analyze,intercept}-{cc,c++} %{buildroot}%{_bindir} +%endif + +mv %{buildroot}%{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff +mv %{buildroot}%{_datadir}/clang/clang-tidy-diff.py %{buildroot}%{_bindir}/clang-tidy-diff +mv %{buildroot}%{_datadir}/clang/run-find-all-symbols.py %{buildroot}%{_bindir}/run-find-all-symbols + +mkdir -p %{buildroot}%{_datadir}/bash-completion/completions +mv %{buildroot}%{_datadir}/clang/bash-autocomplete.sh %{buildroot}%{_datadir}/bash-completion/completions/clang + +# We don't care about applescript or sublime text +rm %{buildroot}%{_datadir}/clang/*.applescript +rm %{buildroot}%{_datadir}/clang/clang-format-sublime.py +%else +rm %{buildroot}%{_bindir}/{analyze,intercept}-build +rm %{buildroot}%{_bindir}/clang-doc +rm %{buildroot}%{_bindir}/git-clang-format +rm %{buildroot}%{_bindir}/hmaptool +rm %{buildroot}%{_bindir}/run-clang-tidy +rm %{buildroot}%{_bindir}/scan-{build,build-py,view} +rm -r %{buildroot}%{_prefix}/lib/lib{ear,scanbuild} +rm %{buildroot}%{_prefix}/libexec/{c++,ccc}-analyzer +rm %{buildroot}%{_prefix}/libexec/{analyze,intercept}-{cc,c++} +rm -r %{buildroot}%{_datadir}/{clang,scan-build,scan-view}/ +rm %{buildroot}%{_mandir}/man1/scan-build.1 %endif # Note that bfd-plugins is in /usr/lib/bfd-plugins before binutils 2.33.1 @@ -942,14 +959,6 @@ for i in ftdetect ftplugin indent syntax; do done mv utils/vim/README utils/vim/README.vim -%if "%{_libexecdir}" != "%{_prefix}/libexec" -mv %{buildroot}%{_prefix}/libexec/{c++,ccc}-analyzer %{buildroot}%{_bindir} -mv %{buildroot}%{_prefix}/libexec/{analyze,intercept}-{cc,c++} %{buildroot}%{_bindir} -%endif -mv %{buildroot}%{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff -mv %{buildroot}%{_datadir}/clang/clang-tidy-diff.py %{buildroot}%{_bindir}/clang-tidy-diff -mv %{buildroot}%{_datadir}/clang/run-find-all-symbols.py %{buildroot}%{_bindir}/run-find-all-symbols - install -d %{buildroot}%{python3_sitelib} mv %{buildroot}%{_datadir}/opt-viewer/opt-diff.py %{buildroot}%{_bindir}/opt-diff mv %{buildroot}%{_datadir}/opt-viewer/opt-stats.py %{buildroot}%{_bindir}/opt-stats @@ -957,12 +966,8 @@ mv %{buildroot}%{_datadir}/opt-viewer/opt-viewer.py %{buildroot}%{_bindir}/opt-v mv %{buildroot}%{_datadir}/opt-viewer/optpmap.py %{buildroot}%{python3_sitelib}/optpmap.py mv %{buildroot}%{_datadir}/opt-viewer/optrecord.py %{buildroot}%{python3_sitelib}/optrecord.py -mkdir -p %{buildroot}%{_datadir}/bash-completion/completions -mv %{buildroot}%{_datadir}/clang/bash-autocomplete.sh %{buildroot}%{_datadir}/bash-completion/completions/clang - rm %{buildroot}%{_mandir}/man1/{,clang-,lldb-,mlir-}tblgen.1 rm %{buildroot}%{_mandir}/man1/llvm-locstats.1 -chmod -x %{buildroot}%{_mandir}/man1/scan-build.1 %if %{with lldb_python} # Python: fix binary libraries location. @@ -988,10 +993,6 @@ rm %{buildroot}%{_libdir}/libiomp*.so rm %{buildroot}%{_libdir}/libarcher_static.a %endif -# We don't care about applescript or sublime text -rm %{buildroot}%{_datadir}/clang/*.applescript -rm %{buildroot}%{_datadir}/clang/clang-format-sublime.py - # Prepare for update-alternatives usage mkdir -p %{buildroot}%{_sysconfdir}/alternatives binfiles=( bugpoint dsymutil llc lli \ @@ -1078,14 +1079,15 @@ cat > %{buildroot}%{_rpmconfigdir}/macros.d/macros.llvm < Date: Sun, 3 Apr 2022 23:11:26 +0000 Subject: [PATCH 2/9] - Add back dependency of llvm-devel on libomp-devel. Not really needed, but CMake is picky and the target is registered for LLVM. OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=15 --- llvm13.changes | 2 -- llvm13.spec | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm13.changes b/llvm13.changes index dbb2970..cd12a00 100644 --- a/llvm13.changes +++ b/llvm13.changes @@ -19,8 +19,6 @@ Sun Apr 3 13:42:27 UTC 2022 - Aaron Puchert library dependencies to the *-devel packages. - Merge llvm-LTO-devel into llvm-devel. That's where the header files already are, and they are hard to separate. -- Let libomp-devel no longer depend on libLLVM, and let llvm-devel - no longer depend on libomp-devel. They are independent. - Let llvm-devel no longer depend on llvm-polly-devel but let llvm-polly-devel depend on llvm-devel. We got that wrong. - Remove libLTO from baselibs, it doesn't seem to be needed. diff --git a/llvm13.spec b/llvm13.spec index e4fe70d..2230354 100644 --- a/llvm13.spec +++ b/llvm13.spec @@ -193,6 +193,9 @@ This package contains the shared libraries needed for LLVM. Summary: Header Files for LLVM Group: Development/Libraries/C and C++ Requires: %{name} = %{version} +%if %{with openmp} +Requires: libomp%{_sonum}-devel +%endif Requires: libLLVM%{_sonum} = %{version} Requires: libLTO%{_sonum} = %{version} Requires: libstdc++-devel From 359a8abca977b30fd5835cc9e1cac317281a5cff17641355b0744250854b65e0 Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Mon, 4 Apr 2022 01:02:52 +0000 Subject: [PATCH 3/9] - Re-add dependency of llvm-devel on llvm-polly-devel. (Again for CMake.) OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=16 --- llvm13.changes | 3 +-- llvm13.spec | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/llvm13.changes b/llvm13.changes index cd12a00..d484277 100644 --- a/llvm13.changes +++ b/llvm13.changes @@ -19,8 +19,7 @@ Sun Apr 3 13:42:27 UTC 2022 - Aaron Puchert library dependencies to the *-devel packages. - Merge llvm-LTO-devel into llvm-devel. That's where the header files already are, and they are hard to separate. -- Let llvm-devel no longer depend on llvm-polly-devel but let - llvm-polly-devel depend on llvm-devel. We got that wrong. +- Let llvm-polly-devel depend on llvm-devel. - Remove libLTO from baselibs, it doesn't seem to be needed. - Only suggest documentation packages. diff --git a/llvm13.spec b/llvm13.spec index 2230354..609aeb7 100644 --- a/llvm13.spec +++ b/llvm13.spec @@ -194,6 +194,7 @@ Summary: Header Files for LLVM Group: Development/Libraries/C and C++ Requires: %{name} = %{version} %if %{with openmp} +# Referenced by LLVMExports.cmake Requires: libomp%{_sonum}-devel %endif Requires: libLLVM%{_sonum} = %{version} @@ -201,6 +202,10 @@ Requires: libLTO%{_sonum} = %{version} Requires: libstdc++-devel Requires: libtool Requires: llvm%{_sonum}-gold +%if %{with polly} +# Referenced by LLVMExports.cmake +Requires: llvm%{_sonum}-polly-devel +%endif Requires: pkgconfig Conflicts: llvm-devel-provider < %{version} %if %{suse_version} <= 1500 From 873759c6e8ef96e5359dd6be7ca8f20518097189a8bf6e0157d44b3d599ab56d Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Tue, 5 Apr 2022 00:23:09 +0000 Subject: [PATCH 4/9] - Patch exported clang/ClangTargets-relwithdebinfo.cmake to refer to libclang only by soname, because the installed library might be newer than the one originally build with the package. OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=17 --- llvm13.changes | 3 +++ llvm13.spec | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/llvm13.changes b/llvm13.changes index d484277..b4eb0b5 100644 --- a/llvm13.changes +++ b/llvm13.changes @@ -7,6 +7,9 @@ Sun Apr 3 13:42:27 UTC 2022 - Aaron Puchert can't have multiple LLVM versions generate the same package, we prefix it for the non-default LLVM with a mechanism inspired by the GCC packaging. +- Patch exported clang/ClangTargets-relwithdebinfo.cmake to refer + to libclang only by soname, because the installed library might + be newer than the one originally build with the package. - Use the same mechanism to for libc++ and package Clang scripts only for the default version. This means we'll no longer have to touch the package when a new major version comes out. diff --git a/llvm13.spec b/llvm13.spec index 609aeb7..0497df1 100644 --- a/llvm13.spec +++ b/llvm13.spec @@ -1067,6 +1067,11 @@ sed -i "$( done )" %{buildroot}%{_libdir}/cmake/{llvm/LLVMExports,clang/ClangTargets}-relwithdebinfo.cmake +# For libclang, have the CMake export list refer to the library via soname. +# The original library might not be available. (We might have a newer version.) +sed -i "s|\"\${_IMPORT_PREFIX}/%{_lib}/libclang.so.%{_relver}\"|\"\${_IMPORT_PREFIX}/%{_lib}/libclang.so.%{_soclang}\"|g" \ + %{buildroot}%{_libdir}/cmake/clang/ClangTargets-relwithdebinfo.cmake + # rpm macro for version checking mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d/ cat > %{buildroot}%{_rpmconfigdir}/macros.d/macros.llvm < Date: Sat, 9 Apr 2022 19:53:07 +0000 Subject: [PATCH 5/9] - Remove *-devel packages from baselibs, they don't seem to be needed. We mostly need libLLVM and maybe libclang-cpp. - Add more conflicts/requirements to satisfy installcheck. - Fix paths in clang-tools. OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=18 --- baselibs.conf | 6 ------ llvm13.changes | 3 ++- llvm13.spec | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/baselibs.conf b/baselibs.conf index b33738a..7d85da8 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1,8 +1,2 @@ libLLVM13 libclang-cpp13 -llvm13-devel - provides "llvm-devel- = " - conflicts "otherproviders(llvm-devel-)" -clang13-devel - provides "clang-devel- = " - conflicts "otherproviders(clang-devel-)" diff --git a/llvm13.changes b/llvm13.changes index b4eb0b5..51e23bd 100644 --- a/llvm13.changes +++ b/llvm13.changes @@ -23,7 +23,8 @@ Sun Apr 3 13:42:27 UTC 2022 - Aaron Puchert - Merge llvm-LTO-devel into llvm-devel. That's where the header files already are, and they are hard to separate. - Let llvm-polly-devel depend on llvm-devel. -- Remove libLTO from baselibs, it doesn't seem to be needed. +- Remove libLTO and *-devel packages from baselibs, they don't + seem to be needed. We mostly need libLLVM and maybe libclang-cpp. - Only suggest documentation packages. ------------------------------------------------------------------- diff --git a/llvm13.spec b/llvm13.spec index 0497df1..24b1a80 100644 --- a/llvm13.spec +++ b/llvm13.spec @@ -214,6 +214,9 @@ Conflicts: llvm5 Conflicts: llvm7 %endif Conflicts: cmake(LLVM) +# libLTO.so used to be a separate package. +Conflicts: libLTO.so < %{version} +Provides: libLTO.so = %{version} Obsoletes: llvm%{_sonum}-LTO-devel <= %{version} Provides: llvm%{_sonum}-LTO-devel = %{version} Provides: llvm-devel-provider = %{version} @@ -378,6 +381,7 @@ Summary: C++ standard library implementation Group: System/Libraries URL: https://libcxx.llvm.org/ Requires: libc++abi%{_socxx} = %{version} +Conflicts: libc++%{_socxx} < %{version} Provides: libc++%{_socxx} = %{version} %description %{multisource libcxx%{_socxx}} libc++%{_socxx} @@ -388,7 +392,7 @@ standard library, targeting C++11. Summary: C++ standard library implementation (devel package) Group: Development/Libraries/C and C++ Requires: libc++%{_socxx} >= %{version} -Requires: libc++abi-devel = %{version} +Requires: libc++abi.so >= %{version} Conflicts: libc++.so < %{version} Provides: libc++.so = %{version} @@ -400,6 +404,7 @@ standard library, targeting C++11. (development files) Summary: C++ standard library ABI Group: System/Libraries URL: https://libcxxabi.llvm.org/ +Conflicts: libc++abi%{_socxx} < %{version} Provides: libc++abi%{_socxx} = %{version} %description %{multisource libcxxabi%{_socxx}} libc++abi%{_socxx} @@ -937,6 +942,17 @@ mv %{buildroot}%{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/cla mv %{buildroot}%{_datadir}/clang/clang-tidy-diff.py %{buildroot}%{_bindir}/clang-tidy-diff mv %{buildroot}%{_datadir}/clang/run-find-all-symbols.py %{buildroot}%{_bindir}/run-find-all-symbols +# Fix paths to internal binaries. +sed -i "s|COMPILER_WRAPPER_\([A-Z]*\) = 'intercept-\([^']*\)'|COMPILER_WRAPPER_\1 = '%{_libexecdir_fallback}/intercept-\2'|" \ + %{buildroot}%{_prefix}/lib/libscanbuild/intercept.py +%if "%{_libexecdir}" != "%{_prefix}/libexec" +LIBEXEC=%{_libexecdir_fallback} +RELATIVE_LIBEXEC=${LIBEXEC#%{_prefix}/} +RELATIVE_LIBEXEC_COMMA=${RELATIVE_LIBEXEC//\//\', \'} +sed -i "s|os.path.join(scanbuild_dir, '..', 'libexec', 'analyze-\([^']*\)')|os.path.join(scanbuild_dir, '..', '$RELATIVE_LIBEXEC_COMMA', 'analyze-\1')|" \ + %{buildroot}%{_prefix}/lib/libscanbuild/analyze.py +%endif + mkdir -p %{buildroot}%{_datadir}/bash-completion/completions mv %{buildroot}%{_datadir}/clang/bash-autocomplete.sh %{buildroot}%{_datadir}/bash-completion/completions/clang From e38f24ab12060e59416ce31e5d4aff2a77a7fbf1bed9144e465b744932344ebf Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Tue, 12 Apr 2022 20:08:35 +0000 Subject: [PATCH 6/9] Accepting request 968066 from home:dirkmueller:Factory - add llvm-rust-mangle-for-fastcall.patch for rust 1.59 - fix armv6hl cpu architecture typo OBS-URL: https://build.opensuse.org/request/show/968066 OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=19 --- llvm-rust-mangle-for-fastcall.patch | 43 +++++++++++++++++++++++++++++ llvm13.changes | 10 +++++++ llvm13.spec | 11 ++++++-- 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 llvm-rust-mangle-for-fastcall.patch diff --git a/llvm-rust-mangle-for-fastcall.patch b/llvm-rust-mangle-for-fastcall.patch new file mode 100644 index 0000000..4898d83 --- /dev/null +++ b/llvm-rust-mangle-for-fastcall.patch @@ -0,0 +1,43 @@ +Taken from https://github.com/rust-lang/llvm-project/commit/c03f9802c54067aab1c94085a657d11870d2a26f.patch + +From c03f9802c54067aab1c94085a657d11870d2a26f Mon Sep 17 00:00:00 2001 +From: Amanieu d'Antras +Date: Fri, 25 Feb 2022 22:06:47 +0000 +Subject: [PATCH] [Mangler] Mangle aliases to fastcall/vectorcall functions + correctly + +These aliases are produced by MergeFunctions and need to be mangled according to the calling convention of the function they are pointing to instead of defaulting to the C calling convention. + +Reviewed By: rnk + +Differential Revision: https://reviews.llvm.org/D120382 +--- + llvm/lib/IR/Mangler.cpp | 2 +- + llvm/test/CodeGen/X86/fastcall-correct-mangling.ll | 4 ++++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp +index 2399ea27ee9d4..b8e3e40e4c1d5 100644 +--- a/llvm/lib/IR/Mangler.cpp ++++ b/llvm/lib/IR/Mangler.cpp +@@ -144,7 +144,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, + + // Mangle functions with Microsoft calling conventions specially. Only do + // this mangling for x86_64 vectorcall and 32-bit x86. +- const Function *MSFunc = dyn_cast(GV); ++ const Function *MSFunc = dyn_cast_or_null(GV->getBaseObject()); + + // Don't add byte count suffixes when '\01' or '?' are in the first + // character. +diff --git a/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll b/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll +index 00dc44e75e8f5..dd8ce0f0ef505 100644 +--- a/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll ++++ b/llvm/test/CodeGen/X86/fastcall-correct-mangling.ll +@@ -31,3 +31,7 @@ define private x86_fastcallcc void @dontCrash() { + ; CHECK64-LABEL: {{^}}.LdontCrash: + ret void + } ++ ++@alias = alias void(i64, i8, i8, i16), void(i64, i8, i8, i16)* @func ++; CHECK32-LABEL: {{^}}.set @alias@20, @func@20 ++; CHECK64-LABEL: {{^}}.set alias, func diff --git a/llvm13.changes b/llvm13.changes index 51e23bd..0ef3204 100644 --- a/llvm13.changes +++ b/llvm13.changes @@ -27,6 +27,16 @@ Sun Apr 3 13:42:27 UTC 2022 - Aaron Puchert seem to be needed. We mostly need libLLVM and maybe libclang-cpp. - Only suggest documentation packages. +------------------------------------------------------------------- +Wed Mar 9 17:53:48 UTC 2022 - Dirk Müller + +- add llvm-rust-mangle-for-fastcall.patch for rust 1.59 + +------------------------------------------------------------------- +Sun Mar 6 21:24:55 UTC 2022 - Dirk Müller + +- fix armv6hl cpu architecture typo + ------------------------------------------------------------------- Sat Feb 19 15:23:13 UTC 2022 - Aaron Puchert diff --git a/llvm13.spec b/llvm13.spec index 24b1a80..500da17 100644 --- a/llvm13.spec +++ b/llvm13.spec @@ -119,6 +119,8 @@ Source100: %{name}-rpmlintrc Source101: baselibs.conf # PATCH-FIX-OPENSUSE lto-disable-cache.patch -- Disable ThinLTO cache Patch0: lto-disable-cache.patch +# PATCH-FIX-UPSTREAM https://github.com/rust-lang/llvm-project/commit/c03f9802c54067aab1c94085a657d11870d2a26f.patch +Patch1: llvm-rust-mangle-for-fastcall.patch # PATCH-FIX-OPENSUSE assume-opensuse.patch idoenmez@suse.de -- Always enable openSUSE/SUSE features Patch2: assume-opensuse.patch # PATCH-FIX-OPENSUSE default-to-i586.patch -- Use i586 as default target for 32bit @@ -563,8 +565,8 @@ This package contains the development files for Polly. %prep %setup -q -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -b 50 -b 51 -n llvm-%{_version}.src - %patch0 -p2 +%patch1 -p2 %patch5 -p1 %patch13 -p1 %patch14 -p1 @@ -654,10 +656,10 @@ mv libcxxabi-%{_version}.src projects/libcxxabi flags=$(echo %{optflags} | sed 's/-D_FORTIFY_SOURCE=./-D_FORTIFY_SOURCE=0/;s/\B-g\b//g') %ifarch armv6hl -flags+=" -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" +flags+=" -mfloat-abi=hard -mcpu=arm1176jzf-s -mfpu=vfpv2" %endif %ifarch armv7hl -flags+=" -mfloat-abi=hard -march=armv7-a -mtune=cortex-a15 -mfpu=vfpv3-d16" +flags+=" -mfloat-abi=hard -march=armv7-a -mtune=cortex-a17 -mfpu=vfpv3-d16" %endif CFLAGS=$flags @@ -727,6 +729,9 @@ avail_mem=$(awk '/MemAvailable/ { print $2 }' /proc/meminfo) -DLLVM_INCLUDE_TESTS:BOOL=OFF \ -DLLVM_ENABLE_ASSERTIONS=OFF \ -DLLVM_TARGETS_TO_BUILD=Native \ +%ifarch armv6hl + -DLLVM_DEFAULT_TARGET_TRIPLE=armv6kz-suse-linux-gnueabihf \ +%endif -DCLANG_ENABLE_ARCMT:BOOL=OFF \ -DCLANG_ENABLE_STATIC_ANALYZER:BOOL=OFF \ -DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF \ From a047e503aa0d399113aea3007019e281f54cd4ec2644a45779d1debef104ffcb Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Tue, 12 Apr 2022 20:39:15 +0000 Subject: [PATCH 7/9] - Consistently set host triple as *-suse-linux-gnu*. OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=20 --- llvm-rust-mangle-for-fastcall.patch | 4 +--- llvm13-rpmlintrc | 4 ++++ llvm13.changes | 1 + llvm13.spec | 23 +++++++++++++++++++---- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/llvm-rust-mangle-for-fastcall.patch b/llvm-rust-mangle-for-fastcall.patch index 4898d83..ae9cd72 100644 --- a/llvm-rust-mangle-for-fastcall.patch +++ b/llvm-rust-mangle-for-fastcall.patch @@ -1,6 +1,4 @@ -Taken from https://github.com/rust-lang/llvm-project/commit/c03f9802c54067aab1c94085a657d11870d2a26f.patch - -From c03f9802c54067aab1c94085a657d11870d2a26f Mon Sep 17 00:00:00 2001 +From 54b909de682bfa4e3389b680b0916ab18c99952a Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Fri, 25 Feb 2022 22:06:47 +0000 Subject: [PATCH] [Mangler] Mangle aliases to fastcall/vectorcall functions diff --git a/llvm13-rpmlintrc b/llvm13-rpmlintrc index 977dcd2..b0eb9b9 100644 --- a/llvm13-rpmlintrc +++ b/llvm13-rpmlintrc @@ -10,3 +10,7 @@ addFilter("devel-file-in-non-devel-package .*/lib.*/*.so") # We're deliberately conflicting with SLE. (https://code.opensuse.org/leap/features/issue/55) addFilter("SUSE_Backports_policy-SLE_conflict") + +# Different versions of LLVM can produce the same SONAME, so we'll have to use +# non-standard names sometimes. (Leap's rpmlint complains, Tumbleweed's doesn't.) +addFilter("shlib-policy-name-error") diff --git a/llvm13.changes b/llvm13.changes index 0ef3204..4a38484 100644 --- a/llvm13.changes +++ b/llvm13.changes @@ -25,6 +25,7 @@ Sun Apr 3 13:42:27 UTC 2022 - Aaron Puchert - Let llvm-polly-devel depend on llvm-devel. - Remove libLTO and *-devel packages from baselibs, they don't seem to be needed. We mostly need libLLVM and maybe libclang-cpp. +- Consistently set host triple as *-suse-linux-gnu*. - Only suggest documentation packages. ------------------------------------------------------------------- diff --git a/llvm13.spec b/llvm13.spec index 500da17..0212497 100644 --- a/llvm13.spec +++ b/llvm13.spec @@ -67,6 +67,21 @@ %bcond_without polly %bcond_without lld +# Figure out the host triple. +%ifarch armv6l +# See https://build.opensuse.org/request/show/968066. +%define host_cpu armv6kz +%else +%define host_cpu %{_host_cpu} +%endif + +%ifarch %{arm} +%define host_runtime gnueabihf +%else +%define host_runtime gnu +%endif +%define host_triple %{host_cpu}-%{_host_vendor}-%{_host_os}-%{host_runtime} + %define _plv %{!?product_libs_llvm_ver:%{_sonum}}%{?product_libs_llvm_ver} # Expands to -n if we're providing the distribution default for the given package. @@ -119,7 +134,8 @@ Source100: %{name}-rpmlintrc Source101: baselibs.conf # PATCH-FIX-OPENSUSE lto-disable-cache.patch -- Disable ThinLTO cache Patch0: lto-disable-cache.patch -# PATCH-FIX-UPSTREAM https://github.com/rust-lang/llvm-project/commit/c03f9802c54067aab1c94085a657d11870d2a26f.patch +# PATCH-FIX-UPSTREAM https://github.com/llvm/llvm-project/commit/54b909de682bfa4e3389b680b0916ab18c99952a, +# rebased past https://github.com/llvm/llvm-project/commit/40ec1c0f16cb23f8b83fb3d28b195e83991defd9. Patch1: llvm-rust-mangle-for-fastcall.patch # PATCH-FIX-OPENSUSE assume-opensuse.patch idoenmez@suse.de -- Always enable openSUSE/SUSE features Patch2: assume-opensuse.patch @@ -715,6 +731,7 @@ avail_mem=$(awk '/MemAvailable/ { print $2 }' /proc/meminfo) %cmake \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DLLVM_HOST_TRIPLE=%{host_triple} \ -DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF \ -DLLVM_LINK_LLVM_DYLIB:BOOL=OFF \ -DLLVM_PARALLEL_COMPILE_JOBS="$max_compile_jobs" \ @@ -729,9 +746,6 @@ avail_mem=$(awk '/MemAvailable/ { print $2 }' /proc/meminfo) -DLLVM_INCLUDE_TESTS:BOOL=OFF \ -DLLVM_ENABLE_ASSERTIONS=OFF \ -DLLVM_TARGETS_TO_BUILD=Native \ -%ifarch armv6hl - -DLLVM_DEFAULT_TARGET_TRIPLE=armv6kz-suse-linux-gnueabihf \ -%endif -DCLANG_ENABLE_ARCMT:BOOL=OFF \ -DCLANG_ENABLE_STATIC_ANALYZER:BOOL=OFF \ -DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF \ @@ -798,6 +812,7 @@ export LD_LIBRARY_PATH=${PWD}/build/%{_lib} # -z,now is breaking now, it needs to be fixed %cmake \ -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DLLVM_HOST_TRIPLE=%{host_triple} \ -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \ -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ -DCLANG_LINK_CLANG_DYLIB:BOOL=ON \ From 9bdb5b0efcf8503f73f3fe66236a966472605eac03447413d479df35dcea2c71 Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Tue, 12 Apr 2022 20:48:21 +0000 Subject: [PATCH 8/9] - Fix trailing whitespace. OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=21 --- llvm13.changes | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm13.changes b/llvm13.changes index 4a38484..896e8fa 100644 --- a/llvm13.changes +++ b/llvm13.changes @@ -31,12 +31,12 @@ Sun Apr 3 13:42:27 UTC 2022 - Aaron Puchert ------------------------------------------------------------------- Wed Mar 9 17:53:48 UTC 2022 - Dirk Müller -- add llvm-rust-mangle-for-fastcall.patch for rust 1.59 +- Add llvm-rust-mangle-for-fastcall.patch for rust 1.59. ------------------------------------------------------------------- Sun Mar 6 21:24:55 UTC 2022 - Dirk Müller -- fix armv6hl cpu architecture typo +- Fix armv6hl cpu architecture typo. ------------------------------------------------------------------- Sat Feb 19 15:23:13 UTC 2022 - Aaron Puchert From 30fde1c80756061600d759b6067fc5265545b57c2b6cf7bc2de85286f50a404f Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Wed, 13 Apr 2022 00:39:52 +0000 Subject: [PATCH 9/9] - Check for armv6hl. OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm13?expand=0&rev=22 --- llvm13.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm13.spec b/llvm13.spec index 0212497..d636048 100644 --- a/llvm13.spec +++ b/llvm13.spec @@ -68,7 +68,7 @@ %bcond_without lld # Figure out the host triple. -%ifarch armv6l +%ifarch armv6hl # See https://build.opensuse.org/request/show/968066. %define host_cpu armv6kz %else