diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-03-06 19:44:50 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-03-06 23:18:14 +0100 |
commit | 1570c90b2c8294194794670419ec91b2c8b3da04 (patch) | |
tree | b9dbd9fa302f76f265a502a713942ecd41ec3648 /sys-devel/lld | |
parent | dev-ml/llvm-ocaml: Bump to 4.0.0rc3 (diff) | |
download | gentoo-1570c90b2c8294194794670419ec91b2c8b3da04.tar.gz gentoo-1570c90b2c8294194794670419ec91b2c8b3da04.tar.bz2 gentoo-1570c90b2c8294194794670419ec91b2c8b3da04.zip |
sys-devel/lld: Bump to 4.0.0rc3, fix tests
Diffstat (limited to 'sys-devel/lld')
-rw-r--r-- | sys-devel/lld/Manifest | 4 | ||||
-rw-r--r-- | sys-devel/lld/files/4.0.0/0001-cmake-Support-running-tests-in-stand-alone-builds.patch | 160 | ||||
-rw-r--r-- | sys-devel/lld/files/4.0.0/0002-test-Use-LLD-specific-binary-library-dirs-when-build.patch | 97 | ||||
-rw-r--r-- | sys-devel/lld/files/4.0.0/0003-test-Fix-zlib-cond-when-building-stand-alone-clean-u.patch | 82 | ||||
-rw-r--r-- | sys-devel/lld/lld-4.0.0_rc3.ebuild (renamed from sys-devel/lld/lld-4.0.0_rc2.ebuild) | 12 |
5 files changed, 350 insertions, 5 deletions
diff --git a/sys-devel/lld/Manifest b/sys-devel/lld/Manifest index cfedfe9ca386..03405ac6d902 100644 --- a/sys-devel/lld/Manifest +++ b/sys-devel/lld/Manifest @@ -1,2 +1,2 @@ -DIST lld-4.0.0rc2.src.tar.xz 592856 SHA256 37381d14b13fee27bffef0b6d2650d82c79d69100385f6fa181a0034c2aa9b90 SHA512 49740da609df0416a8d69b0188ab89a90f8e9a90f1c75a2651f0d26a179a3b1d4412f0ed2fda707ee83a9cbc3a8098d7cc1478da3cfb19626e3da82026b03f15 WHIRLPOOL 4c31f0141e6d95275ed5d1762db72b0c45da3eb40e2d5415a9745f0cdd80686820a257bd3b0a1f9a49d0d38126154c1213cf3e8a795414c2c3f68c995538076e -DIST llvm-4.0.0rc2.src.tar.xz 21005416 SHA256 2257faed3795fedfc509d6dd5905be158231c508c6fcaaa02e4a09c5e8dadbe1 SHA512 537356226123b8c9454ec3dfc3adbfb13cfa4bd35f530b85f2b3242391ea1fbd9abf65dfbb62db533e6eae4c9049bb260fb21dccfeb7e355306f4621d35474b7 WHIRLPOOL d79f343ca00c60dd49a3ada4808e779c45210ab03e365e614563b54879ac72b7e80b4022641db10ad2075a0d417ba7c182f9d3abf8c6b012622c0d1541a7dc69 +DIST lld-4.0.0rc3.src.tar.xz 592796 SHA256 851c9f5f4fa8834f0e7deff5ddbce314fe0dfdfc4c1ee41f37c711e7e3b9be4e SHA512 99e00b06b08aa2a5be83a18dec910869d9468c433f216082f9d226236b653165bf13a82f1db004c28213e257500343c938490efae7b218dd3cc60200c2144923 WHIRLPOOL 4651fc099634fc39eaf39a7d5bc4821e0d6075d1ebac99dd677341e129868f832b96a2e0d4728e24042519f389414bf57cc76f48c4e5615b7ac25b962e551ca4 +DIST llvm-4.0.0rc3.src.tar.xz 21013952 SHA256 6727c98f436581adc6b8f9c2ad055d8e27832f60a127e97b3451eba85ef28345 SHA512 a64eaf59388be6641b6d654ceddd63232f83ad50226204255a0c9bcc3d1b36470f7acbf43615b2bd9758cd6077f55fc6155803a12947e1bd2be5661e1ff07e4a WHIRLPOOL 7aef4913c8a33ff0e35670063cb26ddd5d7b72cb08c699116dd93c72f25b6b75187bdf6bfd63b3d3b5c964c118c2db71893024524b864412f4f8daa594be7faa diff --git a/sys-devel/lld/files/4.0.0/0001-cmake-Support-running-tests-in-stand-alone-builds.patch b/sys-devel/lld/files/4.0.0/0001-cmake-Support-running-tests-in-stand-alone-builds.patch new file mode 100644 index 000000000000..e61801a70d52 --- /dev/null +++ b/sys-devel/lld/files/4.0.0/0001-cmake-Support-running-tests-in-stand-alone-builds.patch @@ -0,0 +1,160 @@ +From b06a494b5a8cbacfa3ce34106a8aaba10c0e7948 Mon Sep 17 00:00:00 2001 +From: Michal Gorny <mgorny@gentoo.org> +Date: Tue, 31 Jan 2017 14:10:20 +0000 +Subject: [PATCH 1/3] [cmake] Support running tests in stand-alone builds + +Add the CMake bits necessary to run lld tests (and unittests) when +building stand-alone. The code is based on the equivalent code in clang, +and includes: + +1. checking for Python, searching for lit and necessary LLVM test tools +(FileCount and not), + +2. building LLVM test tools (FileCount and not) from LLVM sources if +they are not installed, + +3. building gtest libraries from LLVM sources, + +4. adjusting dependencies so that test targets depend only on those LLVM +targets that are available for a particular variant of stand-alone +build. + +With this patch, I am able to successfully run 1002 (+10 unsupported) +lit tests on Gentoo using installed LLVM. + +Differential Revision: https://reviews.llvm.org/D28750 + +git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@293630 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + CMakeLists.txt | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++- + test/CMakeLists.txt | 16 ++++++++----- + 2 files changed, 77 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index be424efbb..7fcb1a748 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,8 +11,11 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH") + endif() + +- execute_process(COMMAND "${LLVM_CONFIG_PATH}" "--obj-root" "--includedir" ++ execute_process(COMMAND "${LLVM_CONFIG_PATH}" ++ "--obj-root" ++ "--includedir" + "--cmakedir" ++ "--src-root" + RESULT_VARIABLE HAD_ERROR + OUTPUT_VARIABLE LLVM_CONFIG_OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE) +@@ -25,9 +28,11 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + list(GET LLVM_CONFIG_OUTPUT 0 OBJ_ROOT) + list(GET LLVM_CONFIG_OUTPUT 1 MAIN_INCLUDE_DIR) + list(GET LLVM_CONFIG_OUTPUT 2 LLVM_CMAKE_PATH) ++ list(GET LLVM_CONFIG_OUTPUT 3 MAIN_SRC_DIR) + + set(LLVM_OBJ_ROOT ${OBJ_ROOT} CACHE PATH "path to LLVM build tree") + set(LLVM_MAIN_INCLUDE_DIR ${MAIN_INCLUDE_DIR} CACHE PATH "path to llvm/include") ++ set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") + + file(TO_CMAKE_PATH ${LLVM_OBJ_ROOT} LLVM_BINARY_DIR) + +@@ -49,6 +54,67 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + include(AddLLVM) + include(TableGen) + include(HandleLLVMOptions) ++ ++ if(LLVM_INCLUDE_TESTS) ++ set(Python_ADDITIONAL_VERSIONS 2.7) ++ include(FindPythonInterp) ++ if(NOT PYTHONINTERP_FOUND) ++ message(FATAL_ERROR ++"Unable to find Python interpreter, required for testing. ++ ++Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") ++ endif() ++ ++ if(${PYTHON_VERSION_STRING} VERSION_LESS 2.7) ++ message(FATAL_ERROR "Python 2.7 or newer is required") ++ endif() ++ ++ # Check prebuilt llvm/utils. ++ if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX} ++ AND EXISTS ${LLVM_TOOLS_BINARY_DIR}/not${CMAKE_EXECUTABLE_SUFFIX}) ++ set(LLVM_UTILS_PROVIDED ON) ++ endif() ++ ++ if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) ++ # Note: path not really used, except for checking if lit was found ++ set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) ++ if(NOT LLVM_UTILS_PROVIDED) ++ add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/FileCheck utils/FileCheck) ++ add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/not utils/not) ++ set(LLVM_UTILS_PROVIDED ON) ++ set(LLD_TEST_DEPS FileCheck not) ++ endif() ++ set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) ++ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h ++ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} ++ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) ++ add_subdirectory(${UNITTEST_DIR} utils/unittest) ++ endif() ++ else() ++ # Seek installed Lit. ++ find_program(LLVM_LIT ++ NAMES llvm-lit lit.py lit ++ PATHS "${LLVM_MAIN_SRC_DIR}/utils/lit" ++ DOC "Path to lit.py") ++ endif() ++ ++ if(LLVM_LIT) ++ # Define the default arguments to use with 'lit', and an option for the user ++ # to override. ++ set(LIT_ARGS_DEFAULT "-sv") ++ if (MSVC OR XCODE) ++ set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar") ++ endif() ++ set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit") ++ ++ # On Win32 hosts, provide an option to specify the path to the GnuWin32 tools. ++ if(WIN32 AND NOT CYGWIN) ++ set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools") ++ endif() ++ else() ++ set(LLVM_INCLUDE_TESTS OFF) ++ endif() ++ endif() + endif() + + set(LLD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 678880b7f..ede92c13d 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -19,13 +19,17 @@ configure_lit_site_cfg( + ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg + ) + +-set(LLD_TEST_DEPS +- FileCheck not llvm-ar llvm-as llvm-dis llvm-dwarfdump llvm-nm +- llc lld llvm-config llvm-objdump llvm-readobj yaml2obj obj2yaml +- llvm-mc llvm-lib llvm-pdbdump opt +- ) ++set(LLD_TEST_DEPS lld) ++if (NOT LLD_BUILT_STANDALONE) ++ list(APPEND LLD_TEST_DEPS ++ FileCheck not llvm-ar llvm-as llvm-dis llvm-dwarfdump llvm-nm ++ llc llvm-config llvm-objdump llvm-readobj yaml2obj obj2yaml ++ llvm-mc llvm-lib llvm-pdbdump opt ++ ) ++endif() ++ + if (LLVM_INCLUDE_TESTS) +- set(LLD_TEST_DEPS ${LLD_TEST_DEPS} LLDUnitTests) ++ list(APPEND LLD_TEST_DEPS LLDUnitTests) + endif() + + set(LLD_TEST_PARAMS +-- +2.12.0 + diff --git a/sys-devel/lld/files/4.0.0/0002-test-Use-LLD-specific-binary-library-dirs-when-build.patch b/sys-devel/lld/files/4.0.0/0002-test-Use-LLD-specific-binary-library-dirs-when-build.patch new file mode 100644 index 000000000000..2a7935f76838 --- /dev/null +++ b/sys-devel/lld/files/4.0.0/0002-test-Use-LLD-specific-binary-library-dirs-when-build.patch @@ -0,0 +1,97 @@ +From 72b099306f586382a32cb0b37ad6a07dc7cddcf9 Mon Sep 17 00:00:00 2001 +From: Michal Gorny <mgorny@gentoo.org> +Date: Wed, 8 Feb 2017 20:08:25 +0000 +Subject: [PATCH 2/3] [test] Use LLD-specific binary&library dirs when building + stand-alone + +Use both LLD- and LLVM-specific binary&library directories when LLD is +being built stand-alone. This ensures that the freshly built tools and +libraries are found and used correctly. + +Without this patch, the test suite uses LLVM_TOOLS_DIR and LLVM_LIBS_DIR +to locate lld, and set PATH and LD_LIBRARY_PATH. When doing +a stand-alone builds, these variables represent the installed LLVM. +As a result, tests either fail due to missing lld executables/libraries +or use an earlier installed LLD version rather than the one being built. + +To solve this, an additional LLD_TOOLS_DIR and LLD_LIBS_DIR variables +are added that are populated using LLVM_*_OUTPUT_INTDIR. Those variables +are populated with directories used to output built executables +and libraries. In stand-alone builds, they represent the directories +used by LLD. In integrated builds, they have the same values as +LLVM_*_DIR and therefore using them does not harm. + +The new variables are prepended to PATH and LD_LIBRARY_PATH to ensure +that freshly built binaries are preferred over potentially earlier +installed ones. Furthermore, the resulting PATH is used to locate tools +for substitutions since the search includes both tools built as part of +LLD and of LLVM. + +Differential Revision: https://reviews.llvm.org/D29335 + +git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@294507 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + test/lit.cfg | 14 ++++++++++---- + test/lit.site.cfg.in | 2 ++ + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/test/lit.cfg b/test/lit.cfg +index 0db879312..8dff2fb4e 100644 +--- a/test/lit.cfg ++++ b/test/lit.cfg +@@ -66,18 +66,24 @@ config.llvm_obj_root = getattr(config, 'llvm_obj_root', None) + + # Tweak the PATH to include the tools dir and the scripts dir. + if lld_obj_root is not None: ++ lld_tools_dir = getattr(config, 'lld_tools_dir', None) ++ if not lld_tools_dir: ++ lit_config.fatal('No LLD tools dir set!') + llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) + if not llvm_tools_dir: + lit_config.fatal('No LLVM tools dir set!') +- path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) ++ path = os.path.pathsep.join((lld_tools_dir, llvm_tools_dir, config.environment['PATH'])) + path = os.path.pathsep.join((os.path.join(getattr(config, 'llvm_src_root', None),'test','Scripts'),path)) + + config.environment['PATH'] = path + ++ lld_libs_dir = getattr(config, 'lld_libs_dir', None) ++ if not lld_libs_dir: ++ lit_config.fatal('No LLD libs dir set!') + llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) + if not llvm_libs_dir: + lit_config.fatal('No LLVM libs dir set!') +- path = os.path.pathsep.join((llvm_libs_dir, ++ path = os.path.pathsep.join((lld_libs_dir, llvm_libs_dir, + config.environment.get('LD_LIBRARY_PATH',''))) + config.environment['LD_LIBRARY_PATH'] = path + +@@ -174,10 +180,10 @@ for pattern in tool_patterns: + pattern) + tool_pipe = tool_match.group(2) + tool_name = tool_match.group(4) +- tool_path = lit.util.which(tool_name, llvm_tools_dir) ++ tool_path = lit.util.which(tool_name, config.environment['PATH']) + if not tool_path: + # Warn, but still provide a substitution. +- lit_config.note('Did not find ' + tool_name + ' in ' + llvm_tools_dir) ++ lit_config.note('Did not find ' + tool_name + ' in ' + path) + tool_path = llvm_tools_dir + '/' + tool_name + config.substitutions.append((pattern, tool_pipe + tool_path)) + +diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in +index 5293f24c1..9dcb48174 100644 +--- a/test/lit.site.cfg.in ++++ b/test/lit.site.cfg.in +@@ -6,6 +6,8 @@ config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" + config.llvm_libs_dir = "@LLVM_LIBS_DIR@" + config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" + config.lld_obj_root = "@LLD_BINARY_DIR@" ++config.lld_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@" ++config.lld_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@" + config.target_triple = "@TARGET_TRIPLE@" + config.python_executable = "@PYTHON_EXECUTABLE@" + config.have_zlib = "@HAVE_LIBZ@" +-- +2.12.0 + diff --git a/sys-devel/lld/files/4.0.0/0003-test-Fix-zlib-cond-when-building-stand-alone-clean-u.patch b/sys-devel/lld/files/4.0.0/0003-test-Fix-zlib-cond-when-building-stand-alone-clean-u.patch new file mode 100644 index 000000000000..b1333ac40bc9 --- /dev/null +++ b/sys-devel/lld/files/4.0.0/0003-test-Fix-zlib-cond-when-building-stand-alone-clean-u.patch @@ -0,0 +1,82 @@ +From a7fe305520085cff8e4bec0110d323c4f1ccbcab Mon Sep 17 00:00:00 2001 +From: Michal Gorny <mgorny@gentoo.org> +Date: Wed, 8 Feb 2017 20:08:29 +0000 +Subject: [PATCH 3/3] [test] Fix zlib cond when building stand-alone, clean up + +Fix the test zlib conditional to use LLVM_ENABLE_ZLIB value when +building stand-alone. The HAVE_LIBZ is not available when performing +a stand-alone build. Since the zlib support is a feature of +the underlying LLVM library, it exports the actual status as the final +value of LLVM_ENABLE_ZLIB in LLVMConfig. + +While at it, canonicalize the boolean value into 0/1 and remove unused +CMake definitions (most likely copied from clang). + +Differential Revision: https://reviews.llvm.org/D29340 + +git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@294508 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + test/CMakeLists.txt | 19 ++++++++++++------- + test/lit.cfg | 2 +- + test/lit.site.cfg.in | 2 +- + 3 files changed, 14 insertions(+), 9 deletions(-) + +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index ede92c13d..962274160 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -3,13 +3,18 @@ set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}") + set(LLVM_BUILD_MODE "%(build_mode)s") + set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s") + set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/%(build_config)s") +-set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") +-set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..") +-if(BUILD_SHARED_LIBS) +- set(ENABLE_SHARED 1) +-else() +- set(ENABLE_SHARED 0) +-endif(BUILD_SHARED_LIBS) ++ ++if(LLD_BUILT_STANDALONE) ++ # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This ++ # value is forced to 0 if zlib was not found, so it is fine to use it ++ # instead of HAVE_LIBZ (not recorded). ++ if(LLVM_ENABLE_ZLIB) ++ set(HAVE_LIBZ 1) ++ endif() ++endif() ++ ++llvm_canonicalize_cmake_booleans( ++ HAVE_LIBZ) + + configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in +diff --git a/test/lit.cfg b/test/lit.cfg +index 8dff2fb4e..85469ff6f 100644 +--- a/test/lit.cfg ++++ b/test/lit.cfg +@@ -202,7 +202,7 @@ if execute_external: + config.available_features.add('shell') + + # zlib compression library +-if config.have_zlib == "1": ++if config.have_zlib: + config.available_features.add("zlib") + + # Running on Darwin OS +diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in +index 9dcb48174..1fb8d3690 100644 +--- a/test/lit.site.cfg.in ++++ b/test/lit.site.cfg.in +@@ -10,7 +10,7 @@ config.lld_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@" + config.lld_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@" + config.target_triple = "@TARGET_TRIPLE@" + config.python_executable = "@PYTHON_EXECUTABLE@" +-config.have_zlib = "@HAVE_LIBZ@" ++config.have_zlib = @HAVE_LIBZ@ + + # Support substitution of the tools and libs dirs with user parameters. This is + # used when we can't determine the tool dir at configuration time. +-- +2.12.0 + diff --git a/sys-devel/lld/lld-4.0.0_rc2.ebuild b/sys-devel/lld/lld-4.0.0_rc3.ebuild index f37c0c3db8bc..f0400e77e957 100644 --- a/sys-devel/lld/lld-4.0.0_rc2.ebuild +++ b/sys-devel/lld/lld-4.0.0_rc3.ebuild @@ -26,9 +26,6 @@ DEPEND="${RDEPEND} S=${WORKDIR}/${P/_/}.src -# TODO: fix test suite to build stand-alone -RESTRICT="test" - # least intrusive of all CMAKE_BUILD_TYPE=RelWithDebInfo @@ -49,6 +46,15 @@ src_unpack() { fi } +src_prepare() { + # backport stand-alone build test fixes from master + eapply "${FILESDIR}/4.0.0/0001-cmake-Support-running-tests-in-stand-alone-builds.patch" + eapply "${FILESDIR}/4.0.0/0002-test-Use-LLD-specific-binary-library-dirs-when-build.patch" + eapply "${FILESDIR}/4.0.0/0003-test-Fix-zlib-cond-when-building-stand-alone-clean-u.patch" + + eapply_user +} + src_configure() { local mycmakeargs=( -DBUILD_SHARED_LIBS=ON |