diff options
author | tnn <tnn@pkgsrc.org> | 2019-01-26 21:17:20 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2019-01-26 21:17:20 +0000 |
commit | 4e22c3ebed54cd22403ade7dc28c9fc18818446a (patch) | |
tree | 94ce8ac540f7ecadc02be51d5a1629e862bca771 /lang/libLLVM/patches | |
parent | 72b3f10c3d5fb255e1df40dd8c86775c2edb967b (diff) | |
download | pkgsrc-4e22c3ebed54cd22403ade7dc28c9fc18818446a.tar.gz |
libLLVM: update to 7.0.1, adapted from lang/llvm
Diffstat (limited to 'lang/libLLVM/patches')
10 files changed, 157 insertions, 81 deletions
diff --git a/lang/libLLVM/patches/patch-CMakeLists.txt b/lang/libLLVM/patches/patch-CMakeLists.txt index c645d68601d..21de9fffea2 100644 --- a/lang/libLLVM/patches/patch-CMakeLists.txt +++ b/lang/libLLVM/patches/patch-CMakeLists.txt @@ -1,10 +1,20 @@ -$NetBSD: patch-CMakeLists.txt,v 1.1 2016/03/08 21:06:50 tnn Exp $ +$NetBSD: patch-CMakeLists.txt,v 1.2 2019/01/26 21:17:20 tnn Exp $ Put headers in subdirectory to avoid conflict with clang. +Don't implement sys/regset.h workaround, fix source instead. ---- CMakeLists.txt.orig 2016-01-13 19:03:44.000000000 +0000 +--- CMakeLists.txt.orig 2018-11-02 17:47:32.000000000 +0000 +++ CMakeLists.txt -@@ -728,7 +728,7 @@ add_subdirectory(cmake/modules) +@@ -830,7 +830,7 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "(Fre + + if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) + # special hack for Solaris to handle crazy system sys/regset.h +- include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris") ++ #include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris") + endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) + + # Make sure we don't get -rdynamic in every binary. For those that need it, +@@ -966,7 +966,7 @@ endif() if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(DIRECTORY include/llvm include/llvm-c @@ -13,10 +23,10 @@ Put headers in subdirectory to avoid conflict with clang. COMPONENT llvm-headers FILES_MATCHING PATTERN "*.def" -@@ -740,7 +740,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) +@@ -978,7 +978,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) ) - install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm + install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c - DESTINATION include + DESTINATION include/libLLVM COMPONENT llvm-headers diff --git a/lang/libLLVM/patches/patch-cmake_config-ix.cmake b/lang/libLLVM/patches/patch-cmake_config-ix.cmake new file mode 100644 index 00000000000..636fa2cdac0 --- /dev/null +++ b/lang/libLLVM/patches/patch-cmake_config-ix.cmake @@ -0,0 +1,15 @@ +$NetBSD: patch-cmake_config-ix.cmake,v 1.1 2019/01/26 21:17:20 tnn Exp $ + +Do not generate invalid llvm-config in pkgsrc. + +--- cmake/config-ix.cmake.orig 2018-01-02 17:53:08.000000000 +0000 ++++ cmake/config-ix.cmake +@@ -153,7 +153,7 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memor + endif() + if(LLVM_ENABLE_TERMINFO) + set(HAVE_TERMINFO 0) +- foreach(library tinfo terminfo curses ncurses ncursesw) ++ foreach(library terminfo curses ncurses ncursesw tinfo) + string(TOUPPER ${library} library_suffix) + check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix}) + if(HAVE_TERMINFO_${library_suffix}) diff --git a/lang/libLLVM/patches/patch-cmake_modules_AddLLVM.cmake b/lang/libLLVM/patches/patch-cmake_modules_AddLLVM.cmake index 02d4937a5c5..2f0a8f35093 100644 --- a/lang/libLLVM/patches/patch-cmake_modules_AddLLVM.cmake +++ b/lang/libLLVM/patches/patch-cmake_modules_AddLLVM.cmake @@ -1,22 +1,22 @@ -$NetBSD: patch-cmake_modules_AddLLVM.cmake,v 1.6 2017/12/08 02:14:44 gdt Exp $ +$NetBSD: patch-cmake_modules_AddLLVM.cmake,v 1.7 2019/01/26 21:17:20 tnn Exp $ Disable library install rules. Handled manually. Make sure llvm-config goes in libexec/libLLVM to avoid conflict. Don't use non-portable -z discard-unused on SunOS. ---- cmake/modules/AddLLVM.cmake.orig 2017-01-17 21:47:58.000000000 +0000 +--- cmake/modules/AddLLVM.cmake.orig 2018-08-01 07:51:55.000000000 +0000 +++ cmake/modules/AddLLVM.cmake -@@ -182,9 +182,6 @@ function(add_link_opts target_name) +@@ -218,9 +218,6 @@ function(add_link_opts target_name) # ld64's implementation of -dead_strip breaks tools that use plugins. set_property(TARGET ${target_name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-dead_strip") - elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set_property(TARGET ${target_name} APPEND_STRING PROPERTY - LINK_FLAGS " -Wl,-z -Wl,discard-unused=sections") - elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD) + elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") # Object files are compiled with -ffunction-data-sections. # Versions of bfd ld < 2.23.1 have a bug in --gc-sections that breaks -@@ -591,10 +588,6 @@ macro(add_llvm_library name) +@@ -654,11 +651,6 @@ macro(add_llvm_library name) set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) endif() @@ -24,10 +24,11 @@ Don't use non-portable -z discard-unused on SunOS. - ${export_to_llvmexports} - ${install_type} DESTINATION ${install_dir} - COMPONENT ${name}) - +- if (NOT CMAKE_CONFIGURATION_TYPES) - add_custom_target(install-${name} -@@ -632,10 +625,6 @@ macro(add_llvm_loadable_module name) + add_llvm_install_targets(install-${name} + DEPENDS ${name} +@@ -693,10 +685,6 @@ macro(add_llvm_loadable_module name) set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) endif() @@ -38,7 +39,7 @@ Don't use non-portable -z discard-unused on SunOS. endif() set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) endif() -@@ -823,7 +812,7 @@ macro(add_llvm_tool name) +@@ -887,7 +875,7 @@ macro(add_llvm_tool name) install(TARGETS ${name} ${export_to_llvmexports} @@ -47,12 +48,3 @@ Don't use non-portable -z discard-unused on SunOS. COMPONENT ${name}) if (NOT CMAKE_CONFIGURATION_TYPES) -@@ -864,7 +853,7 @@ macro(add_llvm_utility name) - set_target_properties(${name} PROPERTIES FOLDER "Utils") - if( LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS ) - install (TARGETS ${name} -- RUNTIME DESTINATION bin -+ RUNTIME DESTINATION libexec/libLLVM - COMPONENT ${name}) - if (NOT CMAKE_CONFIGURATION_TYPES) - add_custom_target(install-${name} diff --git a/lang/libLLVM/patches/patch-cmake_modules_CheckAtomic.cmake b/lang/libLLVM/patches/patch-cmake_modules_CheckAtomic.cmake new file mode 100644 index 00000000000..a1c5ced6f90 --- /dev/null +++ b/lang/libLLVM/patches/patch-cmake_modules_CheckAtomic.cmake @@ -0,0 +1,38 @@ +$NetBSD: patch-cmake_modules_CheckAtomic.cmake,v 1.1 2019/01/26 21:17:20 tnn Exp $ + +Omit check for native 8-byte atomics, platform may not have them, +and they are actually not required here. Makes powerpc build llvm. + +--- cmake/modules/CheckAtomic.cmake.orig 2016-06-23 06:39:35.000000000 +0000 ++++ cmake/modules/CheckAtomic.cmake +@@ -62,18 +62,18 @@ else() + 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() ++#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 diff --git a/lang/libLLVM/patches/patch-include_llvm-c_DataTypes.h b/lang/libLLVM/patches/patch-include_llvm-c_DataTypes.h new file mode 100644 index 00000000000..f78547faf93 --- /dev/null +++ b/lang/libLLVM/patches/patch-include_llvm-c_DataTypes.h @@ -0,0 +1,34 @@ +$NetBSD: patch-include_llvm-c_DataTypes.h,v 1.1 2019/01/26 21:17:20 tnn Exp $ + +Don't implement sys/regset.h workaround, fix source instead. + +--- include/llvm-c/DataTypes.h.orig 2018-04-02 13:22:26.000000000 +0000 ++++ include/llvm-c/DataTypes.h +@@ -87,4 +87,27 @@ typedef signed int ssize_t; + #define HUGE_VALF (float)HUGE_VAL + #endif + ++#if defined(__sun) ++#include <sys/regset.h> ++#undef CS ++#undef DS ++#undef ES ++#undef FS ++#undef GS ++#undef SS ++#undef EAX ++#undef ECX ++#undef EDX ++#undef EBX ++#undef ESP ++#undef EBP ++#undef ESI ++#undef EDI ++#undef EIP ++#undef UESP ++#undef EFL ++#undef ERR ++#undef TRAPNO ++#endif ++ + #endif /* LLVM_C_DATATYPES_H */ diff --git a/lang/libLLVM/patches/patch-include_llvm_Analysis_ConstantFolding.h b/lang/libLLVM/patches/patch-include_llvm_Analysis_ConstantFolding.h new file mode 100644 index 00000000000..6bdfcc5e568 --- /dev/null +++ b/lang/libLLVM/patches/patch-include_llvm_Analysis_ConstantFolding.h @@ -0,0 +1,17 @@ +$NetBSD: patch-include_llvm_Analysis_ConstantFolding.h,v 1.1 2019/01/26 21:17:20 tnn Exp $ + +Fix SunOS CS conflict not handled by include/llvm-c/DataTypes.h + +--- include/llvm/Analysis/ConstantFolding.h.orig 2018-05-01 15:54:18.000000000 +0000 ++++ include/llvm/Analysis/ConstantFolding.h +@@ -20,6 +20,10 @@ + #ifndef LLVM_ANALYSIS_CONSTANTFOLDING_H + #define LLVM_ANALYSIS_CONSTANTFOLDING_H + ++#ifdef __sun ++#undef CS ++#endif ++ + namespace llvm { + class APInt; + template <typename T> class ArrayRef; diff --git a/lang/libLLVM/patches/patch-include_llvm_Support_Host.h b/lang/libLLVM/patches/patch-include_llvm_Support_Host.h deleted file mode 100644 index 198b4b65261..00000000000 --- a/lang/libLLVM/patches/patch-include_llvm_Support_Host.h +++ /dev/null @@ -1,26 +0,0 @@ -$NetBSD: patch-include_llvm_Support_Host.h,v 1.5 2017/12/08 02:14:44 gdt Exp $ - -Fix lack of machine/endian.h on solaris -http://permalink.gmane.org/gmane.comp.compilers.llvm.devel/63225 - ---- include/llvm/Support/Host.h.orig 2016-10-13 17:43:20.000000000 +0000 -+++ include/llvm/Support/Host.h -@@ -20,6 +20,18 @@ - #include <endian.h> - #elif defined(_AIX) - #include <sys/machine.h> -+#elif defined(__sun) & defined(__SVR4) -+# ifndef BYTE_ORDER -+# define LITTLE_ENDIAN 1234 -+# define BIG_ENDIAN 4321 -+# include <sys/isa_defs.h> -+# ifdef _LITTLE_ENDIAN -+# define BYTE_ORDER LITTLE_ENDIAN -+# endif -+# ifdef _BIG_ENDIAN -+# define BYTE_ORDER BIG_ENDIAN -+# endif -+# endif /* BYTE_ORDER */ - #else - #if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32) - #include <machine/endian.h> diff --git a/lang/libLLVM/patches/patch-lib_Support_Unix_Program.inc b/lang/libLLVM/patches/patch-lib_Support_Unix_Program.inc deleted file mode 100644 index 05b43abbc10..00000000000 --- a/lang/libLLVM/patches/patch-lib_Support_Unix_Program.inc +++ /dev/null @@ -1,16 +0,0 @@ -$NetBSD: patch-lib_Support_Unix_Program.inc,v 1.3 2017/12/08 02:14:44 gdt Exp $ - -Remove bogus redefine. - ---- lib/Support/Unix/Program.inc.orig 2016-04-05 20:45:04.000000000 +0000 -+++ lib/Support/Unix/Program.inc -@@ -40,9 +40,6 @@ - #include <unistd.h> - #endif - #ifdef HAVE_POSIX_SPAWN --#ifdef __sun__ --#define _RESTRICT_KYWD --#endif - #include <spawn.h> - - #if defined(__APPLE__) diff --git a/lang/libLLVM/patches/patch-tools_llvm-config_llvm-config.cpp b/lang/libLLVM/patches/patch-tools_llvm-config_llvm-config.cpp index 1a8330a3e5a..f3d54cb687b 100644 --- a/lang/libLLVM/patches/patch-tools_llvm-config_llvm-config.cpp +++ b/lang/libLLVM/patches/patch-tools_llvm-config_llvm-config.cpp @@ -1,24 +1,26 @@ -$NetBSD: patch-tools_llvm-config_llvm-config.cpp,v 1.5 2017/12/08 02:14:44 gdt Exp $ +$NetBSD: patch-tools_llvm-config_llvm-config.cpp,v 1.6 2019/01/26 21:17:20 tnn Exp $ Avoid conflict with lang/clang. Use -lLLVM-3.8 instead of -lLLVM-3.8.0 so we don't break unnecessarily on patch updates. ---- tools/llvm-config/llvm-config.cpp.orig 2017-01-12 19:47:38.000000000 +0000 +--- tools/llvm-config/llvm-config.cpp.orig 2018-06-23 16:50:09.000000000 +0000 +++ tools/llvm-config/llvm-config.cpp -@@ -332,9 +332,9 @@ int main(int argc, char **argv) { +@@ -333,11 +333,11 @@ int main(int argc, char **argv) { ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include"); } else { ActivePrefix = CurrentExecPrefix; - ActiveIncludeDir = ActivePrefix + "/include"; + ActiveIncludeDir = "@PREFIX@/include/libLLVM"; - ActiveBinDir = ActivePrefix + "/bin"; + SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR)); + sys::fs::make_absolute(ActivePrefix, path); + ActiveBinDir = path.str(); - ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; + ActiveLibDir = "@PREFIX@/lib/libLLVM"; ActiveCMakeDir = ActiveLibDir + "/cmake/llvm"; ActiveIncludeOption = "-I" + ActiveIncludeDir; } -@@ -370,14 +370,14 @@ int main(int argc, char **argv) { +@@ -373,14 +373,14 @@ int main(int argc, char **argv) { StaticDir = ActiveLibDir; } else if (HostTriple.isOSDarwin()) { SharedExt = "dylib"; @@ -35,7 +37,7 @@ on patch updates. StaticExt = "a"; StaticDir = SharedDir = ActiveLibDir; StaticPrefix = SharedPrefix = "lib"; -@@ -390,7 +390,7 @@ int main(int argc, char **argv) { +@@ -393,7 +393,7 @@ int main(int argc, char **argv) { bool DyLibExists = false; const std::string DyLibName = @@ -44,7 +46,7 @@ on patch updates. // If LLVM_LINK_DYLIB is ON, the single shared library will be returned // for "--libs", etc, if they exist. This behaviour can be overridden with -@@ -491,7 +491,7 @@ int main(int argc, char **argv) { +@@ -494,7 +494,7 @@ int main(int argc, char **argv) { OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n'; } else if (Arg == "--ldflags") { OS << ((HostTriple.isWindowsMSVCEnvironment()) ? "-LIBPATH:" : "-L") diff --git a/lang/libLLVM/patches/patch-tools_llvm-shlib_CMakeLists.txt b/lang/libLLVM/patches/patch-tools_llvm-shlib_CMakeLists.txt index 34192880414..ab2c84cd3a9 100644 --- a/lang/libLLVM/patches/patch-tools_llvm-shlib_CMakeLists.txt +++ b/lang/libLLVM/patches/patch-tools_llvm-shlib_CMakeLists.txt @@ -1,23 +1,33 @@ -$NetBSD: patch-tools_llvm-shlib_CMakeLists.txt,v 1.5 2017/12/08 02:14:44 gdt Exp $ +$NetBSD: patch-tools_llvm-shlib_CMakeLists.txt,v 1.6 2019/01/26 21:17:20 tnn Exp $ Use the Linux style linking everywhere except Darwin and SunOS. ---- tools/llvm-shlib/CMakeLists.txt.orig 2016-05-26 04:35:35.000000000 +0000 +--- tools/llvm-shlib/CMakeLists.txt.orig 2018-08-03 10:15:36.000000000 +0000 +++ tools/llvm-shlib/CMakeLists.txt -@@ -37,11 +37,12 @@ endif() +@@ -37,12 +37,11 @@ endif() add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES}) list(REMOVE_DUPLICATES LIB_NAMES) --if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR MINGW) # FIXME: It should be "GNU ld for elf" -- # GNU ld doesn't resolve symbols in the version script. -- set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive) --elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") +-if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) +- OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") +- OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD") +- OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia") +- OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly") +- OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")) # FIXME: It should be "GNU ld for elf" +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") - set(LIB_NAMES -Wl,-all_load ${LIB_NAMES}) ++ set(LIB_NAMES -Wl,-all_load ${LIB_NAMES}) +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") + set(LIB_NAMES -Wl,-Bsymbolic -Wl,-z -Wl,allextract ${LIB_NAMES} -Wl,-z -Wl,defaultextract) +else() -+ set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map.in + ${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map) +@@ -53,8 +52,6 @@ if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Lin + # Solaris ld does not accept global: *; so there is no way to version *all* global symbols + set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map ${LIB_NAMES}) + endif() +-elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") +- set(LIB_NAMES -Wl,-all_load ${LIB_NAMES}) endif() target_link_libraries(LLVM PRIVATE ${LIB_NAMES}) |