diff --git a/.gitignore b/.gitignore index d47670c..06bdd82 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/lld-8.0.1.src.tar.xz +SOURCES/lld-9.0.1.src.tar.xz diff --git a/.lld.metadata b/.lld.metadata index 814088a..bd049c0 100644 --- a/.lld.metadata +++ b/.lld.metadata @@ -1 +1 @@ -67d84c054c8b858d29389aa8ad47a25f632e4a3a SOURCES/lld-8.0.1.src.tar.xz +ef5f529adfb9b57b33c394641d7d5e2d1f1b5ff6 SOURCES/lld-9.0.1.src.tar.xz diff --git a/SOURCES/0001-lld-Prefer-using-the-newest-installed-python-version.patch b/SOURCES/0001-lld-Prefer-using-the-newest-installed-python-version.patch deleted file mode 100644 index c8499d2..0000000 --- a/SOURCES/0001-lld-Prefer-using-the-newest-installed-python-version.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 39ce39a20a0854380997df7912e739b6c348f8a1 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Thu, 30 Aug 2018 14:59:06 -0700 -Subject: [PATCH] [lld] Prefer using the newest installed python version rather - than 2.7 - -This only affects the lit tests, which seem to pass fine with python3. ---- - CMakeLists.txt | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 087377d..6e5f2a7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -56,7 +56,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - include(HandleLLVMOptions) - - if(LLVM_INCLUDE_TESTS) -- set(Python_ADDITIONAL_VERSIONS 2.7) - include(FindPythonInterp) - if(NOT PYTHONINTERP_FOUND) - message(FATAL_ERROR --- -1.8.3.1 - diff --git a/SOURCES/lit.lld-test.cfg.py b/SOURCES/lit.lld-test.cfg.py new file mode 100644 index 0000000..10d165b --- /dev/null +++ b/SOURCES/lit.lld-test.cfg.py @@ -0,0 +1,12 @@ +#Clear lld_tools_dir so we don't accidently pick up tools from somewhere else +config.lld_tools_dir = "" + +if hasattr(config, 'have_zlib'): + # Regression tests write output to this directory, so we need to be able to specify + # a temp directory when invoking lit. e.g. lit -Dlld_obj_root=/tmp/lit + config.lld_obj_root = "%(lld_obj_root)s" % lit_config.params + lit_config.load_config(config, '%(lld_test_root)s/lit.cfg.py' % lit_config.params) +else: + # For unit tests, llvm_obj_root is used to find the unit test binaries. + config.lld_obj_root = '%(lld_unittest_bindir)s' % lit_config.params + lit_config.load_config(config, '%(lld_test_root)s/Unit/lit.cfg.py' % lit_config.params) diff --git a/SOURCES/run-lit-tests b/SOURCES/run-lit-tests new file mode 100755 index 0000000..7b92d2e --- /dev/null +++ b/SOURCES/run-lit-tests @@ -0,0 +1,66 @@ +#!/bin/bash + +usage() { + cat << EOF +usage: `basename $0` [OPTIONS] + --threads NUM The number of threads to use for running tests. + --multilib-arch ARCH Use this option to test 32-bit libs/binaries on + 64-bit hosts. +EOF +} + +threads_arg='' + +while [ $# -gt 0 ]; do + case $1 in + --threads) + shift + threads_arg="--threads $1" + ;; + --multilib-arch) + shift + ARCH=$1 + ;; + * ) + echo "unknown option: $1" + echo "" + usage + exit 1 + ;; + esac + shift +done + +if [ `whoami` = "root" ]; then + echo "error: lld tests do not support running as root." + exit 1 +fi + +set -xe + +if [ -z "$ARCH" ]; then + ARCH=`rpm --eval '%_arch'` +fi + +case $ARCH in + arm) + ;& + i686) + LIB_DIR="/usr/lib/" + ;; + *) + LIB_DIR="/usr/lib64/" + ;; +esac + +cd $(mktemp -d) +ln -s /usr/include include +tar -xzf /usr/share/lld/src/test.tar.gz +ln -s $ARCH.site.cfg.py test/lit.site.cfg.py +ln -s $ARCH.site.cfg.py test/Unit/lit.site.cfg.py + +LD_LIBRARY_PATH=$LIB_DIR/lld:$LD_LIBRARY_PATH \ +lit -v -s $threads_arg test \ + -Dlld_obj_root=`pwd` \ + -Dlld_test_root=`pwd`/test \ + -Dlld_unittest_bindir=$LIB_DIR/lld diff --git a/SPECS/lld.spec b/SPECS/lld.spec index 87e8d70..94b1dee 100644 --- a/SPECS/lld.spec +++ b/SPECS/lld.spec @@ -1,30 +1,32 @@ -#%%global rc_ver 2 +#%%global rc_ver 3 +%global baserelease 1 %global lld_srcdir lld-%{version}%{?rc_ver:rc%{rc_ver}}.src +%global maj_ver 9 -# armv7lhl tests disabled because of arm issue, see https://koji.fedoraproject.org/koji/taskinfo?taskID=33660162 -%ifnarch i686 %{arm} -%global enable_test_pkg 1 -%endif +# Don't include unittests in automatic generation of provides or requires. +%global __provides_exclude_from ^%{_libdir}/lld/.*$ +%global __requires_exclude ^libgtest.*$ + +%bcond_with ld_alternative Name: lld -Version: 8.0.1 -Release: 1%{?rc_ver:.rc%{rc_ver}}%{?dist} +Version: %{maj_ver}.0.1 +Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist} Summary: The LLVM Linker License: NCSA URL: http://llvm.org -Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-%{rc_ver}}/%{lld_srcdir}.tar.xz +Source0: http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/%{lld_srcdir}.tar.xz +Source1: run-lit-tests +Source2: lit.lld-test.cfg.py Patch0: 0001-CMake-Check-for-gtest-headers-even-if-lit.py-is-not-.patch -Patch1: 0001-lld-Prefer-using-the-newest-installed-python-version.patch BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: llvm-devel = %{version} -%if 0%{?enable_test_pkg} BuildRequires: llvm-test = %{version} -%endif BuildRequires: ncurses-devel BuildRequires: zlib-devel BuildRequires: chrpath @@ -34,11 +36,19 @@ BuildRequires: python3-rpm-macros BuildRequires: python3-lit BuildRequires: llvm-googletest = %{version} +%if %{with ld_alternative} +Requires(post): %{_sbindir}/alternatives +Requires(preun): %{_sbindir}/alternatives +%endif + +Requires: lld-libs = %{version}-%{release} + %description The LLVM project linker. %package devel Summary: Libraries and header files for LLD +Requires: lld-libs = %{version}-%{release} %description devel This package contains library and header files needed to develop new native @@ -50,6 +60,16 @@ Summary: LLD shared libraries %description libs Shared libraries for LLD. +%package test +Summary: LLD regression tests +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: python3-lit +Requires: llvm-test(major) = %{maj_ver} +Requires: lld-libs = %{version}-%{release} + +%description test +LLVM regression tests. + %prep %autosetup -n %{name}-%{version}%{?rc_ver:rc%{rc_ver}}.src -p1 @@ -75,23 +95,77 @@ cd %{_target_platform} %make_build +# Build the unittests so we can install them. +%make_build lld-test-depends + %install + +%global lit_cfg test/%{_arch}.site.cfg.py +%global lit_unit_cfg test/Unit/%{_arch}.site.cfg.py +%global lit_lld_test_cfg_install_path %{_datadir}/lld/lit.lld-test.cfg.py + +# Generate lit config files. Strip off the last line that initiates the +# test run, so we can customize the configuration. +head -n -1 %{_target_platform}/test/lit.site.cfg.py >> %{lit_cfg} +head -n -1 %{_target_platform}/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg} + +# Patch lit config files to load custom config: +for f in %{lit_cfg} %{lit_unit_cfg}; do + echo "lit_config.load_config(config, '%{lit_lld_test_cfg_install_path}')" >> $f +done + +# Install test files +install -d %{buildroot}%{_datadir}/lld/src +cp %{SOURCE2} %{buildroot}%{_datadir}/lld/ + +tar -czf %{buildroot}%{_datadir}/lld/src/test.tar.gz test/ +install -d %{buildroot}%{_libexecdir}/tests/lld +cp %{SOURCE1} %{buildroot}%{_libexecdir}/tests/lld + +# Install unit test binaries +install -d %{buildroot}%{_libdir}/lld/ +cp -R %{_target_platform}/unittests %{buildroot}%{_libdir}/lld/ +rm -rf `find %{buildroot}%{_libdir}/lld/ -iname '*make*'` + +# Install gtest libraries +cp %{_target_platform}/%{_lib}/libgtest*so* %{buildroot}%{_libdir}/lld/ + +# Install libraries and binaries cd %{_target_platform} %make_install # Remove rpath chrpath --delete %{buildroot}%{_bindir}/* chrpath --delete %{buildroot}%{_libdir}/*.so* +chrpath --delete `find %{buildroot}%{_libdir}/lld/ -type f` + +%if %{with ld_alternative} +# Required when using update-alternatives: +# https://docs.fedoraproject.org/en-US/packaging-guidelines/Alternatives/ +touch %{buildroot}%{_bindir}/ld + +%post +%{_sbindir}/update-alternatives --install %{_bindir}/ld ld %{_bindir}/ld.lld 1 + +%postun +if [ $1 -eq 0 ] ; then + %{_sbindir}/update-alternatives --remove ld %{_bindir}/ld.lld +fi +%endif %check -%if 0%{?enable_test_pkg} +# armv7lhl tests disabled because of arm issue, see https://koji.fedoraproject.org/koji/taskinfo?taskID=33660162 +%ifnarch %{arm} make -C %{_target_platform} %{?_smp_mflags} check-lld %endif %ldconfig_scriptlets libs %files +%if %{with ld_alternative} +%ghost %{_bindir}/ld +%endif %{_bindir}/lld* %{_bindir}/ld.lld %{_bindir}/ld64.lld @@ -104,7 +178,31 @@ make -C %{_target_platform} %{?_smp_mflags} check-lld %files libs %{_libdir}/liblld*.so.* +%files test +%{_libexecdir}/tests/lld/ +%{_libdir}/lld/ +%{_datadir}/lld/src/test.tar.gz +%{_datadir}/lld/lit.lld-test.cfg.py + %changelog +* Thu Dec 19 2019 Tom Stellard -9.0.1-1 +- 9.0.1 Release + +* Fri Dec 13 2019 Tom Stellard - 9.0.0-5 +- Fix some rpmdiff errors + +* Fri Dec 13 2019 Tom Stellard - 9.0.0-4 +- Remove build artifacts installed with unittests + +* Thu Dec 05 2019 Tom Stellard - 9.0.0-3 +- Add lld-test package + +* Thu Nov 14 2019 Tom Stellard - 9.0.0-2 +- Add explicit lld-libs requires to fix rpmdiff errors + +* Thu Sep 26 2019 Tom Stellard - 9.0.0-1 +- 9.0.0 Release + * Thu Aug 1 2019 sguelton@redhat.com - 8.0.1-1 - 8.0.1 release