pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lld: Fixes for 3.8.1



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sun Oct 9 05:38:54 2016 +0200
Changeset:	ff64083e2afd7405ff1cb302a317b1dd04d00eb4

Modified Files:
	lld/PLIST
	lld/distinfo
	lld/patches/patch-CMakeLists.txt
Added Files:
	lld/patches/patch-cmake_modules_CheckAtomic.cmake

Log Message:
lld: Fixes for 3.8.1

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=ff64083e2afd7405ff1cb302a317b1dd04d00eb4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 lld/PLIST                                         |  83 ++++++++++------
 lld/distinfo                                      |   3 +-
 lld/patches/patch-CMakeLists.txt                  |  20 +---
 lld/patches/patch-cmake_modules_CheckAtomic.cmake | 111 ++++++++++++++++++++++
 4 files changed, 170 insertions(+), 47 deletions(-)

diffs:
diff --git a/lld/PLIST b/lld/PLIST
index 824ff7a..9deba4b 100644
--- a/lld/PLIST
+++ b/lld/PLIST
@@ -1,30 +1,53 @@
-@comment $NetBSD: PLIST,v 1.1 2016/09/12 22:49:23 kamil Exp $
-include/polly/Canonicalization.h
-include/polly/CodeGen/BlockGenerators.h
-include/polly/CodeGen/CodeGeneration.h
-include/polly/CodeGen/CodegenCleanup.h
-include/polly/CodeGen/IRBuilder.h
-include/polly/CodeGen/IslAst.h
-include/polly/CodeGen/IslExprBuilder.h
-include/polly/CodeGen/IslNodeBuilder.h
-include/polly/CodeGen/LoopGenerators.h
-include/polly/CodeGen/RuntimeDebugBuilder.h
-include/polly/CodeGen/Utils.h
-include/polly/Config/config.h
-include/polly/DependenceInfo.h
-include/polly/LinkAllPasses.h
-include/polly/Options.h
-include/polly/RegisterPasses.h
-include/polly/ScheduleOptimizer.h
-include/polly/ScopDetection.h
-include/polly/ScopDetectionDiagnostic.h
-include/polly/ScopInfo.h
-include/polly/ScopPass.h
-include/polly/Support/GICHelper.h
-include/polly/Support/SCEVAffinator.h
-include/polly/Support/SCEVValidator.h
-include/polly/Support/ScopHelper.h
-include/polly/Support/ScopLocation.h
-lib/LLVMPolly.so
-lib/libPolly.a
-lib/libPollyISL.a
+@comment $NetBSD$
+bin/ld.lld
+bin/lld
+bin/lld-link
+include/lld/Config/Version.h
+include/lld/Core/AbsoluteAtom.h
+include/lld/Core/Alias.h
+include/lld/Core/ArchiveLibraryFile.h
+include/lld/Core/Atom.h
+include/lld/Core/DefinedAtom.h
+include/lld/Core/Error.h
+include/lld/Core/File.h
+include/lld/Core/Instrumentation.h
+include/lld/Core/LLVM.h
+include/lld/Core/LinkingContext.h
+include/lld/Core/Node.h
+include/lld/Core/Parallel.h
+include/lld/Core/Pass.h
+include/lld/Core/PassManager.h
+include/lld/Core/Reader.h
+include/lld/Core/Reference.h
+include/lld/Core/Resolver.h
+include/lld/Core/STDExtras.h
+include/lld/Core/SharedLibraryAtom.h
+include/lld/Core/SharedLibraryFile.h
+include/lld/Core/Simple.h
+include/lld/Core/SymbolTable.h
+include/lld/Core/UndefinedAtom.h
+include/lld/Core/Writer.h
+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
diff --git a/lld/distinfo b/lld/distinfo
index 180ce46..3b5839a 100644
--- a/lld/distinfo
+++ b/lld/distinfo
@@ -4,7 +4,8 @@ SHA1 (lld-3.8.1.src.tar.xz) = f9dffb129f3a6c67d24425a470500b318702889b
 RMD160 (lld-3.8.1.src.tar.xz) = a89056ab90f85e9c4921945907a008cec4bf5ad8
 SHA512 (lld-3.8.1.src.tar.xz) = f006110c36e3784741d5e815af1c27e61648d1289156f3c3fba157d1d2287e34f191b23b5e5d72bd6eed50d13d0838d73198236ca39b4825975934ddb472de81
 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-cmake_modules_CheckAtomic.cmake) = 5be759652a046d6a8793ccc4f85820dd8225d96f
 SHA1 (patch-lib_ReaderWriter_ELF_ELFLinkingContext.cpp) = aaf74f7e23e4faf142f4c9c265a049bd7f22c660
 SHA1 (patch-lib_ReaderWriter_MachO_MachOLinkingContext.cpp) = d0eaafa96436a3269d21ee0543e18d1c30849965
diff --git a/lld/patches/patch-CMakeLists.txt b/lld/patches/patch-CMakeLists.txt
index aab6c9e..109eef5 100644
--- a/lld/patches/patch-CMakeLists.txt
+++ b/lld/patches/patch-CMakeLists.txt
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- CMakeLists.txt.orig	2016-01-07 00:14:09.000000000 +0000
 +++ CMakeLists.txt
-@@ -1,3 +1,130 @@
+@@ -1,3 +1,118 @@
 +cmake_minimum_required(VERSION 3.4.3)
 +
 +# 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}
 +    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")
 +  if(EXISTS ${LLVMCONFIG_FILE})
 +    list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
@@ -91,23 +91,11 @@ $NetBSD$
 +
 +  include(AddLLVM)
 +  include(HandleLLVMOptions)
-+  include(CheckAtomic)                                                                                                                                       
++  include(cmake/modules/CheckAtomic.cmake)
 +  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.
-+  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}")
 +                                                                                                                                                             
diff --git a/lld/patches/patch-cmake_modules_CheckAtomic.cmake b/lld/patches/patch-cmake_modules_CheckAtomic.cmake
new file mode 100644
index 0000000..668981e
--- /dev/null
+++ b/lld/patches/patch-cmake_modules_CheckAtomic.cmake
@@ -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()


Home | Main Index | Thread Index | Old Index