lld: Fixes for 3.8.1

This commit is contained in:
Kamil Rytarowski 2016-10-09 05:38:54 +02:00
parent 4b0d2605c7
commit ff64083e2a
4 changed files with 170 additions and 47 deletions

View file

@ -1,30 +1,53 @@
@comment $NetBSD: PLIST,v 1.1 2016/09/12 22:49:23 kamil Exp $ @comment $NetBSD$
include/polly/Canonicalization.h bin/ld.lld
include/polly/CodeGen/BlockGenerators.h bin/lld
include/polly/CodeGen/CodeGeneration.h bin/lld-link
include/polly/CodeGen/CodegenCleanup.h include/lld/Config/Version.h
include/polly/CodeGen/IRBuilder.h include/lld/Core/AbsoluteAtom.h
include/polly/CodeGen/IslAst.h include/lld/Core/Alias.h
include/polly/CodeGen/IslExprBuilder.h include/lld/Core/ArchiveLibraryFile.h
include/polly/CodeGen/IslNodeBuilder.h include/lld/Core/Atom.h
include/polly/CodeGen/LoopGenerators.h include/lld/Core/DefinedAtom.h
include/polly/CodeGen/RuntimeDebugBuilder.h include/lld/Core/Error.h
include/polly/CodeGen/Utils.h include/lld/Core/File.h
include/polly/Config/config.h include/lld/Core/Instrumentation.h
include/polly/DependenceInfo.h include/lld/Core/LLVM.h
include/polly/LinkAllPasses.h include/lld/Core/LinkingContext.h
include/polly/Options.h include/lld/Core/Node.h
include/polly/RegisterPasses.h include/lld/Core/Parallel.h
include/polly/ScheduleOptimizer.h include/lld/Core/Pass.h
include/polly/ScopDetection.h include/lld/Core/PassManager.h
include/polly/ScopDetectionDiagnostic.h include/lld/Core/Reader.h
include/polly/ScopInfo.h include/lld/Core/Reference.h
include/polly/ScopPass.h include/lld/Core/Resolver.h
include/polly/Support/GICHelper.h include/lld/Core/STDExtras.h
include/polly/Support/SCEVAffinator.h include/lld/Core/SharedLibraryAtom.h
include/polly/Support/SCEVValidator.h include/lld/Core/SharedLibraryFile.h
include/polly/Support/ScopHelper.h include/lld/Core/Simple.h
include/polly/Support/ScopLocation.h include/lld/Core/SymbolTable.h
lib/LLVMPolly.so include/lld/Core/UndefinedAtom.h
lib/libPolly.a include/lld/Core/Writer.h
lib/libPollyISL.a include/lld/Core/range.h
include/lld/Driver/Driver.h
include/lld/ReaderWriter/AtomLayout.h
include/lld/ReaderWriter/CoreLinkingContext.h
include/lld/ReaderWriter/ELFLinkingContext.h
include/lld/ReaderWriter/LinkerScript.h
include/lld/ReaderWriter/MachOLinkingContext.h
include/lld/ReaderWriter/YamlContext.h
lib/liblldAArch64ELFTarget.a
lib/liblldARMELFTarget.a
lib/liblldCOFF.a
lib/liblldConfig.a
lib/liblldCore.a
lib/liblldDriver.a
lib/liblldELF.a
lib/liblldELF2.a
lib/liblldExampleSubTarget.a
lib/liblldHexagonELFTarget.a
lib/liblldMachO.a
lib/liblldMipsELFTarget.a
lib/liblldReaderWriter.a
lib/liblldX86ELFTarget.a
lib/liblldX86_64ELFTarget.a
lib/liblldYAML.a

View file

@ -4,7 +4,8 @@ SHA1 (lld-3.8.1.src.tar.xz) = f9dffb129f3a6c67d24425a470500b318702889b
RMD160 (lld-3.8.1.src.tar.xz) = a89056ab90f85e9c4921945907a008cec4bf5ad8 RMD160 (lld-3.8.1.src.tar.xz) = a89056ab90f85e9c4921945907a008cec4bf5ad8
SHA512 (lld-3.8.1.src.tar.xz) = f006110c36e3784741d5e815af1c27e61648d1289156f3c3fba157d1d2287e34f191b23b5e5d72bd6eed50d13d0838d73198236ca39b4825975934ddb472de81 SHA512 (lld-3.8.1.src.tar.xz) = f006110c36e3784741d5e815af1c27e61648d1289156f3c3fba157d1d2287e34f191b23b5e5d72bd6eed50d13d0838d73198236ca39b4825975934ddb472de81
Size (lld-3.8.1.src.tar.xz) = 632288 bytes Size (lld-3.8.1.src.tar.xz) = 632288 bytes
SHA1 (patch-CMakeLists.txt) = 46beb1b16c90fd568104d3d0e86ed9fbe049edb7 SHA1 (patch-CMakeLists.txt) = eec1be7944252c52a05965b49dd3199a696a79ce
SHA1 (patch-ELF_CMakeLists.txt) = bd14969a524e83df98908f26dab448ea250b21f9 SHA1 (patch-ELF_CMakeLists.txt) = bd14969a524e83df98908f26dab448ea250b21f9
SHA1 (patch-cmake_modules_CheckAtomic.cmake) = 5be759652a046d6a8793ccc4f85820dd8225d96f
SHA1 (patch-lib_ReaderWriter_ELF_ELFLinkingContext.cpp) = aaf74f7e23e4faf142f4c9c265a049bd7f22c660 SHA1 (patch-lib_ReaderWriter_ELF_ELFLinkingContext.cpp) = aaf74f7e23e4faf142f4c9c265a049bd7f22c660
SHA1 (patch-lib_ReaderWriter_MachO_MachOLinkingContext.cpp) = d0eaafa96436a3269d21ee0543e18d1c30849965 SHA1 (patch-lib_ReaderWriter_MachO_MachOLinkingContext.cpp) = d0eaafa96436a3269d21ee0543e18d1c30849965

View file

@ -2,7 +2,7 @@ $NetBSD$
--- CMakeLists.txt.orig 2016-01-07 00:14:09.000000000 +0000 --- CMakeLists.txt.orig 2016-01-07 00:14:09.000000000 +0000
+++ CMakeLists.txt +++ CMakeLists.txt
@@ -1,3 +1,130 @@ @@ -1,3 +1,118 @@
+cmake_minimum_required(VERSION 3.4.3) +cmake_minimum_required(VERSION 3.4.3)
+ +
+# If we are not building as a part of LLVM, build LLD as an +# If we are not building as a part of LLVM, build LLD as an
@ -70,7 +70,7 @@ $NetBSD$
+ find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} + find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
+ NO_DEFAULT_PATH) + NO_DEFAULT_PATH)
+ +
+ set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake") # this will change in 3.9.0
+ set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake") + set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
+ if(EXISTS ${LLVMCONFIG_FILE}) + if(EXISTS ${LLVMCONFIG_FILE})
+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") + list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
@ -91,23 +91,11 @@ $NetBSD$
+ +
+ include(AddLLVM) + include(AddLLVM)
+ include(HandleLLVMOptions) + include(HandleLLVMOptions)
+ include(CheckAtomic) + include(cmake/modules/CheckAtomic.cmake)
+ include(TableGen) + include(TableGen)
+ +
+ if (PYTHON_EXECUTABLE STREQUAL "")
+ set(Python_ADDITIONAL_VERSIONS 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5)
+ include(FindPythonInterp)
+ if( NOT PYTHONINTERP_FOUND )
+ message(FATAL_ERROR
+ "Unable to find Python interpreter, required for builds and testing.
+ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
+ endif()
+ else()
+ message("-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
+ endif()
+
+ # Import CMake library targets from LLVM and Clang. + # Import CMake library targets from LLVM and Clang.
+ include("${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm/LLVMConfig.cmake") + #include("${LLVM_CMAKE_PATH}/share/llvm/cmake/LLVMConfig.cmake")
+ +
+ set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") + set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
+ +

View file

@ -0,0 +1,111 @@
$NetBSD$
--- cmake/modules/CheckAtomic.cmake.orig 2016-10-09 03:38:58.827088427 +0000
+++ cmake/modules/CheckAtomic.cmake
@@ -0,0 +1,106 @@
+# atomic builtins are required for threading support.
+
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+
+function(check_working_cxx_atomics varname)
+ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+ CHECK_CXX_SOURCE_COMPILES("
+#include <atomic>
+std::atomic<int> x;
+int main() {
+ return x;
+}
+" ${varname})
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_working_cxx_atomics)
+
+function(check_working_cxx_atomics64 varname)
+ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}")
+ CHECK_CXX_SOURCE_COMPILES("
+#include <atomic>
+#include <cstdint>
+std::atomic<uint64_t> x (0);
+int main() {
+ uint64_t i = x.load(std::memory_order_relaxed);
+ return 0;
+}
+" ${varname})
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_working_cxx_atomics64)
+
+
+# This isn't necessary on MSVC, so avoid command-line switch annoyance
+# by only running on GCC-like hosts.
+if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
+ # First check if atomics work without the library.
+ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
+ # If not, check if the library exists, and atomics work with it.
+ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
+ if( HAVE_LIBATOMIC )
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+ if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+ message(FATAL_ERROR "Host compiler must support std::atomic!")
+ endif()
+ else()
+ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
+ endif()
+ endif()
+endif()
+
+# Check for 64 bit atomic operations.
+if(MSVC)
+ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True)
+else()
+ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
+endif()
+
+# If not, check if the library exists, and atomics work with it.
+if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
+ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
+ if(HAVE_CXX_LIBATOMICS64)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB)
+ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB)
+ message(FATAL_ERROR "Host compiler must support std::atomic!")
+ endif()
+ else()
+ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
+ endif()
+endif()
+
+## TODO: This define is only used for the legacy atomic operations in
+## llvm's Atomic.h, which should be replaced. Other code simply
+## assumes C++11 <atomic> works.
+CHECK_CXX_SOURCE_COMPILES("
+#ifdef _MSC_VER
+#include <Intrin.h> /* Workaround for PR19898. */
+#include <windows.h>
+#endif
+int main() {
+#ifdef _MSC_VER
+ volatile LONG val = 1;
+ MemoryBarrier();
+ InterlockedCompareExchange(&val, 0, 1);
+ InterlockedIncrement(&val);
+ InterlockedDecrement(&val);
+#else
+ volatile unsigned long val = 1;
+ __sync_synchronize();
+ __sync_val_compare_and_swap(&val, 1, 0);
+ __sync_add_and_fetch(&val, 1);
+ __sync_sub_and_fetch(&val, 1);
+#endif
+ return 0;
+ }
+" LLVM_HAS_ATOMICS)
+
+if( NOT LLVM_HAS_ATOMICS )
+ message(STATUS "Warning: LLVM will be built thread-unsafe because atomic builtins are missing")
+endif()