diff options
Diffstat (limited to 'devel/llvm13/files')
23 files changed, 595 insertions, 0 deletions
diff --git a/devel/llvm13/files/extra-patch-clang_lib_Driver_ToolChains_Clang.cpp b/devel/llvm13/files/extra-patch-clang_lib_Driver_ToolChains_Clang.cpp new file mode 100644 index 000000000000..37304e59f444 --- /dev/null +++ b/devel/llvm13/files/extra-patch-clang_lib_Driver_ToolChains_Clang.cpp @@ -0,0 +1,12 @@ +--- clang/lib/Driver/ToolChains/Clang.cpp.orig 2021-08-11 19:51:00.122735000 +0200 ++++ clang/lib/Driver/ToolChains/Clang.cpp 2021-08-11 19:51:24.346107000 +0200 +@@ -1921,8 +1921,7 @@ + if (T.isOSBinFormatELF()) { + switch (getToolChain().getArch()) { + case llvm::Triple::ppc64: { +- if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) || +- T.isOSOpenBSD() || T.isMusl()) ++ if (T.isOSFreeBSD() || T.isOSOpenBSD() || T.isMusl()) + ABIName = "elfv2"; + else + ABIName = "elfv1"; diff --git a/devel/llvm13/files/llvm-wrapper.sh.in b/devel/llvm13/files/llvm-wrapper.sh.in new file mode 100644 index 000000000000..096e483c32a0 --- /dev/null +++ b/devel/llvm13/files/llvm-wrapper.sh.in @@ -0,0 +1,11 @@ +#!/bin/sh + +LLVM_PREFIX="%%LLVM_PREFIX%%" +LLVM_SUFFIX="%%LLVM_SUFFIX%%" + +tool=$0 +[ -L "$tool" ] && tool=$(/bin/realpath $tool) +tool=${tool##*/} +tool="${LLVM_PREFIX}/bin/${tool%${LLVM_SUFFIX}}" +LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${LLVM_PREFIX}/lib" \ + exec "${tool}" "${@}" diff --git a/devel/llvm13/files/patch-D77776 b/devel/llvm13/files/patch-D77776 new file mode 100644 index 000000000000..2b776ed06315 --- /dev/null +++ b/devel/llvm13/files/patch-D77776 @@ -0,0 +1,20 @@ +[Driver] Default to libc++ on FreeBSD + +Downstream may naively translate between DSL and LLVM target +triple. If OS version is lost in the process then Clang would +default to a version that's no longer supported by OS vendor. + +https://reviews.llvm.org/D77776 + +--- clang/lib/Driver/ToolChains/FreeBSD.cpp.orig 2019-12-11 19:15:30 UTC ++++ clang/lib/Driver/ToolChains/FreeBSD.cpp +@@ -351,7 +351,8 @@ FreeBSD::FreeBSD(const Driver &D, const llvm::Triple & + } + + ToolChain::CXXStdlibType FreeBSD::GetDefaultCXXStdlibType() const { +- if (getTriple().getOSMajorVersion() >= 10) ++ unsigned Major = getTriple().getOSMajorVersion(); ++ if (Major >= 10 || Major == 0) + return ToolChain::CST_Libcxx; + return ToolChain::CST_Libstdcxx; + } diff --git a/devel/llvm13/files/patch-clang_lib_Driver_ToolChains_FreeBSD.cpp b/devel/llvm13/files/patch-clang_lib_Driver_ToolChains_FreeBSD.cpp new file mode 100644 index 000000000000..4c13ad977b21 --- /dev/null +++ b/devel/llvm13/files/patch-clang_lib_Driver_ToolChains_FreeBSD.cpp @@ -0,0 +1,33 @@ +[Driver] Default to libc++ on FreeBSD + +Downstream may naively translate between DSL and LLVM target +triple. If OS version is lost in the process then Clang would +default to a version that's no longer supported by OS vendor. + +https://reviews.llvm.org/D77776 + +--- clang/lib/Driver/ToolChains/FreeBSD.cpp.orig 2021-06-28 16:23:38 UTC ++++ clang/lib/Driver/ToolChains/FreeBSD.cpp +@@ -466,6 +466,7 @@ bool FreeBSD::IsUnwindTablesDefault(const ArgList &Arg + bool FreeBSD::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); } + + SanitizerMask FreeBSD::getSupportedSanitizers() const { ++ const bool IsAArch64 = getTriple().getArch() == llvm::Triple::aarch64; + const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; + const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64; + const bool IsMIPS64 = getTriple().isMIPS64(); +@@ -484,8 +485,13 @@ SanitizerMask FreeBSD::getSupportedSanitizers() const + Res |= SanitizerKind::Fuzzer; + Res |= SanitizerKind::FuzzerNoLink; + } +- if (IsX86_64) ++ if (IsAArch64 || IsX86_64) { ++ Res |= SanitizerKind::KernelAddress; ++ Res |= SanitizerKind::KernelMemory; ++ } ++ if (IsX86_64) { + Res |= SanitizerKind::Memory; ++ } + return Res; + } + diff --git a/devel/llvm13/files/patch-clang_lib_Headers_CMakeLists.txt b/devel/llvm13/files/patch-clang_lib_Headers_CMakeLists.txt new file mode 100644 index 000000000000..bee363da7431 --- /dev/null +++ b/devel/llvm13/files/patch-clang_lib_Headers_CMakeLists.txt @@ -0,0 +1,32 @@ +--- clang/lib/Headers/CMakeLists.txt.orig ++++ clang/lib/Headers/CMakeLists.txt +@@ -76,7 +76,6 @@ + invpcidintrin.h + iso646.h + keylockerintrin.h +- limits.h + lwpintrin.h + lzcntintrin.h + mm3dnow.h +@@ -102,13 +101,7 @@ + s390intrin.h + shaintrin.h + smmintrin.h +- stdalign.h +- stdarg.h +- stdatomic.h +- stdbool.h +- stddef.h + __stddef_max_align_t.h +- stdint.h + stdnoreturn.h + tbmintrin.h + tgmath.h +@@ -118,7 +111,6 @@ + unwind.h + vadefs.h + vaesintrin.h +- varargs.h + vecintrin.h + vpclmulqdqintrin.h + waitpkgintrin.h diff --git a/devel/llvm13/files/patch-clang_test_Driver_fsanitize.c b/devel/llvm13/files/patch-clang_test_Driver_fsanitize.c new file mode 100644 index 000000000000..0c616740ceca --- /dev/null +++ b/devel/llvm13/files/patch-clang_test_Driver_fsanitize.c @@ -0,0 +1,16 @@ +--- clang/test/Driver/fsanitize.c.orig 2021-06-28 16:23:38 UTC ++++ clang/test/Driver/fsanitize.c +@@ -689,7 +689,13 @@ + // RUN: %clang -target x86_64-unknown-cloudabi -fsanitize=safe-stack %s -### 2>&1 | FileCheck %s -check-prefix=SAFESTACK-CLOUDABI + // SAFESTACK-CLOUDABI: "-fsanitize=safe-stack" + ++// RUN: %clang -target x86_64--freebsd -fsanitize=kernel-address %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-ADDRESS-FREEBSD ++// RUN: %clang -target aarch64--freebsd -fsanitize=kernel-address %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-ADDRESS-FREEBSD ++// KERNEL-ADDRESS-FREEBSD: "-fsanitize=kernel-address" + ++// RUN: %clang -target x86_64--freebsd -fsanitize=kernel-memory %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-MEMORY-FREEBSD ++// RUN: %clang -target aarch64--freebsd -fsanitize=kernel-memory %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-MEMORY-FREEBSD ++// KERNEL-MEMORY-FREEBSD: "-fsanitize=kernel-memory" + + // * NetBSD; please keep ordered as in Sanitizers.def * + diff --git a/devel/llvm13/files/patch-clang_tools_clang-format_clang-format-sublime.py b/devel/llvm13/files/patch-clang_tools_clang-format_clang-format-sublime.py new file mode 100644 index 000000000000..4be5f233bfd5 --- /dev/null +++ b/devel/llvm13/files/patch-clang_tools_clang-format_clang-format-sublime.py @@ -0,0 +1,11 @@ +--- clang/tools/clang-format/clang-format-sublime.py.orig ++++ clang/tools/clang-format/clang-format-sublime.py +@@ -18,7 +18,7 @@ + import subprocess + + # Change this to the full path if clang-format is not on the path. +-binary = 'clang-format' ++binary = 'clang-format%%LLVM_SUFFIX%%' + + # Change this to format according to other formatting styles. See the output of + # 'clang-format --help' for a list of supported styles. The default looks for diff --git a/devel/llvm13/files/patch-clang_tools_clang-format_clang-format.py b/devel/llvm13/files/patch-clang_tools_clang-format_clang-format.py new file mode 100644 index 000000000000..b002166e0a24 --- /dev/null +++ b/devel/llvm13/files/patch-clang_tools_clang-format_clang-format.py @@ -0,0 +1,11 @@ +--- clang/tools/clang-format/clang-format.py.orig 2015-09-08 20:44:00 UTC ++++ clang/tools/clang-format/clang-format.py +@@ -34,7 +34,7 @@ import vim + + # set g:clang_format_path to the path to clang-format if it is not on the path + # Change this to the full path if clang-format is not on the path. +-binary = 'clang-format' ++binary = 'clang-format%%LLVM_SUFFIX%%' + if vim.eval('exists("g:clang_format_path")') == "1": + binary = vim.eval('g:clang_format_path') + diff --git a/devel/llvm13/files/patch-clang_tools_clang-format_git-clang-format b/devel/llvm13/files/patch-clang_tools_clang-format_git-clang-format new file mode 100644 index 000000000000..b48a644a1775 --- /dev/null +++ b/devel/llvm13/files/patch-clang_tools_clang-format_git-clang-format @@ -0,0 +1,29 @@ +--- clang/tools/clang-format/git-clang-format.orig ++++ clang/tools/clang-format/git-clang-format +@@ -90,7 +90,7 @@ + usage=usage, formatter_class=argparse.RawDescriptionHelpFormatter, + description=desc) + p.add_argument('--binary', +- default=config.get('clangformat.binary', 'clang-format'), ++ default=config.get('clangformat.binary', 'clang-format%%LLVM_SUFFIX%%'), + help='path to clang-format'), + p.add_argument('--commit', + default=config.get('clangformat.commit', 'HEAD'), +@@ -344,7 +344,7 @@ + + + def run_clang_format_and_save_to_tree(changed_lines, revision=None, +- binary='clang-format', style=None): ++ binary='clang-format%%LLVM_SUFFIX%%', style=None): + """Run clang-format on each file and save the result to a git tree. + + Returns the object ID (SHA-1) of the created tree.""" +@@ -397,7 +397,7 @@ + + + def clang_format_to_blob(filename, line_ranges, revision=None, +- binary='clang-format', style=None): ++ binary='clang-format%%LLVM_SUFFIX%%', style=None): + """Run clang-format on the given file and save the result to a git blob. + + Runs on the file in `revision` if not None, or on the file in the working diff --git a/devel/llvm13/files/patch-clang_tools_extra_clang-doc_tool_CMakeLists.txt b/devel/llvm13/files/patch-clang_tools_extra_clang-doc_tool_CMakeLists.txt new file mode 100644 index 000000000000..f269dba4fce7 --- /dev/null +++ b/devel/llvm13/files/patch-clang_tools_extra_clang-doc_tool_CMakeLists.txt @@ -0,0 +1,10 @@ +--- clang-tools-extra/clang-doc/tool/CMakeLists.txt.orig 2020-01-30 15:29:37 UTC ++++ clang-tools-extra/clang-doc/tool/CMakeLists.txt +@@ -18,6 +18,7 @@ target_link_libraries(clang-doc + clangDoc + ) + ++install(TARGETS clang-doc RUNTIME DESTINATION bin) + install(FILES ../assets/clang-doc-default-stylesheet.css + DESTINATION share/clang + COMPONENT clang-doc) diff --git a/devel/llvm13/files/patch-clang_tools_scan-build_libexec_ccc-analyzer b/devel/llvm13/files/patch-clang_tools_scan-build_libexec_ccc-analyzer new file mode 100644 index 000000000000..64896e4fb2f0 --- /dev/null +++ b/devel/llvm13/files/patch-clang_tools_scan-build_libexec_ccc-analyzer @@ -0,0 +1,12 @@ +--- clang/tools/scan-build/libexec/ccc-analyzer.orig ++++ clang/tools/scan-build/libexec/ccc-analyzer +@@ -81,6 +81,9 @@ + if (-x "/usr/bin/xcrun") { + $UseXCRUN = 1; + } ++} elsif (`uname -s` eq "FreeBSD\n") { ++ $DefaultCCompiler = 'cc'; ++ $DefaultCXXCompiler = 'c++'; + } else { + $DefaultCCompiler = 'gcc'; + $DefaultCXXCompiler = 'g++'; diff --git a/devel/llvm13/files/patch-cmake_modules_AddSphinxTarget.cmake b/devel/llvm13/files/patch-cmake_modules_AddSphinxTarget.cmake new file mode 100644 index 000000000000..4adf3652e8ee --- /dev/null +++ b/devel/llvm13/files/patch-cmake_modules_AddSphinxTarget.cmake @@ -0,0 +1,11 @@ +--- llvm/cmake/modules/AddSphinxTarget.cmake.orig ++++ llvm/cmake/modules/AddSphinxTarget.cmake +@@ -39,6 +39,8 @@ + endif() + + add_custom_target(${SPHINX_TARGET_NAME} ++ COMMAND ${CMAKE_COMMAND} ++ -E make_directory ${SPHINX_BUILD_DIR} + COMMAND ${CMAKE_COMMAND} -E env ${ARG_ENV_VARS} + ${SPHINX_EXECUTABLE} + -b ${builder} diff --git a/devel/llvm13/files/patch-fformat_extensions.diff b/devel/llvm13/files/patch-fformat_extensions.diff new file mode 100644 index 000000000000..3f0d5b0d6bc6 --- /dev/null +++ b/devel/llvm13/files/patch-fformat_extensions.diff @@ -0,0 +1,11 @@ +--- clang/include/clang/Driver/Options.td.orig 2019-10-21 21:45:02.000000000 +0100 ++++ clang/include/clang/Driver/Options.td 2019-10-22 00:00:39.833390000 +0100 +@@ -1186,6 +1186,8 @@ + Flags<[CC1Option]>; + def fno_use_line_directives : Flag<["-"], "fno-use-line-directives">, Group<f_Group>; + ++def fformat_extensions: Flag<["-"], "fformat-extensions">, Group<f_Group>, Flags<[CC1Option]>, ++ HelpText<"Enable FreeBSD kernel specific format string extensions">; + def ffreestanding : Flag<["-"], "ffreestanding">, Group<f_Group>, Flags<[CC1Option]>, + HelpText<"Assert that the compilation takes place in a freestanding environment">; + def fgnuc_version_EQ : Joined<["-"], "fgnuc-version=">, Group<f_Group>, diff --git a/devel/llvm13/files/patch-fopenmp.diff b/devel/llvm13/files/patch-fopenmp.diff new file mode 100644 index 000000000000..f521ac6e8d85 --- /dev/null +++ b/devel/llvm13/files/patch-fopenmp.diff @@ -0,0 +1,14 @@ +--- clang/lib/Driver/ToolChains/CommonArgs.cpp.orig 2017-05-10 17:18:56.000000000 +0000 ++++ clang/lib/Driver/ToolChains/CommonArgs.cpp 2017-05-10 23:01:17.087686000 +0000 +@@ -441,7 +441,10 @@ + + switch (TC.getDriver().getOpenMPRuntime(Args)) { + case Driver::OMPRT_OMP: +- CmdArgs.push_back("-lomp"); ++ if (TC.getTriple().getOS() != llvm::Triple::FreeBSD || TC.isCrossCompiling() || !llvm::sys::fs::exists("%%LLVM_PREFIX%%/lib/libomp.so")) ++ CmdArgs.push_back("-lomp"); ++ else ++ CmdArgs.push_back("%%LLVM_PREFIX%%/lib/libomp.so"); + break; + case Driver::OMPRT_GOMP: + CmdArgs.push_back("-lgomp"); diff --git a/devel/llvm13/files/patch-freebsd-r352318 b/devel/llvm13/files/patch-freebsd-r352318 new file mode 100644 index 000000000000..4fe5c836b6ea --- /dev/null +++ b/devel/llvm13/files/patch-freebsd-r352318 @@ -0,0 +1,93 @@ +commit 24b1a5b926832f68fa0a008b2484d4b44f58ee8e +Author: dim <dim@FreeBSD.org> +Date: Sat Sep 14 10:55:33 2019 +0000 + + Revert commit from upstream llvm trunk (by Hans Wennborg): + + Re-commit r357452 (take 3): "SimplifyCFG + SinkCommonCodeFromPredecessors: Also sink function calls without used + results (PR41259)" + + Third time's the charm. + + This was reverted in r363220 due to being suspected of an internal + benchmark regression and a test failure, none of which turned out to + be caused by this. + + As reported in https://bugs.llvm.org/show_bug.cgi?id=43269, this causes + UNREACHABLE errors when compiling if_malo_pci.c for arm and aarch64. + +Notes: + svn path=/projects/clang900-import/; revision=352318 + +diff --git lib/Transforms/Utils/SimplifyCFG.cpp lib/Transforms/Utils/SimplifyCFG.cpp +index 11651d040dc0..6e2ef67408d9 100644 +--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp ++++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp +@@ -1428,10 +1428,9 @@ static bool HoistThenElseCodeToIf(BranchInst *BI, + static bool canSinkInstructions( + ArrayRef<Instruction *> Insts, + DenseMap<Instruction *, SmallVector<Value *, 4>> &PHIOperands) { +- // Prune out obviously bad instructions to move. Each instruction must have +- // exactly zero or one use, and we check later that use is by a single, common +- // PHI instruction in the successor. +- bool HasUse = !Insts.front()->user_empty(); ++ // Prune out obviously bad instructions to move. Any non-store instruction ++ // must have exactly one use, and we check later that use is by a single, ++ // common PHI instruction in the successor. + for (auto *I : Insts) { + // These instructions may change or break semantics if moved. + if (isa<PHINode>(I) || I->isEHPad() || isa<AllocaInst>(I) || +@@ -1445,10 +1444,9 @@ static bool canSinkInstructions( + if (C->isInlineAsm()) + return false; + +- // Each instruction must have zero or one use. +- if (HasUse && !I->hasOneUse()) +- return false; +- if (!HasUse && !I->user_empty()) ++ // Everything must have only one use too, apart from stores which ++ // have no uses. ++ if (!isa<StoreInst>(I) && !I->hasOneUse()) + return false; + } + +@@ -1457,11 +1455,11 @@ static bool canSinkInstructions( + if (!I->isSameOperationAs(I0)) + return false; + +- // All instructions in Insts are known to be the same opcode. If they have a +- // use, check that the only user is a PHI or in the same block as the +- // instruction, because if a user is in the same block as an instruction we're +- // contemplating sinking, it must already be determined to be sinkable. +- if (HasUse) { ++ // All instructions in Insts are known to be the same opcode. If they aren't ++ // stores, check the only user of each is a PHI or in the same block as the ++ // instruction, because if a user is in the same block as an instruction ++ // we're contemplating sinking, it must already be determined to be sinkable. ++ if (!isa<StoreInst>(I0)) { + auto *PNUse = dyn_cast<PHINode>(*I0->user_begin()); + auto *Succ = I0->getParent()->getTerminator()->getSuccessor(0); + if (!all_of(Insts, [&PNUse,&Succ](const Instruction *I) -> bool { +@@ -1539,7 +1537,7 @@ static bool sinkLastInstruction(ArrayRef<BasicBlock*> Blocks) { + // it is slightly over-aggressive - it gets confused by commutative instructions + // so double-check it here. + Instruction *I0 = Insts.front(); +- if (!I0->user_empty()) { ++ if (!isa<StoreInst>(I0)) { + auto *PNUse = dyn_cast<PHINode>(*I0->user_begin()); + if (!all_of(Insts, [&PNUse](const Instruction *I) -> bool { + auto *U = cast<Instruction>(*I->user_begin()); +@@ -1597,10 +1595,11 @@ static bool sinkLastInstruction(ArrayRef<BasicBlock*> Blocks) { + I0->andIRFlags(I); + } + +- if (!I0->user_empty()) { ++ if (!isa<StoreInst>(I0)) { + // canSinkLastInstruction checked that all instructions were used by + // one and only one PHI node. Find that now, RAUW it to our common + // instruction and nuke it. ++ assert(I0->hasOneUse()); + auto *PN = cast<PHINode>(*I0->user_begin()); + PN->replaceAllUsesWith(I0); + PN->eraseFromParent(); diff --git a/devel/llvm13/files/patch-head-r332965.diff b/devel/llvm13/files/patch-head-r332965.diff new file mode 100644 index 000000000000..4fe97ae7624a --- /dev/null +++ b/devel/llvm13/files/patch-head-r332965.diff @@ -0,0 +1,22 @@ +r332965 | emaste | 2018-04-24 21:26:58 +0200 (Tue, 24 Apr 2018) | 8 lines + +lldb: remove assertion that target_arch is FreeBSD + +The target is not necessarily a FreeBSD binary - for example, it may be +a Linux binary running under the linuxulator. Basic ptrace (live) +debugging already worked in this case, except for the assertion. + +Sponsored by: Turing Robotic Industries Inc. + +Index: tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp +=================================================================== +--- lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp (revision 332964) ++++ lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp (revision 332965) +@@ -169,7 +169,6 @@ lldb::RegisterContextSP FreeBSDThread::GetRegister + RegisterInfoInterface *reg_interface = nullptr; + const ArchSpec &target_arch = GetProcess()->GetTarget().GetArchitecture(); + +- assert(target_arch.GetTriple().getOS() == llvm::Triple::FreeBSD); + switch (target_arch.GetMachine()) { + case llvm::Triple::aarch64: + reg_interface = new RegisterInfoPOSIX_arm64(target_arch); diff --git a/devel/llvm13/files/patch-lib_Target_PowerPC_PPCTargetMachine.cpp b/devel/llvm13/files/patch-lib_Target_PowerPC_PPCTargetMachine.cpp new file mode 100644 index 000000000000..ff0dba234b50 --- /dev/null +++ b/devel/llvm13/files/patch-lib_Target_PowerPC_PPCTargetMachine.cpp @@ -0,0 +1,23 @@ +--- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp.orig 2019-07-04 07:43:51 UTC ++++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +@@ -209,6 +209,20 @@ static PPCTargetMachine::PPCABI computeTargetABI(const + if (TT.isMacOSX()) + return PPCTargetMachine::PPC_ABI_UNKNOWN; + ++ if (TT.isOSFreeBSD()) { ++ switch (TT.getArch()) { ++ case Triple::ppc64le: ++ case Triple::ppc64: ++ if (TT.getOSMajorVersion() >= 13) ++ return PPCTargetMachine::PPC_ABI_ELFv2; ++ else ++ return PPCTargetMachine::PPC_ABI_ELFv1; ++ case Triple::ppc: ++ default: ++ return PPCTargetMachine::PPC_ABI_UNKNOWN; ++ } ++ } ++ + switch (TT.getArch()) { + case Triple::ppc64le: + return PPCTargetMachine::PPC_ABI_ELFv2; diff --git a/devel/llvm13/files/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h b/devel/llvm13/files/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h new file mode 100644 index 000000000000..7664513d6c89 --- /dev/null +++ b/devel/llvm13/files/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h @@ -0,0 +1,11 @@ +--- compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h.orig ++++ compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h +@@ -576,7 +576,7 @@ + #define SANITIZER_INTERCEPT_PTHREAD_ATFORK SI_NETBSD + #define SANITIZER_INTERCEPT_GETENTROPY SI_FREEBSD + #define SANITIZER_INTERCEPT_QSORT \ +- (SI_POSIX && !SI_IOSSIM && !SI_WATCHOS && !SI_TVOS && !SI_ANDROID) ++ (SI_POSIX && !SI_IOSSIM && !SI_WATCHOS && !SI_TVOS && !SI_ANDROID && !SI_FREEBSD) + #define SANITIZER_INTERCEPT_QSORT_R SI_GLIBC + // sigaltstack on i386 macOS cannot be intercepted due to setjmp() + // calling it and assuming that it does not clobber registers. diff --git a/devel/llvm13/files/patch-lld-be-compressed-debug b/devel/llvm13/files/patch-lld-be-compressed-debug new file mode 100644 index 000000000000..5b419a064e9d --- /dev/null +++ b/devel/llvm13/files/patch-lld-be-compressed-debug @@ -0,0 +1,154 @@ +commit c6ebc651b6fac9cf1d9f8c00ea49d29093003f85 +Author: Simon Atanasyan <simon@atanasyan.com> +Date: Fri Aug 6 13:29:47 2021 +0300 + + [LLD] Support compressed input sections on big-endian targets + + This patch enables compressed input sections on big-endian targets by + checking the target endianness and selecting an appropriate `Chdr` + structure. + + Fixes PR51369 + + Differential Revision: https://reviews.llvm.org/D107635 + +diff --git lld/ELF/InputSection.cpp lld/ELF/InputSection.cpp +index 1f9fa961fc2..7d952e9037f 100644 +--- lld/ELF/InputSection.cpp ++++ lld/ELF/InputSection.cpp +@@ -88,7 +88,22 @@ InputSectionBase::InputSectionBase(InputFile *file, uint64_t flags, + if (!zlib::isAvailable()) + error(toString(file) + ": contains a compressed section, " + + "but zlib is not available"); +- parseCompressedHeader(); ++ switch (config->ekind) { ++ case ELF32LEKind: ++ parseCompressedHeader<ELF32LE>(); ++ break; ++ case ELF32BEKind: ++ parseCompressedHeader<ELF32BE>(); ++ break; ++ case ELF64LEKind: ++ parseCompressedHeader<ELF64LE>(); ++ break; ++ case ELF64BEKind: ++ parseCompressedHeader<ELF64BE>(); ++ break; ++ default: ++ llvm_unreachable("unknown ELFT"); ++ } + } + } + +@@ -210,10 +225,7 @@ OutputSection *SectionBase::getOutputSection() { + // When a section is compressed, `rawData` consists with a header followed + // by zlib-compressed data. This function parses a header to initialize + // `uncompressedSize` member and remove the header from `rawData`. +-void InputSectionBase::parseCompressedHeader() { +- using Chdr64 = typename ELF64LE::Chdr; +- using Chdr32 = typename ELF32LE::Chdr; +- ++template <typename ELFT> void InputSectionBase::parseCompressedHeader() { + // Old-style header + if (name.startswith(".zdebug")) { + if (!toStringRef(rawData).startswith("ZLIB")) { +@@ -239,32 +251,13 @@ void InputSectionBase::parseCompressedHeader() { + assert(flags & SHF_COMPRESSED); + flags &= ~(uint64_t)SHF_COMPRESSED; + +- // New-style 64-bit header +- if (config->is64) { +- if (rawData.size() < sizeof(Chdr64)) { +- error(toString(this) + ": corrupted compressed section"); +- return; +- } +- +- auto *hdr = reinterpret_cast<const Chdr64 *>(rawData.data()); +- if (hdr->ch_type != ELFCOMPRESS_ZLIB) { +- error(toString(this) + ": unsupported compression type"); +- return; +- } +- +- uncompressedSize = hdr->ch_size; +- alignment = std::max<uint32_t>(hdr->ch_addralign, 1); +- rawData = rawData.slice(sizeof(*hdr)); +- return; +- } +- +- // New-style 32-bit header +- if (rawData.size() < sizeof(Chdr32)) { ++ // New-style header ++ if (rawData.size() < sizeof(typename ELFT::Chdr)) { + error(toString(this) + ": corrupted compressed section"); + return; + } + +- auto *hdr = reinterpret_cast<const Chdr32 *>(rawData.data()); ++ auto *hdr = reinterpret_cast<const typename ELFT::Chdr *>(rawData.data()); + if (hdr->ch_type != ELFCOMPRESS_ZLIB) { + error(toString(this) + ": unsupported compression type"); + return; +diff --git lld/ELF/InputSection.h lld/ELF/InputSection.h +index 5b91c1c90bd..c914d0b4215 100644 +--- lld/ELF/InputSection.h ++++ lld/ELF/InputSection.h +@@ -238,6 +238,7 @@ public: + } + + protected: ++ template <typename ELFT> + void parseCompressedHeader(); + void uncompress() const; + +diff --git lld/test/ELF/compressed-debug-input-err.s lld/test/ELF/compressed-debug-input-err.s +index 89773eca59d..0495a9eaa08 100644 +--- lld/test/ELF/compressed-debug-input-err.s ++++ lld/test/ELF/compressed-debug-input-err.s +@@ -3,6 +3,9 @@ + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o + # RUN: not ld.lld %t.o -o /dev/null -shared 2>&1 | FileCheck %s + ++# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-unknown %s -o %t-be.o ++# RUN: not ld.lld %t-be.o -o /dev/null -shared 2>&1 | FileCheck %s ++ + ## Check we are able to report zlib uncompress errors. + # CHECK: error: {{.*}}.o:(.debug_str): uncompress failed: zlib error: Z_DATA_ERROR + +diff --git lld/test/ELF/compressed-debug-input.s lld/test/ELF/compressed-debug-input.s +index c9bfd3e5162..5b61ea8b384 100644 +--- lld/test/ELF/compressed-debug-input.s ++++ lld/test/ELF/compressed-debug-input.s +@@ -1,7 +1,9 @@ + # REQUIRES: zlib, x86 + + # RUN: llvm-mc -compress-debug-sections=zlib -filetype=obj -triple=x86_64-unknown-linux %s -o %t ++# RUN: llvm-mc -compress-debug-sections=zlib -filetype=obj -triple=powerpc64-unknown-unknown %s -o %t-be + # RUN: llvm-readobj --sections %t | FileCheck -check-prefix=ZLIB %s ++# RUN: llvm-readobj --sections %t-be | FileCheck -check-prefix=ZLIB %s + # ZLIB: Section { + # ZLIB: Index: 2 + # ZLIB: Name: .debug_str +@@ -21,7 +23,9 @@ + # ZLIB-NEXT: } + + # RUN: llvm-mc -compress-debug-sections=zlib-gnu -filetype=obj -triple=x86_64-unknown-linux %s -o %t2 ++# RUN: llvm-mc -compress-debug-sections=zlib-gnu -filetype=obj -triple=powerpc64-unknown-unknown %s -o %t2-be + # RUN: llvm-readobj --sections %t2 | FileCheck -check-prefix=GNU %s ++# RUN: llvm-readobj --sections %t2-be | FileCheck -check-prefix=GNU %s + # GNU: Section { + # GNU: Index: 2 + # GNU: Name: .zdebug_str +@@ -41,9 +45,13 @@ + + # RUN: ld.lld --hash-style=sysv %t -o %t.so -shared + # RUN: llvm-readobj --sections --section-data %t.so | FileCheck -check-prefix=DATA %s ++# RUN: ld.lld --hash-style=sysv %t-be -o %t-be.so -shared ++# RUN: llvm-readobj --sections --section-data %t-be.so | FileCheck -check-prefix=DATA %s + + # RUN: ld.lld --hash-style=sysv %t2 -o %t2.so -shared + # RUN: llvm-readobj --sections --section-data %t2.so | FileCheck -check-prefix=DATA %s ++# RUN: ld.lld --hash-style=sysv %t2-be -o %t2-be.so -shared ++# RUN: llvm-readobj --sections --section-data %t2-be.so | FileCheck -check-prefix=DATA %s + + # DATA: Section { + # DATA: Index: 6 diff --git a/devel/llvm13/files/patch-lldb_CMakeLists.txt b/devel/llvm13/files/patch-lldb_CMakeLists.txt new file mode 100644 index 000000000000..4061414dff4c --- /dev/null +++ b/devel/llvm13/files/patch-lldb_CMakeLists.txt @@ -0,0 +1,12 @@ +Disable docs due to issues with auto-generated API docs + +--- lldb/CMakeLists.txt.orig ++++ lldb/CMakeLists.txt +@@ -73,7 +73,6 @@ + + add_subdirectory(source) + add_subdirectory(tools) +-add_subdirectory(docs) + + if (LLDB_ENABLE_PYTHON) + if(LLDB_BUILD_FRAMEWORK) diff --git a/devel/llvm13/files/patch-lldb_docs_conf.py b/devel/llvm13/files/patch-lldb_docs_conf.py new file mode 100644 index 000000000000..80007ecd83ba --- /dev/null +++ b/devel/llvm13/files/patch-lldb_docs_conf.py @@ -0,0 +1,15 @@ +--- lldb/docs/conf.py.orig ++++ lldb/docs/conf.py +@@ -97,9 +97,9 @@ + # Theme options are theme-specific and customize the look and feel of a theme + # further. For a list of options available for each theme, see the + # documentation. +-html_theme_options = { +- 'font_size': '11pt' +-} ++#html_theme_options = { ++# 'font_size': '11pt' ++#} + + # Add any paths that contain custom themes here, relative to this directory. + #html_theme_path = [] diff --git a/devel/llvm13/files/patch-llvm_lib_Transforms_Instrumentation_AddressSanitizer.cpp b/devel/llvm13/files/patch-llvm_lib_Transforms_Instrumentation_AddressSanitizer.cpp new file mode 100644 index 000000000000..dd0b84559177 --- /dev/null +++ b/devel/llvm13/files/patch-llvm_lib_Transforms_Instrumentation_AddressSanitizer.cpp @@ -0,0 +1,26 @@ +--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp.orig 2021-06-28 16:23:38 UTC ++++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +@@ -108,6 +108,7 @@ static const uint64_t kAArch64_ShadowOffset64 = 1ULL < + static const uint64_t kRISCV64_ShadowOffset64 = 0x20000000; + static const uint64_t kFreeBSD_ShadowOffset32 = 1ULL << 30; + static const uint64_t kFreeBSD_ShadowOffset64 = 1ULL << 46; ++static const uint64_t kFreeBSDKasan_ShadowOffset64 = 0xdffff7c000000000; + static const uint64_t kNetBSD_ShadowOffset32 = 1ULL << 30; + static const uint64_t kNetBSD_ShadowOffset64 = 1ULL << 46; + static const uint64_t kNetBSDKasan_ShadowOffset64 = 0xdfff900000000000; +@@ -484,9 +485,12 @@ static ShadowMapping getShadowMapping(Triple &TargetTr + Mapping.Offset = kPPC64_ShadowOffset64; + else if (IsSystemZ) + Mapping.Offset = kSystemZ_ShadowOffset64; +- else if (IsFreeBSD && !IsMIPS64) +- Mapping.Offset = kFreeBSD_ShadowOffset64; +- else if (IsNetBSD) { ++ else if (IsFreeBSD && !IsMIPS64) { ++ if (IsKasan) ++ Mapping.Offset = kFreeBSDKasan_ShadowOffset64; ++ else ++ Mapping.Offset = kFreeBSD_ShadowOffset64; ++ } else if (IsNetBSD) { + if (IsKasan) + Mapping.Offset = kNetBSDKasan_ShadowOffset64; + else diff --git a/devel/llvm13/files/xtoolchain.mk.in b/devel/llvm13/files/xtoolchain.mk.in new file mode 100644 index 000000000000..48e6ad176d8f --- /dev/null +++ b/devel/llvm13/files/xtoolchain.mk.in @@ -0,0 +1,6 @@ +XCC=%%LOCALBASE%%/bin/%%XCC%% +XCXX=%%LOCALBASE%%/bin/%%XCXX%% +XCPP=%%LOCALBASE%%/bin/%%XCPP%% +XLD=%%LOCALBASE%%/bin/%%XLD%% +CROSS_BINUTILS_PREFIX=/var/empty +X_COMPILER_TYPE=%%X_COMPILER_TYPE%% |