Enable make check
This commit is contained in:
		
							parent
							
								
									d1d1a069be
								
							
						
					
					
						commit
						059c998a88
					
				| @ -0,0 +1,47 @@ | |||||||
|  | From e5bdf4580677da063abe8d3880fbab9eaa7a7efe Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Tom Stellard <tstellar@redhat.com> | ||||||
|  | Date: Thu, 30 Aug 2018 08:53:56 -0700 | ||||||
|  | Subject: [PATCH] CMake: Check for gtest headers even if lit.py is not present | ||||||
|  | 
 | ||||||
|  | This makes it possible to build the unittests even withotu a full | ||||||
|  | checkout of the llvm source tree. | ||||||
|  | ---
 | ||||||
|  |  CMakeLists.txt | 15 +++++++++------ | ||||||
|  |  1 file changed, 9 insertions(+), 6 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/CMakeLists.txt b/CMakeLists.txt
 | ||||||
|  | index e2fbdbf..c9b2927 100644
 | ||||||
|  | --- a/CMakeLists.txt
 | ||||||
|  | +++ b/CMakeLists.txt
 | ||||||
|  | @@ -75,6 +75,15 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
 | ||||||
|  |        set(LLVM_UTILS_PROVIDED ON) | ||||||
|  |      endif() | ||||||
|  |   | ||||||
|  | +		# Check for gtest
 | ||||||
|  | +    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()
 | ||||||
|  | +
 | ||||||
|  | +		# Check for lit
 | ||||||
|  |      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) | ||||||
|  | @@ -84,12 +93,6 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
 | ||||||
|  |          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 | ||||||
|  | -- 
 | ||||||
|  | 1.8.3.1 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,38 @@ | |||||||
|  | From 5cfcd9ff4c1438e3865b9af03d5ff5abd5f1a7f6 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Tom Stellard <tstellar@redhat.com> | ||||||
|  | Date: Fri, 31 Aug 2018 09:58:52 -0700 | ||||||
|  | Subject: [PATCH] MachO: Fix out-of-bounds memory access in getString16 | ||||||
|  | 
 | ||||||
|  | This fixes the following tests when gcc is compiled with gcc8: | ||||||
|  | 
 | ||||||
|  | lld :: mach-o/do-not-emit-unwind-fde-arm64.yaml | ||||||
|  | lld :: mach-o/eh-frame-relocs-arm64.yaml | ||||||
|  | ---
 | ||||||
|  |  lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h | 11 +++++------ | ||||||
|  |  1 file changed, 5 insertions(+), 6 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
 | ||||||
|  | index 407bd9b..f0340a9 100644
 | ||||||
|  | --- a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
 | ||||||
|  | +++ b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
 | ||||||
|  | @@ -185,12 +185,11 @@ packRelocation(const Relocation &r, bool swap, bool isBigEndian) {
 | ||||||
|  |    return result; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | -inline StringRef getString16(const char s[16]) {
 | ||||||
|  | -  StringRef x = s;
 | ||||||
|  | -  if ( x.size() > 16 )
 | ||||||
|  | -    return x.substr(0, 16);
 | ||||||
|  | -  else
 | ||||||
|  | -    return x;
 | ||||||
|  | +static StringRef getString16(const char s[16]) {
 | ||||||
|  | +  // The StringRef(const char *) constructor passes the const char * to
 | ||||||
|  | +  // strlen(), so we can't use this constructor here, because if there is no
 | ||||||
|  | +  // null terminator in s, then strlen() will read past the end of the array.
 | ||||||
|  | +  return StringRef(s, strnlen(s, 16));
 | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  inline void setString16(StringRef str, char s[16]) { | ||||||
|  | -- 
 | ||||||
|  | 1.8.3.1 | ||||||
|  | 
 | ||||||
							
								
								
									
										95
									
								
								0001-lld-Add-missing-REQUIRES-to-tests.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								0001-lld-Add-missing-REQUIRES-to-tests.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,95 @@ | |||||||
|  | From 3b6223b0573aff553fc4424ca9d96c22f20ffd0a Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Tom Stellard <tstellar@redhat.com> | ||||||
|  | Date: Fri, 31 Aug 2018 10:04:13 -0700 | ||||||
|  | Subject: [PATCH] lld: Add missing REQUIRES to tests | ||||||
|  | 
 | ||||||
|  | ---
 | ||||||
|  |  test/COFF/guardcf-align.s       | 2 ++ | ||||||
|  |  test/ELF/icf13.s                | 2 ++ | ||||||
|  |  test/ELF/icf15.s                | 2 ++ | ||||||
|  |  test/ELF/icf16.s                | 2 ++ | ||||||
|  |  test/ELF/icf17.s                | 2 ++ | ||||||
|  |  test/ELF/lto/libcall-archive.ll | 2 ++ | ||||||
|  |  6 files changed, 12 insertions(+) | ||||||
|  | 
 | ||||||
|  | diff --git a/test/COFF/guardcf-align.s b/test/COFF/guardcf-align.s
 | ||||||
|  | index a0caabc..c7aea52 100644
 | ||||||
|  | --- a/test/COFF/guardcf-align.s
 | ||||||
|  | +++ b/test/COFF/guardcf-align.s
 | ||||||
|  | @@ -5,6 +5,8 @@
 | ||||||
|  |  # RUN:     %t.obj %T/guardcf-align-foobar.obj | ||||||
|  |  # RUN: llvm-readobj -coff-load-config %T/guardcf-align.exe | FileCheck %s | ||||||
|  |   | ||||||
|  | +# REQUIRES: x86_64
 | ||||||
|  | +
 | ||||||
|  |  # Check that the gfids table contains at least one entry that ends in 0 | ||||||
|  |  # and no entries that end in something other than 0. | ||||||
|  |  # CHECK: GuardFidTable [ | ||||||
|  | diff --git a/test/ELF/icf13.s b/test/ELF/icf13.s
 | ||||||
|  | index 2fe707f..7db915c 100644
 | ||||||
|  | --- a/test/ELF/icf13.s
 | ||||||
|  | +++ b/test/ELF/icf13.s
 | ||||||
|  | @@ -1,6 +1,8 @@
 | ||||||
|  |  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 | ||||||
|  |  # RUN: ld.lld -shared -z notext %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s | ||||||
|  |   | ||||||
|  | +# REQUIRES: x86_64
 | ||||||
|  | +
 | ||||||
|  |  ## Check that ICF does not merge sections which relocations point to symbols | ||||||
|  |  ## that are not of the regular defined kind.  | ||||||
|  |   | ||||||
|  | diff --git a/test/ELF/icf15.s b/test/ELF/icf15.s
 | ||||||
|  | index 57c1735..9b125fa 100644
 | ||||||
|  | --- a/test/ELF/icf15.s
 | ||||||
|  | +++ b/test/ELF/icf15.s
 | ||||||
|  | @@ -1,6 +1,8 @@
 | ||||||
|  |  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 | ||||||
|  |  # RUN: ld.lld %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s | ||||||
|  |   | ||||||
|  | +# REQUIRES: x86_64
 | ||||||
|  | +
 | ||||||
|  |  ## Check that ICF does not merge sections which relocations have equal addends, | ||||||
|  |  ## but different target values. | ||||||
|  |   | ||||||
|  | diff --git a/test/ELF/icf16.s b/test/ELF/icf16.s
 | ||||||
|  | index e7650af..f054c74 100644
 | ||||||
|  | --- a/test/ELF/icf16.s
 | ||||||
|  | +++ b/test/ELF/icf16.s
 | ||||||
|  | @@ -1,6 +1,8 @@
 | ||||||
|  |  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 | ||||||
|  |  # RUN: ld.lld -shared -z notext %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s | ||||||
|  |   | ||||||
|  | +# REQUIRES: x86_64
 | ||||||
|  | +
 | ||||||
|  |  ## ICF is able to merge sections which relocations referring regular input sections | ||||||
|  |  ## or mergeable sections. .eh_frame is represented with a different kind of section, | ||||||
|  |  ## here we check that ICF code is able to handle and will not merge sections which | ||||||
|  | diff --git a/test/ELF/icf17.s b/test/ELF/icf17.s
 | ||||||
|  | index 5d28aeb..697bd75 100644
 | ||||||
|  | --- a/test/ELF/icf17.s
 | ||||||
|  | +++ b/test/ELF/icf17.s
 | ||||||
|  | @@ -1,6 +1,8 @@
 | ||||||
|  |  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 | ||||||
|  |  # RUN: ld.lld %t1 -o /dev/null --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s | ||||||
|  |   | ||||||
|  | +# REQUIRES: x86_64
 | ||||||
|  | +
 | ||||||
|  |  # CHECK-NOT: selected | ||||||
|  |   | ||||||
|  |  .section .text | ||||||
|  | diff --git a/test/ELF/lto/libcall-archive.ll b/test/ELF/lto/libcall-archive.ll
 | ||||||
|  | index 731e259..920b3ed 100644
 | ||||||
|  | --- a/test/ELF/lto/libcall-archive.ll
 | ||||||
|  | +++ b/test/ELF/lto/libcall-archive.ll
 | ||||||
|  | @@ -5,6 +5,8 @@
 | ||||||
|  |  ; RUN: ld.lld -o %t %t.o %t.a | ||||||
|  |  ; RUN: llvm-nm %t | FileCheck %s | ||||||
|  |   | ||||||
|  | +; REQUIRES: x86_64
 | ||||||
|  | +
 | ||||||
|  |  ; CHECK: T _start | ||||||
|  |  ; CHECK: T memcpy | ||||||
|  |   | ||||||
|  | -- 
 | ||||||
|  | 1.8.3.1 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,26 @@ | |||||||
|  | From 39ce39a20a0854380997df7912e739b6c348f8a1 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Tom Stellard <tstellar@redhat.com> | ||||||
|  | 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 | ||||||
|  | 
 | ||||||
							
								
								
									
										26
									
								
								lld.spec
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								lld.spec
									
									
									
									
									
								
							| @ -4,13 +4,18 @@ | |||||||
| 
 | 
 | ||||||
| Name:		lld | Name:		lld | ||||||
| Version:	7.0.0 | Version:	7.0.0 | ||||||
| Release:	0.1.rc%{rc_ver}%{?dist} | Release:	0.2.rc%{rc_ver}%{?dist} | ||||||
| Summary:	The LLVM Linker | Summary:	The LLVM Linker | ||||||
| 
 | 
 | ||||||
| License:	NCSA | License:	NCSA | ||||||
| URL:		http://llvm.org | URL:		http://llvm.org | ||||||
| Source0:	http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/%{lld_srcdir}.tar.xz | Source0:	http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/%{lld_srcdir}.tar.xz | ||||||
| 
 | 
 | ||||||
|  | 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 | ||||||
|  | Patch2:		0001-lld-Add-missing-REQUIRES-to-tests.patch | ||||||
|  | Patch3:		0001-MachO-Fix-out-of-bounds-memory-access-in-getString16.patch | ||||||
|  | 
 | ||||||
| BuildRequires:  gcc | BuildRequires:  gcc | ||||||
| BuildRequires:  gcc-c++ | BuildRequires:  gcc-c++ | ||||||
| BuildRequires: cmake | BuildRequires: cmake | ||||||
| @ -19,6 +24,10 @@ BuildRequires: ncurses-devel | |||||||
| BuildRequires: zlib-devel | BuildRequires: zlib-devel | ||||||
| BuildRequires: chrpath | BuildRequires: chrpath | ||||||
| 
 | 
 | ||||||
|  | # For make check: | ||||||
|  | BuildRequires: python3-lit | ||||||
|  | BuildRequires: llvm-googletest | ||||||
|  | 
 | ||||||
| %description | %description | ||||||
| The LLVM project linker. | The LLVM project linker. | ||||||
| 
 | 
 | ||||||
| @ -46,6 +55,14 @@ cd %{_target_platform} | |||||||
| %cmake .. \ | %cmake .. \ | ||||||
| 	-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ | 	-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ | ||||||
| 	-DLLVM_DYLIB_COMPONENTS="all" \ | 	-DLLVM_DYLIB_COMPONENTS="all" \ | ||||||
|  | 	-DLLVM_INCLUDE_TESTS=ON \ | ||||||
|  | 	-DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \ | ||||||
|  | 	-DLLVM_EXTERNAL_LIT=%{_bindir}/lit \ | ||||||
|  | 	-DLLVM_LIT_ARGS="-sv \ | ||||||
|  | 		-DFileCheck=%{_libdir}/llvm/FileCheck \ | ||||||
|  | 		-Dcount=%{_libdir}/llvm/count \ | ||||||
|  | 		-Dnot=%{_libdir}/llvm/not \ | ||||||
|  | 		--path %{_libdir}/llvm" \ | ||||||
| %if 0%{?__isa_bits} == 64 | %if 0%{?__isa_bits} == 64 | ||||||
| 	-DLLVM_LIBDIR_SUFFIX=64 | 	-DLLVM_LIBDIR_SUFFIX=64 | ||||||
| %else | %else | ||||||
| @ -63,9 +80,7 @@ chrpath --delete %{buildroot}%{_bindir}/* | |||||||
| chrpath --delete %{buildroot}%{_libdir}/*.so* | chrpath --delete %{buildroot}%{_libdir}/*.so* | ||||||
| 
 | 
 | ||||||
| %check | %check | ||||||
| # Need to install llvm utils for check to pass | make -C %{_target_platform} %{?_smp_mflags} check-lld | ||||||
| #cd _build |  | ||||||
| #make %{?_smp_mflags} check-lld |  | ||||||
| 
 | 
 | ||||||
| %post libs -p /sbin/ldconfig | %post libs -p /sbin/ldconfig | ||||||
| %postun libs -p /sbin/ldconfig | %postun libs -p /sbin/ldconfig | ||||||
| @ -84,6 +99,9 @@ chrpath --delete %{buildroot}%{_libdir}/*.so* | |||||||
| %{_libdir}/liblld*.so.* | %{_libdir}/liblld*.so.* | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Thu Aug 30 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.2.rc1 | ||||||
|  | - Enable make check | ||||||
|  | 
 | ||||||
| * Mon Aug 13 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.1.rc1 | * Mon Aug 13 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.1.rc1 | ||||||
| - 7.0.0-rc1 Release | - 7.0.0-rc1 Release | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user