llvm12: clean up template, fix libc++ with compiler-rt
This commit is contained in:
parent
bea466c0b6
commit
a1a6021f2a
22 changed files with 163 additions and 222 deletions
|
@ -9,8 +9,8 @@ Subject: [PATCH 2/7] fix unwind chain inclusion
|
|||
|
||||
diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
|
||||
index 303d792..44e10cc 100644
|
||||
--- a/lib/Headers/unwind.h
|
||||
+++ b/lib/Headers/unwind.h
|
||||
--- a/clang/lib/Headers/unwind.h
|
||||
+++ b/clang/lib/Headers/unwind.h
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
/* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
|
|
@ -1,5 +1,5 @@
|
|||
--- a/lib/Driver/ToolChains/Gnu.cpp
|
||||
+++ b/lib/Driver/ToolChains/Gnu.cpp
|
||||
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
@@ -2086,7 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
|
||||
"armv7hl-redhat-linux-gnueabi",
|
|
@ -1,5 +1,5 @@
|
|||
--- a/lib/Driver/ToolChains/Linux.cpp
|
||||
+++ b/lib/Driver/ToolChains/Linux.cpp
|
||||
--- a/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
@@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
|
||||
Loader = "ld.so.1";
|
||||
break;
|
|
@ -1,5 +1,5 @@
|
|||
--- a/lib/Basic/Targets/PPC.h
|
||||
+++ b/lib/Basic/Targets/PPC.h
|
||||
--- a/clang/lib/Basic/Targets/PPC.h
|
||||
+++ b/clang/lib/Basic/Targets/PPC.h
|
||||
@@ -415,11 +415,10 @@ public:
|
||||
LongDoubleFormat = &llvm::APFloat::IEEEdouble();
|
||||
} else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
|
||||
|
@ -13,8 +13,8 @@
|
|||
|
||||
if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) {
|
||||
LongDoubleWidth = LongDoubleAlign = 64;
|
||||
--- a/lib/CodeGen/TargetInfo.cpp
|
||||
+++ b/lib/CodeGen/TargetInfo.cpp
|
||||
--- a/clang/lib/CodeGen/TargetInfo.cpp
|
||||
+++ b/clang/lib/CodeGen/TargetInfo.cpp
|
||||
@@ -10927,9 +10927,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
|
||||
return SetCGInfo(new AIXTargetCodeGenInfo(Types, /*Is64Bit*/ true));
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
|||
bool IsSoftFloat = CodeGenOpts.FloatABI == "soft";
|
||||
|
||||
return SetCGInfo(
|
||||
--- a/lib/Driver/ToolChains/Clang.cpp
|
||||
+++ b/lib/Driver/ToolChains/Clang.cpp
|
||||
--- a/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
@@ -1920,14 +1920,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
|
||||
const llvm::Triple &T = getToolChain().getTriple();
|
||||
if (T.isOSBinFormatELF()) {
|
|
@ -1,5 +1,5 @@
|
|||
--- compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp.orig
|
||||
+++ compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
|
||||
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp.orig
|
||||
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
|
||||
@@ -1799,7 +1799,7 @@
|
||||
|
||||
static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) {
|
|
@ -1,5 +1,5 @@
|
|||
--- a/lib/sanitizer_common/sanitizer_linux.cpp
|
||||
+++ b/lib/sanitizer_common/sanitizer_linux.cpp
|
||||
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
|
||||
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
|
||||
@@ -74,6 +74,10 @@
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
@ -11,8 +11,8 @@
|
|||
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||
#include <sys/personality.h>
|
||||
#endif
|
||||
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
|
||||
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
|
||||
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
|
||||
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
|
||||
@@ -92,7 +92,7 @@
|
||||
# include <utime.h>
|
||||
# include <sys/ptrace.h>
|
||||
|
@ -22,8 +22,8 @@
|
|||
# include <asm/ptrace.h>
|
||||
# ifdef __arm__
|
||||
typedef struct user_fpregs elf_fpregset_t;
|
||||
--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
|
||||
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
|
||||
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
|
||||
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <sys/types.h> // for pid_t
|
||||
#include <sys/uio.h> // for iovec
|
|
@ -1,5 +1,5 @@
|
|||
--- compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp.orig
|
||||
+++ compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
|
||||
--- a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp.orig
|
||||
+++ b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
|
||||
@@ -25,6 +25,7 @@
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
--- a/lib/xray/xray_powerpc64.inc
|
||||
+++ b/lib/xray/xray_powerpc64.inc
|
||||
--- a/compiler-rt/lib/xray/xray_powerpc64.inc
|
||||
+++ b/compiler-rt/lib/xray/xray_powerpc64.inc
|
||||
@@ -12,7 +12,13 @@
|
||||
|
||||
#include <cstdint>
|
|
@ -1,5 +1,5 @@
|
|||
--- a/include/locale
|
||||
+++ b/include/locale
|
||||
--- a/libcxx/include/locale
|
||||
+++ b/libcxx/include/locale
|
||||
@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
|
||||
typename remove_reference<decltype(errno)>::type __save_errno = errno;
|
||||
errno = 0;
|
|
@ -2,8 +2,8 @@ This ensures `is_iec559` is defined correctly under all long double ABIs,
|
|||
including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
|
||||
is not defined on gcc.
|
||||
|
||||
--- a/include/limits
|
||||
+++ b/include/limits
|
||||
--- a/libcxx/include/limits
|
||||
+++ b/libcxx/include/limits
|
||||
@@ -426,8 +426,14 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
|
|
@ -1,5 +1,5 @@
|
|||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
--- a/libcxx/CMakeLists.txt
|
||||
+++ b/libcxx/CMakeLists.txt
|
||||
@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target)
|
||||
target_link_libraries(${target} PRIVATE atomic)
|
||||
endif()
|
25
srcpkgs/llvm12/patches/libcxxabi-dl.patch
Normal file
25
srcpkgs/llvm12/patches/libcxxabi-dl.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
Also link to -ldl to prevent undefined references.
|
||||
|
||||
--- a/libcxxabi/src/CMakeLists.txt
|
||||
+++ b/libcxxabi/src/CMakeLists.txt
|
||||
@@ -73,6 +73,7 @@
|
||||
endif()
|
||||
|
||||
add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
|
||||
+ add_library_flags_if(LIBCXXABI_HAS_C_LIB dl)
|
||||
endif()
|
||||
|
||||
if (LIBCXXABI_USE_LLVM_UNWINDER)
|
||||
--- a/libcxx/CMakeLists.txt
|
||||
+++ b/libcxx/CMakeLists.txt
|
||||
@@ -745,6 +745,10 @@
|
||||
target_link_libraries(${target} PRIVATE m)
|
||||
endif()
|
||||
|
||||
+ if (LIBCXX_HAS_C_LIB)
|
||||
+ target_link_libraries(${target} PRIVATE dl)
|
||||
+ endif()
|
||||
+
|
||||
if (LIBCXX_HAS_RT_LIB)
|
||||
target_link_libraries(${target} PRIVATE rt)
|
||||
endif()
|
|
@ -1,7 +1,7 @@
|
|||
This fixes build at least with gcc9 which does not define `__ppc__`.
|
||||
|
||||
--- a/include/__libunwind_config.h
|
||||
+++ b/include/__libunwind_config.h
|
||||
--- a/libunwind/include/__libunwind_config.h
|
||||
+++ b/libunwind/include/__libunwind_config.h
|
||||
@@ -49,7 +49,7 @@
|
||||
# define _LIBUNWIND_CONTEXT_SIZE 167
|
||||
# define _LIBUNWIND_CURSOR_SIZE 179
|
||||
|
@ -11,8 +11,8 @@ This fixes build at least with gcc9 which does not define `__ppc__`.
|
|||
# define _LIBUNWIND_TARGET_PPC 1
|
||||
# define _LIBUNWIND_CONTEXT_SIZE 117
|
||||
# define _LIBUNWIND_CURSOR_SIZE 124
|
||||
--- a/src/UnwindRegistersRestore.S
|
||||
+++ b/src/UnwindRegistersRestore.S
|
||||
--- a/libunwind/src/UnwindRegistersRestore.S
|
||||
+++ b/libunwind/src/UnwindRegistersRestore.S
|
||||
@@ -392,7 +392,7 @@ Lnovec:
|
||||
PPC64_LR(3)
|
||||
bctr
|
||||
|
@ -22,8 +22,8 @@ This fixes build at least with gcc9 which does not define `__ppc__`.
|
|||
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
|
||||
//
|
||||
--- a/src/UnwindRegistersSave.S
|
||||
+++ b/src/UnwindRegistersSave.S
|
||||
--- a/libunwind/src/UnwindRegistersSave.S
|
||||
+++ b/libunwind/src/UnwindRegistersSave.S
|
||||
@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
blr
|
||||
|
||||
|
@ -33,8 +33,8 @@ This fixes build at least with gcc9 which does not define `__ppc__`.
|
|||
|
||||
//
|
||||
// extern int unw_getcontext(unw_context_t* thread_state)
|
||||
--- a/src/config.h
|
||||
+++ b/src/config.h
|
||||
--- a/libunwind/src/config.h
|
||||
+++ b/libunwind/src/config.h
|
||||
@@ -95,12 +95,12 @@
|
||||
#define _LIBUNWIND_BUILD_SJLJ_APIS
|
||||
#endif
|
||||
|
@ -50,8 +50,8 @@ This fixes build at least with gcc9 which does not define `__ppc__`.
|
|||
(!defined(__APPLE__) && defined(__arm__)) || \
|
||||
(defined(__arm64__) || defined(__aarch64__)) || \
|
||||
defined(__mips__)
|
||||
--- a/src/libunwind.cpp
|
||||
+++ b/src/libunwind.cpp
|
||||
--- a/libunwind/src/libunwind.cpp
|
||||
+++ b/libunwind/src/libunwind.cpp
|
||||
@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
|
||||
# define REGISTER_KIND Registers_x86_64
|
||||
#elif defined(__powerpc64__)
|
|
@ -1,5 +1,5 @@
|
|||
--- a/source/Plugins/Process/Linux/Procfs.h
|
||||
+++ b/source/Plugins/Process/Linux/Procfs.h
|
||||
--- a/lldb/source/Plugins/Process/Linux/Procfs.h
|
||||
+++ b/lldb/source/Plugins/Process/Linux/Procfs.h
|
||||
@@ -10,21 +10,12 @@
|
||||
// sys/procfs.h on Android/Linux for all supported architectures.
|
||||
|
|
@ -12,8 +12,8 @@ Subject: [PATCH 3/3] musl
|
|||
|
||||
diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
|
||||
index 34a8a1e3..1214ece5 100644
|
||||
--- a/include/llvm/Analysis/TargetLibraryInfo.h
|
||||
+++ b/include/llvm/Analysis/TargetLibraryInfo.h
|
||||
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
|
||||
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
|
||||
@@ -18,6 +18,15 @@
|
||||
#include "llvm/IR/PassManager.h"
|
||||
#include "llvm/Pass.h"
|
||||
|
@ -32,8 +32,8 @@ index 34a8a1e3..1214ece5 100644
|
|||
class Triple;
|
||||
diff --git a/lib/Support/Unix/DynamicLibrary.inc b/lib/Support/Unix/DynamicLibrary.inc
|
||||
index a2a37996..2f86c470 100644
|
||||
--- a/lib/Support/Unix/DynamicLibrary.inc
|
||||
+++ b/lib/Support/Unix/DynamicLibrary.inc
|
||||
--- a/llvm/lib/Support/Unix/DynamicLibrary.inc
|
||||
+++ b/llvm/lib/Support/Unix/DynamicLibrary.inc
|
||||
@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
|
||||
|
||||
// This macro returns the address of a well-known, explicit symbol
|
||||
|
@ -45,8 +45,8 @@ index a2a37996..2f86c470 100644
|
|||
// macros and global variables because of standards requirements. So, we
|
||||
diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
|
||||
index d882ab2e..f1fb12d0 100644
|
||||
--- a/utils/unittest/googletest/src/gtest.cc
|
||||
+++ b/utils/unittest/googletest/src/gtest.cc
|
||||
--- a/llvm/utils/unittest/googletest/src/gtest.cc
|
||||
+++ b/llvm/utils/unittest/googletest/src/gtest.cc
|
||||
@@ -128,6 +128,7 @@
|
||||
|
||||
#if GTEST_CAN_STREAM_RESULTS_
|
|
@ -4,8 +4,8 @@ on big endian ppc64.
|
|||
|
||||
diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
index 0634833e..b7cbc2e7 100644
|
||||
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
@@ -222,9 +222,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
|
||||
|
||||
switch (TT.getArch()) {
|
||||
|
@ -19,8 +19,8 @@ index 0634833e..b7cbc2e7 100644
|
|||
}
|
||||
diff --git a/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
index 8b1cf6b5..296a2afa 100644
|
||||
--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
+++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
--- a/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
+++ b/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
@@ -1,4 +1,5 @@
|
||||
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
|
||||
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
|
|
@ -1,5 +1,5 @@
|
|||
--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
|
||||
+++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
|
||||
--- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
|
||||
+++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
|
||||
@@ -165,7 +165,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
|
||||
|
||||
if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
|
|
@ -1,8 +1,8 @@
|
|||
This allows us to override the optimization level as not all platforms can
|
||||
deal with -O3.
|
||||
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
--- a/llvm/CMakeLists.txt
|
||||
+++ b/llvm/CMakeLists.txt
|
||||
@@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
|
||||
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
|
||||
endif()
|
|
@ -10,8 +10,8 @@ Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
|
|||
|
||||
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
index cce21f32..87ca5f9b 100644
|
||||
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
@@ -520,7 +520,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
|
||||
|
||||
// Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
|
||||
|
@ -23,8 +23,8 @@ index cce21f32..87ca5f9b 100644
|
|||
const MachineOperand &MO = MI->getOperand(2);
|
||||
diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp
|
||||
index 5cc180d7..a5b02565 100644
|
||||
--- a/lib/Target/PowerPC/PPCMCInstLower.cpp
|
||||
+++ b/lib/Target/PowerPC/PPCMCInstLower.cpp
|
||||
--- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
|
||||
+++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
|
||||
@@ -117,7 +117,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
|
||||
// If -msecure-plt -fPIC, add 32768 to symbol.
|
|
@ -12,8 +12,8 @@ Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
|
|||
|
||||
Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
|
||||
|
||||
--- a/lib/Support/Unix/Memory.inc
|
||||
+++ b/lib/Support/Unix/Memory.inc
|
||||
--- a/llvm/lib/Support/Unix/Memory.inc
|
||||
+++ b/llvm/lib/Support/Unix/Memory.inc
|
||||
@@ -58,7 +58,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
|
||||
return PROT_READ | PROT_WRITE | PROT_EXEC;
|
||||
case llvm::sys::Memory::MF_EXEC:
|
21
srcpkgs/llvm12/patches/ppc32-compiler-rt.patch
Normal file
21
srcpkgs/llvm12/patches/ppc32-compiler-rt.patch
Normal file
|
@ -0,0 +1,21 @@
|
|||
commit ba4ede595ff9599232f5dd2b4384c243137b53fc
|
||||
Author: Daniel Kolesa <daniel@octaforge.org>
|
||||
Date: Tue Jun 22 23:40:54 2021 +0200
|
||||
|
||||
enable compiler-rt support for ppc32
|
||||
|
||||
diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
|
||||
index 1edab43..5c0c8a2 100644
|
||||
--- a/compiler-rt/cmake/base-config-ix.cmake
|
||||
+++ b/compiler-rt/cmake/base-config-ix.cmake
|
||||
@@ -182,9 +182,7 @@ macro(test_targets)
|
||||
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc64le")
|
||||
test_target_arch(powerpc64le "" "-m64")
|
||||
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
|
||||
- if(CMAKE_SYSTEM_NAME MATCHES "AIX")
|
||||
- test_target_arch(powerpc "" "-m32")
|
||||
- endif()
|
||||
+ test_target_arch(powerpc "" "-m32")
|
||||
test_target_arch(powerpc64 "" "-m64")
|
||||
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x")
|
||||
test_target_arch(s390x "" "")
|
|
@ -1,27 +1,29 @@
|
|||
# Template file for 'llvm12'
|
||||
pkgname=llvm12
|
||||
version=12.0.0
|
||||
revision=2
|
||||
wrksrc="llvm-${version}.src"
|
||||
revision=3
|
||||
wrksrc="llvm-project-${version}.src"
|
||||
build_wrksrc=llvm
|
||||
build_style=cmake
|
||||
configure_args="
|
||||
-DCMAKE_BUILD_TYPE=Release -Wno-dev
|
||||
-DENABLE_LINKER_BUILD_ID=ON
|
||||
-DLLDB_USE_SYSTEM_SIX=ON
|
||||
-DENABLE_LINKER_BUILD_ID=YES
|
||||
-DLLDB_USE_SYSTEM_SIX=YES
|
||||
-DLIBCXX_CXX_ABI=libcxxabi
|
||||
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
|
||||
-DLIBCXXABI_USE_LLVM_UNWINDER=1
|
||||
-DLIBOMP_ENABLE_SHARED=ON
|
||||
-DLIBOMP_INSTALL_ALIASES=OFF
|
||||
-DLLVM_INCLUDE_DOCS=ON
|
||||
-DLLVM_BUILD_DOCS=ON
|
||||
-DLLVM_ENABLE_SPHINX=ON
|
||||
-DSPHINX_WARNINGS_AS_ERRORS=OFF
|
||||
-DLLVM_INSTALL_UTILS=ON
|
||||
-DLLVM_BUILD_LLVM_DYLIB=ON
|
||||
-DLLVM_LINK_LLVM_DYLIB=ON
|
||||
-DLLVM_ENABLE_RTTI=ON
|
||||
-DLLVM_ENABLE_FFI=ON
|
||||
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES
|
||||
-DLIBCXXABI_USE_LLVM_UNWINDER=YES
|
||||
-DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
|
||||
-DLIBOMP_ENABLE_SHARED=YES
|
||||
-DLIBOMP_INSTALL_ALIASES=NO
|
||||
-DLLVM_INCLUDE_DOCS=YES
|
||||
-DLLVM_BUILD_DOCS=YES
|
||||
-DLLVM_ENABLE_SPHINX=YES
|
||||
-DSPHINX_WARNINGS_AS_ERRORS=NO
|
||||
-DLLVM_INSTALL_UTILS=YES
|
||||
-DLLVM_BUILD_LLVM_DYLIB=YES
|
||||
-DLLVM_LINK_LLVM_DYLIB=YES
|
||||
-DLLVM_ENABLE_RTTI=YES
|
||||
-DLLVM_ENABLE_FFI=YES
|
||||
-DLLVM_BINUTILS_INCDIR=/usr/include"
|
||||
hostmakedepends="groff perl python3 zlib-devel libffi-devel swig python3-Sphinx
|
||||
python3-recommonmark python3-sphinx-automodapi"
|
||||
|
@ -32,28 +34,8 @@ short_desc="Low Level Virtual Machine"
|
|||
maintainer="q66 <daniel@octaforge.org>"
|
||||
license="Apache-2.0"
|
||||
homepage="https://www.llvm.org"
|
||||
distfiles="
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/openmp-${version}.src.tar.xz"
|
||||
checksum="
|
||||
49dc47c8697a1a0abd4ee51629a696d7bfe803662f2a7252a3b16fc75f3a8b50
|
||||
14bcc0f55644df1a50ae9830e1f1751a7b3f633fb8605ee50e685a3db0c705ed
|
||||
2cb7d497f3ce33ce8a2c50ad26ec93a8c45f57268d4d96953cd0f25566f753fd
|
||||
e26e452e91d4542da3ebbf404f024d3e1cbf103f4cd110c26bf0a19621cca9ed
|
||||
ad41e0b527a65ade95c1ba690a5434cefaab4a2daa1be307caaa1e8541fe6d5c
|
||||
85a8cd0a62413eaa0457d8d02f8edac38c4dc0c96c00b09dc550260c23268434
|
||||
9ed2a5b28853f7f58be9d04836ff43d6e4132df5a2c058b690dc3e9d75bd1cf5
|
||||
7dcb75ca4f6aae2c677d128460c48a57398c8b6791b77b74bea7cf9e04e7c3f1
|
||||
6ab8e8cd148a7d5103067e05c36e36ef36e27634fc8e73b5712853c9affe75b1
|
||||
eb1b7022a247332114985ed155a8fb632c28ce7c35a476e2c0caf865150f167d"
|
||||
distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
|
||||
checksum="9ed1688943a4402d7c904cc4515798cdb20080066efa010fe7e1f2551b423628"
|
||||
lib32disabled=yes
|
||||
python_version=3
|
||||
|
||||
|
@ -69,6 +51,8 @@ case "$XBPS_TARGET_MACHINE" in
|
|||
ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
|
||||
esac
|
||||
|
||||
_enabled_projects="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind;lld"
|
||||
|
||||
_lldb_enable=yes
|
||||
_libomp_enable=no
|
||||
|
||||
|
@ -85,6 +69,7 @@ subpackages="clang-tools-extra"
|
|||
|
||||
# must go before clang
|
||||
if [ "$_libomp_enable" = "yes" ]; then
|
||||
_enabled_projects+=";openmp"
|
||||
subpackages+=" libomp libomp-devel"
|
||||
# because of cmake nonsense referencing libomptarget.so.*
|
||||
depends+=" libomp>=${version}_${revision}"
|
||||
|
@ -96,157 +81,62 @@ subpackages+=" clang clang-analyzer libclang libclang-cpp
|
|||
|
||||
if [ "$_lldb_enable" = "yes" ]; then
|
||||
# XXX fails to cross compile due to python
|
||||
_enabled_projects+=";lldb"
|
||||
subpackages+=" lldb lldb-devel"
|
||||
fi
|
||||
|
||||
subpackages+=" lld lld-devel"
|
||||
|
||||
configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
|
||||
|
||||
post_patch() {
|
||||
# patches
|
||||
cd ${XBPS_BUILDDIR}/llvm-${version}.src
|
||||
for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
|
||||
msg_normal "Applying $i to llvm\n"
|
||||
patch -sNp1 -i ${i}
|
||||
done
|
||||
|
||||
cd ${XBPS_BUILDDIR}/clang-${version}.src
|
||||
for i in ${FILESDIR}/patches/clang/clang-*.patch; do
|
||||
msg_normal "Applying $i to clang\n"
|
||||
patch -sNp1 -i ${i}
|
||||
done
|
||||
|
||||
cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
|
||||
for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
|
||||
msg_normal "Applying $i to compiler-rt\n"
|
||||
patch -sNp1 -i ${i}
|
||||
done
|
||||
|
||||
cd ${XBPS_BUILDDIR}/libunwind-${version}.src
|
||||
for i in ${FILESDIR}/patches/libunwind/libunwind-*.patch; do
|
||||
msg_normal "Applying $i to libunwind\n"
|
||||
patch -sNp1 -i ${i}
|
||||
done
|
||||
|
||||
cd ${XBPS_BUILDDIR}/libcxx-${version}.src
|
||||
for i in ${FILESDIR}/patches/libcxx/libcxx-*.patch; do
|
||||
msg_normal "Applying $i to libcxx\n"
|
||||
patch -sNp1 -i ${i}
|
||||
done
|
||||
|
||||
if [ "$_lldb_enable" = "yes" ]; then
|
||||
cd ${XBPS_BUILDDIR}/lldb-${version}.src
|
||||
for i in ${FILESDIR}/patches/lldb/*.patch; do
|
||||
msg_normal "Applying $i to lldb\n"
|
||||
patch -sNp1 -i ${i}
|
||||
done
|
||||
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
|
||||
vsed -i 's|__ptrace_request|int|g' \
|
||||
source/Plugins/Process/Linux/NativeProcessLinux.cpp
|
||||
${wrksrc}/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
|
||||
fi
|
||||
# disable docs for lldb as they fail to generate
|
||||
vsed -i '/add_subdirectory(docs)/d' \
|
||||
${wrksrc}/lldb/CMakeLists.txt
|
||||
fi
|
||||
|
||||
# Move clang files into the llvm source.
|
||||
if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
|
||||
mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
|
||||
fi
|
||||
# Move clang-tools-extra files into llvm source.
|
||||
if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
|
||||
mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src \
|
||||
${wrksrc}/tools/clang/tools/extra
|
||||
fi
|
||||
# Move lld files into the llvm source.
|
||||
if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
|
||||
mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
|
||||
# https://bugs.llvm.org/show_bug.cgi?id=49228
|
||||
mkdir -p ${wrksrc}/tools/lld/include/mach-o
|
||||
cp ${XBPS_BUILDDIR}/libunwind-${version}.src/include/mach-o/compact_unwind_encoding.h \
|
||||
${wrksrc}/tools/lld/include/mach-o
|
||||
fi
|
||||
# Move lldb files into the llvm source.
|
||||
if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
|
||||
if [ "$_lldb_enable" = "yes" ]; then
|
||||
mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
|
||||
# disable docs for lldb as they fail to generate
|
||||
vsed -i '/add_subdirectory(docs)/d' \
|
||||
${wrksrc}/tools/lldb/CMakeLists.txt
|
||||
else
|
||||
rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
|
||||
fi
|
||||
fi
|
||||
# Move compiler-rt files into the llvm source.
|
||||
if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
|
||||
mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src \
|
||||
${wrksrc}/projects/compiler-rt
|
||||
fi
|
||||
# Move libunwind files into the llvm source.
|
||||
if [ -d ${XBPS_BUILDDIR}/libunwind-${version}.src ]; then
|
||||
mv ${XBPS_BUILDDIR}/libunwind-${version}.src \
|
||||
${wrksrc}/projects/libunwind
|
||||
fi
|
||||
# Move libcxx files into the llvm source.
|
||||
if [ -d ${XBPS_BUILDDIR}/libcxx-${version}.src ]; then
|
||||
mv ${XBPS_BUILDDIR}/libcxx-${version}.src \
|
||||
${wrksrc}/projects/libcxx
|
||||
fi
|
||||
# Move libcxxabi files into the llvm source.
|
||||
if [ -d ${XBPS_BUILDDIR}/libcxxabi-${version}.src ]; then
|
||||
mv ${XBPS_BUILDDIR}/libcxxabi-${version}.src \
|
||||
${wrksrc}/projects/libcxxabi
|
||||
fi
|
||||
# Move openmp files into the llvm source.
|
||||
if [ -d ${XBPS_BUILDDIR}/openmp-${version}.src ]; then
|
||||
if [ "$_libomp_enable" = "yes" ]; then
|
||||
mv ${XBPS_BUILDDIR}/openmp-${version}.src \
|
||||
${wrksrc}/projects/openmp
|
||||
else
|
||||
rm -rf ${XBPS_BUILDDIR}/openmp-${version}.src
|
||||
fi
|
||||
fi
|
||||
|
||||
# fix early build failure
|
||||
vsed -e "/set(model_compiler/s:\${CMAKE_SOURCE_DIR}/\.\./clang-tools-extra/:\${CMAKE_SOURCE_DIR}/tools/clang/tools/extra/:" \
|
||||
-i ${wrksrc}/tools/clang/tools/extra/clangd/quality/CompletionModel.cmake
|
||||
|
||||
# update config.guess for better platform detection
|
||||
cp $XBPS_COMMONDIR/environment/configure/automake/config.guess \
|
||||
${wrksrc}/cmake
|
||||
${wrksrc}/llvm/cmake
|
||||
|
||||
# fix linker failures on some archs
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
ppc64*) ;;
|
||||
aarch64*|ppc*|i686*)
|
||||
vsed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \
|
||||
${wrksrc}/projects/libcxxabi/cmake/config-ix.cmake
|
||||
vsed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \
|
||||
${wrksrc}/projects/libcxxabi/cmake/config-ix.cmake
|
||||
;;
|
||||
esac
|
||||
vsed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \
|
||||
${wrksrc}/libcxxabi/cmake/config-ix.cmake
|
||||
vsed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \
|
||||
${wrksrc}/libcxxabi/cmake/config-ix.cmake
|
||||
|
||||
# need libssp_nonshared on some musl platforms (because of nodefaultlibs)
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
ppc64*) ;;
|
||||
ppc*-musl|i686-musl|mips*-musl)
|
||||
vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
|
||||
${wrksrc}/projects/libunwind/src/CMakeLists.txt
|
||||
${wrksrc}/libunwind/src/CMakeLists.txt
|
||||
vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
|
||||
${wrksrc}/projects/libcxxabi/src/CMakeLists.txt
|
||||
vsed -i 's,#ssp,,' ${wrksrc}/projects/libcxx/CMakeLists.txt
|
||||
${wrksrc}/libcxxabi/src/CMakeLists.txt
|
||||
vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
x86_64-musl) # some sanitizer currently only on x86_64 stuff needs backtrace
|
||||
vsed -i 's,# Set common link flags.,list(APPEND SANITIZER_COMMON_LINK_LIBS execinfo),' \
|
||||
${wrksrc}/projects/compiler-rt/CMakeLists.txt
|
||||
${wrksrc}/compiler-rt/CMakeLists.txt
|
||||
;;
|
||||
arm*-musl) # sanitizer code is broken on arm*-musl since it duplicates some libc bits
|
||||
vsed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' \
|
||||
${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
|
||||
${wrksrc}/compiler-rt/cmake/config-ix.cmake
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
pre_configure() {
|
||||
local triplet
|
||||
|
||||
# Vastly reduce size of debugging symbols:
|
||||
CFLAGS=${CFLAGS/ -g/ -g1}
|
||||
CXXFLAGS=${CXXFLAGS/ -g/ -g1}
|
||||
|
@ -285,9 +175,12 @@ pre_configure() {
|
|||
mips*) _arch="Mips";;
|
||||
ppc*) _arch="PowerPC";;
|
||||
esac
|
||||
|
||||
triplet=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}
|
||||
|
||||
configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
|
||||
configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
|
||||
configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
|
||||
configure_args+=" -DLLVM_HOST_TRIPLE=${triplet}"
|
||||
configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${triplet}"
|
||||
}
|
||||
|
||||
do_install() {
|
||||
|
@ -309,13 +202,15 @@ do_install() {
|
|||
fi
|
||||
|
||||
# Install libcxxabi headers
|
||||
vinstall ${wrksrc}/projects/libcxxabi/include/__cxxabi_config.h 644 usr/include
|
||||
vinstall ${wrksrc}/projects/libcxxabi/include/cxxabi.h 644 usr/include
|
||||
vinstall ${wrksrc}/libcxxabi/include/__cxxabi_config.h 644 usr/include
|
||||
vinstall ${wrksrc}/libcxxabi/include/cxxabi.h 644 usr/include
|
||||
|
||||
# Install libunwind headers
|
||||
vinstall ${wrksrc}/projects/libunwind/include/__libunwind_config.h 644 usr/include
|
||||
vinstall ${wrksrc}/projects/libunwind/include/libunwind.h 644 usr/include
|
||||
vinstall ${wrksrc}/projects/libunwind/include/unwind.h 644 usr/include
|
||||
vinstall ${wrksrc}/libunwind/include/__libunwind_config.h 644 usr/include
|
||||
vinstall ${wrksrc}/libunwind/include/libunwind.h 644 usr/include
|
||||
vinstall ${wrksrc}/libunwind/include/unwind.h 644 usr/include
|
||||
vinstall ${wrksrc}/libunwind/include/mach-o/compact_unwind_encoding.h \
|
||||
644 usr/include/mach-o
|
||||
}
|
||||
|
||||
clang-analyzer_package() {
|
||||
|
|
Loading…
Reference in a new issue