Update to llvm-13.0.0
Tested with partial bulk builds on amd64 and sparc64. Fixes from semarie@
This commit is contained in:
parent
a6eb2eb018
commit
bbfbad6b3e
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.287 2021/11/22 18:29:08 jca Exp $
|
||||
# $OpenBSD: Makefile,v 1.288 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
# XXX If broken on an architecture, remove the arch from LLVM_ARCHS.
|
||||
ONLY_FOR_ARCHS = ${LLVM_ARCHS}
|
||||
@ -11,23 +11,19 @@ COMMENT-python = Python bindings for Clang
|
||||
|
||||
# XXX: Remember to bump MODCLANG_VERSION in lang/clang/clang.port.mk when
|
||||
# updating this port.
|
||||
LLVM_V = 11.1.0
|
||||
LLVM_V = 13.0.0
|
||||
DISTNAME = llvm-${LLVM_V}.src
|
||||
PKGNAME = llvm-${LLVM_V}
|
||||
PKGSPEC-main = llvm-=${LLVM_V}
|
||||
PKGNAME-python = py3-llvm-${LLVM_V}
|
||||
PKGNAME-lldb = lldb-${LLVM_V}
|
||||
REVISION-main = 9
|
||||
REVISION-lldb = 1
|
||||
# XXX -main depends on python, is that right?
|
||||
REVISION-python = 1
|
||||
|
||||
CATEGORIES = devel
|
||||
|
||||
SHARED_LIBS = clang 8.1 \
|
||||
clang-cpp 0.0 \
|
||||
lldb 2.0 \
|
||||
LTO 6.0 \
|
||||
SHARED_LIBS = clang 8.2 \
|
||||
clang-cpp 1.0 \
|
||||
lldb 3.0 \
|
||||
LTO 6.1 \
|
||||
Remarks 0.0
|
||||
|
||||
# packager notes in http://llvm.org/docs/Packaging.html
|
||||
@ -53,7 +49,9 @@ MODULES = devel/cmake \
|
||||
|
||||
MODPY_ADJ_FILES = tools/clang/tools/clang-format/git-clang-format \
|
||||
tools/clang/tools/scan-view/bin/scan-view \
|
||||
tools/clang/utils/hmaptool/hmaptool
|
||||
tools/clang/utils/hmaptool/hmaptool \
|
||||
tools/clang/tools/scan-build-py/bin/* \
|
||||
tools/clang/tools/scan-build-py/libexec/*
|
||||
|
||||
TEST_DEPENDS = devel/dejagnu \
|
||||
shells/bash
|
||||
@ -91,7 +89,6 @@ CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=False \
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_LibXml2:Bool=True \
|
||||
-DLLVM_LINK_LLVM_DYLIB:Bool=True \
|
||||
-DLLVM_BUILD_LLVM_DYLIB:Bool=True \
|
||||
-DEPYDOC_EXECUTABLE=EPYDOC_EXECUTABLE-NOTFOUND \
|
||||
-DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND \
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Backtrace:Bool=True \
|
||||
-DLLDB_USE_SYSTEM_SIX=ON \
|
||||
@ -126,14 +123,24 @@ GCC_CONFIG = ${MACHINE_ARCH}-unknown-openbsd${OSREV}
|
||||
CLANG_INCLUDE_PATH = lib/clang/${LLVM_V}/include
|
||||
SUBST_VARS += CLANG_INCLUDE_PATH LLVM_V GCC_VER GCC_CONFIG
|
||||
|
||||
# hack to disable the use of -Bsymbolic-functions
|
||||
.if ${PROPERTIES:Mlld}
|
||||
OPENBSD_LD_IS_LLD = TRUE
|
||||
.else
|
||||
OPENBSD_LD_IS_LLD = FALSE
|
||||
.endif
|
||||
SUBST_VARS += OPENBSD_LD_IS_LLD
|
||||
|
||||
post-extract:
|
||||
mv ${WRKDIR}/clang-${LLVM_V}.src ${WRKSRC}/tools/clang
|
||||
mv ${WRKDIR}/lld-${LLVM_V}.src ${WRKSRC}/tools/lld
|
||||
mv ${WRKDIR}/lldb-${LLVM_V}.src ${WRKSRC}/tools/lldb
|
||||
|
||||
pre-configure:
|
||||
@${SUBST_CMD} ${WRKSRC}/tools/clang/lib/Driver/ToolChains/OpenBSD.cpp \
|
||||
${WRKSRC}/cmake/modules/LLVMProcessSources.cmake
|
||||
@${SUBST_CMD} ${WRKSRC}/tools/clang/lib/Driver/ToolChains/OpenBSD.cpp
|
||||
@${SUBST_CMD} ${WRKSRC}/cmake/modules/LLVMProcessSources.cmake
|
||||
@${SUBST_CMD} ${WRKSRC}/tools/clang/tools/clang-shlib/CMakeLists.txt
|
||||
@${SUBST_CMD} ${WRKSRC}/tools/llvm-shlib/CMakeLists.txt
|
||||
-@ln -s ${MODPY_BIN} ${WRKDIR}/bin/python
|
||||
|
||||
post-build:
|
||||
@ -148,7 +155,10 @@ post-install:
|
||||
${INSTALL_DATA} ${WRKSRC}/tools/clang/bindings/python/clang/* \
|
||||
${PREFIX}/lib/python${MODPY_VERSION}/site-packages/clang
|
||||
${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
|
||||
${PREFIX}/lib/python${MODPY_VERSION}/site-packages/
|
||||
${PREFIX}/lib/libear/ \
|
||||
${PREFIX}/lib/libscanbuild/ \
|
||||
${PREFIX}/lib/python${MODPY_VERSION}/site-packages/ \
|
||||
${PREFIX}/share/
|
||||
${INSTALL_DATA} ${WRKSRC}/docs/_build/man/* \
|
||||
${PREFIX}/man/man1
|
||||
${INSTALL_DATA} ${WRKSRC}/tools/clang/docs/_build/man/clang.1 \
|
||||
|
@ -1,8 +1,8 @@
|
||||
SHA256 (clang-11.1.0.src.tar.xz) = CoKI8GXR9Xy22W2k0pZcvqMu3FcqqXLkZulU0XFIVYs=
|
||||
SHA256 (lld-11.1.0.src.tar.xz) = AXp4jL4ezEqUmr8QdVhwUZCG0Fii6Z9DiCmu8k8MZs4=
|
||||
SHA256 (lldb-11.1.0.src.tar.xz) = snNICrRtMuvWV1LpviKdqMeUDRWPoYX7IM/6VgJ4nu4=
|
||||
SHA256 (llvm-11.1.0.src.tar.xz) = zoUI4xigGmPU6LMJCrLe08WYpQJYzEniYluRINTAPqU=
|
||||
SIZE (clang-11.1.0.src.tar.xz) = 14850272
|
||||
SIZE (lld-11.1.0.src.tar.xz) = 1237068
|
||||
SIZE (lldb-11.1.0.src.tar.xz) = 9706580
|
||||
SIZE (llvm-11.1.0.src.tar.xz) = 38915280
|
||||
SHA256 (clang-13.0.0.src.tar.xz) = XWEcuwbPtmJr5G6y8j0AOyuA9AGCiY2qVLHE6LW54X4=
|
||||
SHA256 (lld-13.0.0.src.tar.xz) = INGQC81k/2IEcpH27ba6L+0014JnX/aHE78ML8nmk4Y=
|
||||
SHA256 (lldb-13.0.0.src.tar.xz) = JMZb1ewNfLw3uv3XUzsXgzUnCL9jOMQDpy9HiE5Abb0=
|
||||
SHA256 (llvm-13.0.0.src.tar.xz) = QI0RcIZD6oJvUZ/3l2H838EtZBolECKe7EWecvgWMCA=
|
||||
SIZE (clang-13.0.0.src.tar.xz) = 17846828
|
||||
SIZE (lld-13.0.0.src.tar.xz) = 1472476
|
||||
SIZE (lldb-13.0.0.src.tar.xz) = 9905788
|
||||
SIZE (llvm-13.0.0.src.tar.xz) = 45471992
|
||||
|
16
devel/llvm/patches/patch-cmake_modules_GetLibraryName_cmake
Normal file
16
devel/llvm/patches/patch-cmake_modules_GetLibraryName_cmake
Normal file
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-cmake_modules_GetLibraryName_cmake,v 1.1 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Properly parse library suffixes on OpenBSD
|
||||
|
||||
Index: cmake/modules/GetLibraryName.cmake
|
||||
--- cmake/modules/GetLibraryName.cmake.orig
|
||||
+++ cmake/modules/GetLibraryName.cmake
|
||||
@@ -2,7 +2,7 @@
|
||||
function(get_library_name path name)
|
||||
get_filename_component(path ${path} NAME)
|
||||
set(prefixes ${CMAKE_FIND_LIBRARY_PREFIXES})
|
||||
- set(suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
+ set(suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES} ".so.[0-9]+.[0-9]+")
|
||||
list(FILTER prefixes EXCLUDE REGEX "^\\s*$")
|
||||
list(FILTER suffixes EXCLUDE REGEX "^\\s*$")
|
||||
if(prefixes)
|
@ -1,16 +0,0 @@
|
||||
$OpenBSD: patch-include_llvm_BinaryFormat_Dwarf_def,v 1.6 2021/05/13 23:54:24 jca Exp $
|
||||
|
||||
implement -msave-args in clang/llvm, like the sun did for gcc
|
||||
|
||||
Index: include/llvm/BinaryFormat/Dwarf.def
|
||||
--- include/llvm/BinaryFormat/Dwarf.def.orig
|
||||
+++ include/llvm/BinaryFormat/Dwarf.def
|
||||
@@ -393,6 +393,8 @@ HANDLE_DW_AT(0x2133, GNU_addr_base, 0, GNU)
|
||||
HANDLE_DW_AT(0x2134, GNU_pubnames, 0, GNU)
|
||||
HANDLE_DW_AT(0x2135, GNU_pubtypes, 0, GNU)
|
||||
HANDLE_DW_AT(0x2136, GNU_discriminator, 0, GNU)
|
||||
+// Sun Extension
|
||||
+HANDLE_DW_AT(0x2224, SUN_amd64_parmdump, 0, GNU)
|
||||
// Borland extensions.
|
||||
HANDLE_DW_AT(0x3b11, BORLAND_property_read, 0, BORLAND)
|
||||
HANDLE_DW_AT(0x3b12, BORLAND_property_write, 0, BORLAND)
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-include_llvm_CodeGen_AsmPrinter_h,v 1.7 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-include_llvm_CodeGen_AsmPrinter_h,v 1.8 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Use int3 trap padding between functions instead of trapsleds with a leading jump.
|
||||
|
||||
Index: include/llvm/CodeGen/AsmPrinter.h
|
||||
--- include/llvm/CodeGen/AsmPrinter.h.orig
|
||||
+++ include/llvm/CodeGen/AsmPrinter.h
|
||||
@@ -375,6 +375,11 @@ class AsmPrinter : public MachineFunctionPass { (publi
|
||||
@@ -434,6 +434,11 @@ class AsmPrinter : public MachineFunctionPass { (publi
|
||||
/// correctness.
|
||||
void emitAlignment(Align Alignment, const GlobalObject *GV = nullptr) const;
|
||||
|
||||
@ -17,7 +17,7 @@ Index: include/llvm/CodeGen/AsmPrinter.h
|
||||
/// Lower the specified LLVM Constant to an MCExpr.
|
||||
virtual const MCExpr *lowerConstant(const Constant *CV);
|
||||
|
||||
@@ -435,6 +440,11 @@ class AsmPrinter : public MachineFunctionPass { (publi
|
||||
@@ -499,6 +504,11 @@ class AsmPrinter : public MachineFunctionPass { (publi
|
||||
virtual void emitInstruction(const MachineInstr *) {
|
||||
llvm_unreachable("EmitInstruction not implemented");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-include_llvm_CodeGen_MachineFrameInfo_h,v 1.5 2020/08/05 06:49:48 jca Exp $
|
||||
$OpenBSD: patch-include_llvm_CodeGen_MachineFrameInfo_h,v 1.6 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -22,7 +22,7 @@ $OpenBSD: patch-include_llvm_CodeGen_MachineFrameInfo_h,v 1.5 2020/08/05 06:49:4
|
||||
Index: include/llvm/CodeGen/MachineFrameInfo.h
|
||||
--- include/llvm/CodeGen/MachineFrameInfo.h.orig
|
||||
+++ include/llvm/CodeGen/MachineFrameInfo.h
|
||||
@@ -273,6 +273,15 @@ class MachineFrameInfo { (private)
|
||||
@@ -274,6 +274,15 @@ class MachineFrameInfo { (private)
|
||||
/// The frame index for the stack protector.
|
||||
int StackProtectorIdx = -1;
|
||||
|
||||
@ -38,7 +38,7 @@ Index: include/llvm/CodeGen/MachineFrameInfo.h
|
||||
/// The frame index for the function context. Used for SjLj exceptions.
|
||||
int FunctionContextIdx = -1;
|
||||
|
||||
@@ -353,6 +362,17 @@ class MachineFrameInfo { (private)
|
||||
@@ -354,6 +363,17 @@ class MachineFrameInfo { (private)
|
||||
int getStackProtectorIndex() const { return StackProtectorIdx; }
|
||||
void setStackProtectorIndex(int I) { StackProtectorIdx = I; }
|
||||
bool hasStackProtectorIndex() const { return StackProtectorIdx != -1; }
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-include_llvm_CodeGen_Passes_h,v 1.4 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-include_llvm_CodeGen_Passes_h,v 1.5 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -21,7 +21,7 @@ remove these gadgets will continue through other mechanisms.
|
||||
Index: include/llvm/CodeGen/Passes.h
|
||||
--- include/llvm/CodeGen/Passes.h.orig
|
||||
+++ include/llvm/CodeGen/Passes.h
|
||||
@@ -334,6 +334,9 @@ namespace llvm {
|
||||
@@ -353,6 +353,9 @@ namespace llvm {
|
||||
///
|
||||
FunctionPass *createStackProtectorPass();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-include_llvm_CodeGen_TargetFrameLowering_h,v 1.6 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-include_llvm_CodeGen_TargetFrameLowering_h,v 1.7 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -27,10 +27,10 @@ Index: include/llvm/CodeGen/TargetFrameLowering.h
|
||||
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
+#include "llvm/CodeGen/ReturnProtectorLowering.h"
|
||||
#include "llvm/Support/TypeSize.h"
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@@ -207,6 +208,10 @@ class TargetFrameLowering { (public)
|
||||
@@ -209,6 +210,10 @@ class TargetFrameLowering { (public)
|
||||
MachineBasicBlock &MBB) const = 0;
|
||||
virtual void emitEpilogue(MachineFunction &MF,
|
||||
MachineBasicBlock &MBB) const = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-include_llvm_InitializePasses_h,v 1.5 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-include_llvm_InitializePasses_h,v 1.6 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -21,9 +21,9 @@ remove these gadgets will continue through other mechanisms.
|
||||
Index: include/llvm/InitializePasses.h
|
||||
--- include/llvm/InitializePasses.h.orig
|
||||
+++ include/llvm/InitializePasses.h
|
||||
@@ -372,6 +372,7 @@ void initializeRegionViewerPass(PassRegistry&);
|
||||
void initializeRegisterCoalescerPass(PassRegistry&);
|
||||
@@ -387,6 +387,7 @@ void initializeRemoveRedundantDebugValuesPass(PassRegi
|
||||
void initializeRenameIndependentSubregsPass(PassRegistry&);
|
||||
void initializeReplaceWithVeclibLegacyPass(PassRegistry &);
|
||||
void initializeResetMachineFunctionPass(PassRegistry&);
|
||||
+void initializeReturnProtectorPass(PassRegistry&);
|
||||
void initializeReversePostOrderFunctionAttrsLegacyPassPass(PassRegistry&);
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_CodeGen_AsmPrinter_AsmPrinter_cpp,v 1.12 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_CodeGen_AsmPrinter_AsmPrinter_cpp,v 1.13 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Use int3 trap padding between functions instead of trapsleds with a leading jump.
|
||||
- Emit trap alignment between basic blocks that are unreachable via
|
||||
@ -8,7 +8,7 @@ $OpenBSD: patch-lib_CodeGen_AsmPrinter_AsmPrinter_cpp,v 1.12 2021/05/13 23:54:24
|
||||
Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp
|
||||
--- lib/CodeGen/AsmPrinter/AsmPrinter.cpp.orig
|
||||
+++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp
|
||||
@@ -687,7 +687,7 @@ void AsmPrinter::emitFunctionHeader() {
|
||||
@@ -745,7 +745,7 @@ void AsmPrinter::emitFunctionHeader() {
|
||||
|
||||
emitLinkage(&F, CurrentFnSym);
|
||||
if (MAI->hasFunctionAlignment())
|
||||
@ -17,7 +17,7 @@ Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp
|
||||
|
||||
if (MAI->hasDotTypeDotSizeDirective())
|
||||
OutStreamer->emitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
|
||||
@@ -2256,6 +2256,30 @@ void AsmPrinter::emitAlignment(Align Alignment, const
|
||||
@@ -2462,6 +2462,30 @@ void AsmPrinter::emitAlignment(Align Alignment, const
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -48,7 +48,7 @@ Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp
|
||||
// Constant emission.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -3020,10 +3044,17 @@ void AsmPrinter::emitBasicBlockStart(const MachineBasi
|
||||
@@ -3246,10 +3270,17 @@ void AsmPrinter::emitBasicBlockStart(const MachineBasi
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,5 +66,5 @@ Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp
|
||||
+ emitTrapAlignment(Alignment);
|
||||
+ }
|
||||
|
||||
// If the block has its address taken, emit any labels that were used to
|
||||
// reference the block. It is possible that there is more than one label
|
||||
// Switch to a new section if this basic block must begin a section. The
|
||||
// entry block is always placed in the function section and is handled
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_CodeGen_CMakeLists_txt,v 1.6 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_CodeGen_CMakeLists_txt,v 1.7 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -22,12 +22,12 @@ $OpenBSD: patch-lib_CodeGen_CMakeLists_txt,v 1.6 2021/05/13 23:54:24 jca Exp $
|
||||
Index: lib/CodeGen/CMakeLists.txt
|
||||
--- lib/CodeGen/CMakeLists.txt.orig
|
||||
+++ lib/CodeGen/CMakeLists.txt
|
||||
@@ -142,6 +142,8 @@ add_llvm_component_library(LLVMCodeGen
|
||||
RegUsageInfoCollector.cpp
|
||||
@@ -153,6 +153,8 @@ add_llvm_component_library(LLVMCodeGen
|
||||
RegUsageInfoPropagate.cpp
|
||||
ReplaceWithVeclib.cpp
|
||||
ResetMachineFunctionPass.cpp
|
||||
+ ReturnProtectorLowering.cpp
|
||||
+ ReturnProtectorPass.cpp
|
||||
SafeStack.cpp
|
||||
SafeStackLayout.cpp
|
||||
ScalarizeMaskedMemIntrin.cpp
|
||||
ScheduleDAG.cpp
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_CodeGen_PrologEpilogInserter_cpp,v 1.6 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_CodeGen_PrologEpilogInserter_cpp,v 1.7 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -22,7 +22,7 @@ $OpenBSD: patch-lib_CodeGen_PrologEpilogInserter_cpp,v 1.6 2021/05/13 23:54:24 j
|
||||
Index: lib/CodeGen/PrologEpilogInserter.cpp
|
||||
--- lib/CodeGen/PrologEpilogInserter.cpp.orig
|
||||
+++ lib/CodeGen/PrologEpilogInserter.cpp
|
||||
@@ -217,7 +217,11 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) {
|
||||
@@ -213,7 +213,11 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) {
|
||||
const Function &F = MF.getFunction();
|
||||
const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
|
||||
const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering();
|
||||
@ -34,7 +34,7 @@ Index: lib/CodeGen/PrologEpilogInserter.cpp
|
||||
RS = TRI->requiresRegisterScavenging(MF) ? new RegScavenger() : nullptr;
|
||||
FrameIndexVirtualScavenging = TRI->requiresFrameIndexScavenging(MF);
|
||||
ORE = &getAnalysis<MachineOptimizationRemarkEmitterPass>().getORE();
|
||||
@@ -255,6 +259,10 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) {
|
||||
@@ -251,6 +255,10 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) {
|
||||
if (!F.hasFnAttribute(Attribute::Naked))
|
||||
insertPrologEpilogCode(MF);
|
||||
|
||||
@ -45,7 +45,7 @@ Index: lib/CodeGen/PrologEpilogInserter.cpp
|
||||
// Reinsert stashed debug values at the start of the entry blocks.
|
||||
for (auto &I : EntryDbgValues)
|
||||
I.first->insert(I.first->begin(), I.second.begin(), I.second.end());
|
||||
@@ -353,7 +361,9 @@ void PEI::calculateCallFrameInfo(MachineFunction &MF)
|
||||
@@ -357,7 +365,9 @@ void PEI::calculateCallFrameInfo(MachineFunction &MF)
|
||||
/// Compute the sets of entry and return blocks for saving and restoring
|
||||
/// callee-saved registers, and placing prolog and epilog code.
|
||||
void PEI::calculateSaveRestoreBlocks(MachineFunction &MF) {
|
||||
@ -56,7 +56,7 @@ Index: lib/CodeGen/PrologEpilogInserter.cpp
|
||||
|
||||
// Even when we do not change any CSR, we still want to insert the
|
||||
// prologue and epilogue of the function.
|
||||
@@ -369,7 +379,18 @@ void PEI::calculateSaveRestoreBlocks(MachineFunction &
|
||||
@@ -373,7 +383,18 @@ void PEI::calculateSaveRestoreBlocks(MachineFunction &
|
||||
// epilogue.
|
||||
if (!RestoreBlock->succ_empty() || RestoreBlock->isReturnBlock())
|
||||
RestoreBlocks.push_back(RestoreBlock);
|
||||
@ -76,7 +76,7 @@ Index: lib/CodeGen/PrologEpilogInserter.cpp
|
||||
}
|
||||
|
||||
// Save refs to entry and return blocks.
|
||||
@@ -380,6 +401,9 @@ void PEI::calculateSaveRestoreBlocks(MachineFunction &
|
||||
@@ -384,6 +405,9 @@ void PEI::calculateSaveRestoreBlocks(MachineFunction &
|
||||
if (MBB.isReturnBlock())
|
||||
RestoreBlocks.push_back(&MBB);
|
||||
}
|
||||
@ -86,7 +86,7 @@ Index: lib/CodeGen/PrologEpilogInserter.cpp
|
||||
}
|
||||
|
||||
static void assignCalleeSavedSpillSlots(MachineFunction &F,
|
||||
@@ -401,6 +425,10 @@ static void assignCalleeSavedSpillSlots(MachineFunctio
|
||||
@@ -405,6 +429,10 @@ static void assignCalleeSavedSpillSlots(MachineFunctio
|
||||
|
||||
const TargetFrameLowering *TFI = F.getSubtarget().getFrameLowering();
|
||||
MachineFrameInfo &MFI = F.getFrameInfo();
|
||||
@ -94,6 +94,6 @@ Index: lib/CodeGen/PrologEpilogInserter.cpp
|
||||
+ if (TFI->getReturnProtector())
|
||||
+ TFI->getReturnProtector()->saveReturnProtectorRegister(F, CSI);
|
||||
+
|
||||
if (!TFI->assignCalleeSavedSpillSlots(F, RegInfo, CSI)) {
|
||||
if (!TFI->assignCalleeSavedSpillSlots(F, RegInfo, CSI, MinCSFrameIndex,
|
||||
MaxCSFrameIndex)) {
|
||||
// If target doesn't implement this, use generic code.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_CodeGen_TargetPassConfig_cpp,v 1.5 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_CodeGen_TargetPassConfig_cpp,v 1.6 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -21,7 +21,7 @@ remove these gadgets will continue through other mechanisms.
|
||||
Index: lib/CodeGen/TargetPassConfig.cpp
|
||||
--- lib/CodeGen/TargetPassConfig.cpp.orig
|
||||
+++ lib/CodeGen/TargetPassConfig.cpp
|
||||
@@ -773,6 +773,8 @@ void TargetPassConfig::addISelPrepare() {
|
||||
@@ -950,6 +950,8 @@ void TargetPassConfig::addISelPrepare() {
|
||||
if (requiresCodeGenSCCOrder())
|
||||
addPass(new DummyCGSCCPass);
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_MC_MCELFStreamer_cpp,v 1.8 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_MC_MCELFStreamer_cpp,v 1.9 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
getNonexecutableStackSection() may return nullptr.
|
||||
|
||||
Index: lib/MC/MCELFStreamer.cpp
|
||||
--- lib/MC/MCELFStreamer.cpp.orig
|
||||
+++ lib/MC/MCELFStreamer.cpp
|
||||
@@ -92,8 +92,11 @@ void MCELFStreamer::InitSections(bool NoExecStack) {
|
||||
@@ -93,8 +93,11 @@ void MCELFStreamer::InitSections(bool NoExecStack) {
|
||||
SwitchSection(Ctx.getObjectFileInfo()->getTextSection());
|
||||
emitCodeAlignment(4);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_MC_MCParser_AsmParser_cpp,v 1.9 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_MC_MCParser_AsmParser_cpp,v 1.10 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
make clang include a FILE symbol for .(s|S) files
|
||||
|
||||
@ -11,7 +11,7 @@ a file directive.
|
||||
Index: lib/MC/MCParser/AsmParser.cpp
|
||||
--- lib/MC/MCParser/AsmParser.cpp.orig
|
||||
+++ lib/MC/MCParser/AsmParser.cpp
|
||||
@@ -909,6 +909,10 @@ bool AsmParser::Run(bool NoInitialTextSection, bool No
|
||||
@@ -975,6 +975,10 @@ bool AsmParser::Run(bool NoInitialTextSection, bool No
|
||||
(void)InsertResult;
|
||||
}
|
||||
|
||||
@ -19,6 +19,6 @@ Index: lib/MC/MCParser/AsmParser.cpp
|
||||
+ if (!Filename.empty() && (Filename.compare(StringRef("-")) != 0))
|
||||
+ Out.emitFileDirective(Filename);
|
||||
+
|
||||
getTargetParser().onBeginOfFile();
|
||||
|
||||
// While we have input, parse each statement.
|
||||
while (Lexer.isNot(AsmToken::Eof)) {
|
||||
ParseStatementInfo Info(&AsmStrRewrites);
|
||||
|
@ -1,16 +0,0 @@
|
||||
$OpenBSD: patch-lib_Support_CMakeLists_txt,v 1.3 2021/05/13 23:54:24 jca Exp $
|
||||
|
||||
For upstream:
|
||||
bogus dep on all headers in ${Backtrace_INCLUDE_DIRS} ie /usr/local/include.
|
||||
|
||||
Index: lib/Support/CMakeLists.txt
|
||||
--- lib/Support/CMakeLists.txt.orig
|
||||
+++ lib/Support/CMakeLists.txt
|
||||
@@ -193,7 +193,6 @@ add_llvm_component_library(LLVMSupport
|
||||
Windows
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Support
|
||||
- ${Backtrace_INCLUDE_DIRS}
|
||||
LINK_LIBS ${system_libs} ${delayload_flags} ${Z3_LINK_FILES}
|
||||
)
|
||||
|
@ -1,13 +1,13 @@
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64AsmPrinter_cpp,v 1.5 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64AsmPrinter_cpp,v 1.6 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add retguard for arm64.
|
||||
|
||||
Index: lib/Target/AArch64/AArch64AsmPrinter.cpp
|
||||
--- lib/Target/AArch64/AArch64AsmPrinter.cpp.orig
|
||||
+++ lib/Target/AArch64/AArch64AsmPrinter.cpp
|
||||
@@ -1350,6 +1350,19 @@ void AArch64AsmPrinter::emitInstruction(const MachineI
|
||||
@@ -1488,6 +1488,19 @@ void AArch64AsmPrinter::emitInstruction(const MachineI
|
||||
case AArch64::SEH_EpilogEnd:
|
||||
TS->EmitARM64WinCFIEpilogEnd();
|
||||
TS->emitARM64WinCFIEpilogEnd();
|
||||
return;
|
||||
+
|
||||
+ case AArch64::RETGUARD_JMP_TRAP:
|
||||
|
@ -1,19 +1,19 @@
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64FrameLowering_cpp,v 1.6 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64FrameLowering_cpp,v 1.7 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add retguard for arm64.
|
||||
|
||||
Index: lib/Target/AArch64/AArch64FrameLowering.cpp
|
||||
--- lib/Target/AArch64/AArch64FrameLowering.cpp.orig
|
||||
+++ lib/Target/AArch64/AArch64FrameLowering.cpp
|
||||
@@ -116,6 +116,7 @@
|
||||
@@ -123,6 +123,7 @@
|
||||
#include "AArch64InstrInfo.h"
|
||||
#include "AArch64MachineFunctionInfo.h"
|
||||
#include "AArch64RegisterInfo.h"
|
||||
+#include "AArch64ReturnProtectorLowering.h"
|
||||
#include "AArch64StackOffset.h"
|
||||
#include "AArch64Subtarget.h"
|
||||
#include "AArch64TargetMachine.h"
|
||||
@@ -2521,6 +2522,10 @@ void AArch64FrameLowering::determineCalleeSaves(Machin
|
||||
#include "MCTargetDesc/AArch64AddressingModes.h"
|
||||
@@ -2753,6 +2754,10 @@ void AArch64FrameLowering::determineCalleeSaves(Machin
|
||||
? RegInfo->getBaseRegister()
|
||||
: (unsigned)AArch64::NoRegister;
|
||||
|
||||
@ -24,7 +24,7 @@ Index: lib/Target/AArch64/AArch64FrameLowering.cpp
|
||||
unsigned ExtraCSSpill = 0;
|
||||
// Figure out which callee-saved registers to save/restore.
|
||||
for (unsigned i = 0; CSRegs[i]; ++i) {
|
||||
@@ -3251,4 +3256,8 @@ unsigned AArch64FrameLowering::getWinEHFuncletFrameSiz
|
||||
@@ -3532,6 +3537,10 @@ unsigned AArch64FrameLowering::getWinEHFuncletFrameSiz
|
||||
// This is the amount of stack a funclet needs to allocate.
|
||||
return alignTo(CSSize + MF.getFrameInfo().getMaxCallFrameSize(),
|
||||
getStackAlign());
|
||||
@ -33,3 +33,5 @@ Index: lib/Target/AArch64/AArch64FrameLowering.cpp
|
||||
+const ReturnProtectorLowering *AArch64FrameLowering::getReturnProtector() const {
|
||||
+ return &RPL;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64FrameLowering_h,v 1.3 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64FrameLowering_h,v 1.4 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add retguard for arm64.
|
||||
|
||||
@ -10,7 +10,7 @@ Index: lib/Target/AArch64/AArch64FrameLowering.h
|
||||
#define LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
|
||||
|
||||
+#include "AArch64ReturnProtectorLowering.h"
|
||||
#include "AArch64StackOffset.h"
|
||||
#include "llvm/Support/TypeSize.h"
|
||||
#include "llvm/CodeGen/TargetFrameLowering.h"
|
||||
|
||||
@@ -22,9 +23,12 @@ class MCCFIInstruction;
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64ISelLowering_cpp,v 1.12 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64ISelLowering_cpp,v 1.13 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Disable the Load Stack Guard for OpenBSD on AArch64. We don't use it
|
||||
on any other platform and it causes a segfault in combination with our
|
||||
@ -7,7 +7,7 @@ IR Stack Guard.
|
||||
Index: lib/Target/AArch64/AArch64ISelLowering.cpp
|
||||
--- lib/Target/AArch64/AArch64ISelLowering.cpp.orig
|
||||
+++ lib/Target/AArch64/AArch64ISelLowering.cpp
|
||||
@@ -14558,7 +14558,8 @@ void AArch64TargetLowering::ReplaceNodeResults(
|
||||
@@ -17364,7 +17364,8 @@ void AArch64TargetLowering::ReplaceNodeResults(
|
||||
}
|
||||
|
||||
bool AArch64TargetLowering::useLoadStackGuardNode() const {
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64InstrInfo_cpp,v 1.1 2020/08/05 06:49:48 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64InstrInfo_cpp,v 1.2 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
XXX no comment
|
||||
|
||||
Index: lib/Target/AArch64/AArch64InstrInfo.cpp
|
||||
--- lib/Target/AArch64/AArch64InstrInfo.cpp.orig
|
||||
+++ lib/Target/AArch64/AArch64InstrInfo.cpp
|
||||
@@ -96,6 +96,9 @@ unsigned AArch64InstrInfo::getInstSizeInBytes(const Ma
|
||||
@@ -97,6 +97,9 @@ unsigned AArch64InstrInfo::getInstSizeInBytes(const Ma
|
||||
default:
|
||||
// Anything not explicitly designated otherwise is a normal 4-byte insn.
|
||||
NumBytes = 4;
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64InstrInfo_td,v 1.5 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64InstrInfo_td,v 1.6 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add retguard for arm64.
|
||||
|
||||
Index: lib/Target/AArch64/AArch64InstrInfo.td
|
||||
--- lib/Target/AArch64/AArch64InstrInfo.td.orig
|
||||
+++ lib/Target/AArch64/AArch64InstrInfo.td
|
||||
@@ -678,6 +678,14 @@ def ADDlowTLS
|
||||
@@ -721,6 +721,14 @@ def ADDlowTLS
|
||||
|
||||
} // isReMaterializable, isCodeGenOnly
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64Subtarget_h,v 1.8 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64Subtarget_h,v 1.9 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Disable the Load Stack Guard for OpenBSD on AArch64. We don't use it
|
||||
on any other platform and it causes a segfault in combination with our
|
||||
@ -7,7 +7,7 @@ IR Stack Guard.
|
||||
Index: lib/Target/AArch64/AArch64Subtarget.h
|
||||
--- lib/Target/AArch64/AArch64Subtarget.h.orig
|
||||
+++ lib/Target/AArch64/AArch64Subtarget.h
|
||||
@@ -453,6 +453,7 @@ class AArch64Subtarget final : public AArch64GenSubtar
|
||||
@@ -500,6 +500,7 @@ class AArch64Subtarget final : public AArch64GenSubtar
|
||||
bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
|
||||
bool isTargetIOS() const { return TargetTriple.isiOS(); }
|
||||
bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64TargetMachine_cpp,v 1.3 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_AArch64_AArch64TargetMachine_cpp,v 1.4 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Always disable GlobalISel on aarch64, fixes a crash when building on
|
||||
aarch64 without retguard, with a stack protector and without
|
||||
@ -7,11 +7,11 @@ optimizations.
|
||||
Index: lib/Target/AArch64/AArch64TargetMachine.cpp
|
||||
--- lib/Target/AArch64/AArch64TargetMachine.cpp.orig
|
||||
+++ lib/Target/AArch64/AArch64TargetMachine.cpp
|
||||
@@ -308,6 +308,7 @@ AArch64TargetMachine::AArch64TargetMachine(const Targe
|
||||
@@ -332,6 +332,7 @@ AArch64TargetMachine::AArch64TargetMachine(const Targe
|
||||
// Enable GlobalISel at or below EnableGlobalISelAt0, unless this is
|
||||
// MachO/CodeModel::Large, which GlobalISel does not support.
|
||||
if (getOptLevel() <= EnableGlobalISelAtO &&
|
||||
+ !getTargetTriple().isOSOpenBSD() &&
|
||||
TT.getArch() != Triple::aarch64_32 &&
|
||||
TT.getEnvironment() != Triple::GNUILP32 &&
|
||||
!(getCodeModel() == CodeModel::Large && TT.isOSBinFormatMachO())) {
|
||||
setGlobalISel(true);
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_AArch64_CMakeLists_txt,v 1.4 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_AArch64_CMakeLists_txt,v 1.5 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add retguard for arm64.
|
||||
|
||||
Index: lib/Target/AArch64/CMakeLists.txt
|
||||
--- lib/Target/AArch64/CMakeLists.txt.orig
|
||||
+++ lib/Target/AArch64/CMakeLists.txt
|
||||
@@ -59,6 +59,7 @@ add_llvm_target(AArch64CodeGen
|
||||
@@ -70,6 +70,7 @@ add_llvm_target(AArch64CodeGen
|
||||
AArch64PromoteConstant.cpp
|
||||
AArch64PBQPRegAlloc.cpp
|
||||
AArch64RegisterInfo.cpp
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_Mips_CMakeLists_txt,v 1.3 2020/12/21 21:38:51 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_Mips_CMakeLists_txt,v 1.4 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Adapt the -mfix-loongson2f-btb workaround from as(1) to LLVM/clang.
|
||||
- Add retguard for octeon/mips64.
|
||||
@ -6,7 +6,7 @@ $OpenBSD: patch-lib_Target_Mips_CMakeLists_txt,v 1.3 2020/12/21 21:38:51 jca Exp
|
||||
Index: lib/Target/Mips/CMakeLists.txt
|
||||
--- lib/Target/Mips/CMakeLists.txt.orig
|
||||
+++ lib/Target/Mips/CMakeLists.txt
|
||||
@@ -39,6 +39,7 @@ add_llvm_target(MipsCodeGen
|
||||
@@ -41,6 +41,7 @@ add_llvm_target(MipsCodeGen
|
||||
MipsISelLowering.cpp
|
||||
MipsFrameLowering.cpp
|
||||
MipsLegalizerInfo.cpp
|
||||
@ -14,7 +14,7 @@ Index: lib/Target/Mips/CMakeLists.txt
|
||||
MipsBranchExpansion.cpp
|
||||
MipsMCInstLower.cpp
|
||||
MipsMachineFunction.cpp
|
||||
@@ -48,6 +49,7 @@ add_llvm_target(MipsCodeGen
|
||||
@@ -50,6 +51,7 @@ add_llvm_target(MipsCodeGen
|
||||
MipsPreLegalizerCombiner.cpp
|
||||
MipsRegisterBankInfo.cpp
|
||||
MipsRegisterInfo.cpp
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_Mips_MCTargetDesc_MipsABIInfo_cpp,v 1.1 2020/12/21 21:38:51 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_Mips_MCTargetDesc_MipsABIInfo_cpp,v 1.2 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Adapt the -mfix-loongson2f-btb workaround from as(1) to LLVM/clang.
|
||||
|
||||
Index: lib/Target/Mips/MCTargetDesc/MipsABIInfo.cpp
|
||||
--- lib/Target/Mips/MCTargetDesc/MipsABIInfo.cpp.orig
|
||||
+++ lib/Target/Mips/MCTargetDesc/MipsABIInfo.cpp
|
||||
@@ -22,6 +22,11 @@ EmitJalrReloc("mips-jalr-reloc", cl::Hidden,
|
||||
@@ -21,6 +21,11 @@ EmitJalrReloc("mips-jalr-reloc", cl::Hidden,
|
||||
cl::desc("MIPS: Emit R_{MICRO}MIPS_JALR relocation with jalr"),
|
||||
cl::init(true));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_Mips_MipsISelLowering_cpp,v 1.3 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_Mips_MipsISelLowering_cpp,v 1.4 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Implement the 'h' register constraint on mips64. This lets clang build
|
||||
pieces of software that use the constraint if the compiler claims
|
||||
@ -12,7 +12,7 @@ $OpenBSD: patch-lib_Target_Mips_MipsISelLowering_cpp,v 1.3 2021/05/13 23:54:24 j
|
||||
Index: lib/Target/Mips/MipsISelLowering.cpp
|
||||
--- lib/Target/Mips/MipsISelLowering.cpp.orig
|
||||
+++ lib/Target/Mips/MipsISelLowering.cpp
|
||||
@@ -3919,6 +3919,7 @@ MipsTargetLowering::getConstraintType(StringRef Constr
|
||||
@@ -3925,6 +3925,7 @@ MipsTargetLowering::getConstraintType(StringRef Constr
|
||||
// backwards compatibility.
|
||||
// 'c' : A register suitable for use in an indirect
|
||||
// jump. This will always be $25 for -mabicalls.
|
||||
@ -20,7 +20,7 @@ Index: lib/Target/Mips/MipsISelLowering.cpp
|
||||
// 'l' : The lo register. 1 word storage.
|
||||
// 'x' : The hilo register pair. Double word storage.
|
||||
if (Constraint.size() == 1) {
|
||||
@@ -3928,6 +3929,7 @@ MipsTargetLowering::getConstraintType(StringRef Constr
|
||||
@@ -3934,6 +3935,7 @@ MipsTargetLowering::getConstraintType(StringRef Constr
|
||||
case 'y':
|
||||
case 'f':
|
||||
case 'c':
|
||||
@ -28,7 +28,7 @@ Index: lib/Target/Mips/MipsISelLowering.cpp
|
||||
case 'l':
|
||||
case 'x':
|
||||
return C_RegisterClass;
|
||||
@@ -3973,6 +3975,7 @@ MipsTargetLowering::getSingleConstraintMatchWeight(
|
||||
@@ -3979,6 +3981,7 @@ MipsTargetLowering::getSingleConstraintMatchWeight(
|
||||
weight = CW_Register;
|
||||
break;
|
||||
case 'c': // $25 for indirect jumps
|
||||
@ -36,7 +36,7 @@ Index: lib/Target/Mips/MipsISelLowering.cpp
|
||||
case 'l': // lo register
|
||||
case 'x': // hilo register pair
|
||||
if (type->isIntegerTy())
|
||||
@@ -4147,6 +4150,11 @@ MipsTargetLowering::getRegForInlineAsmConstraint(const
|
||||
@@ -4153,6 +4156,11 @@ MipsTargetLowering::getRegForInlineAsmConstraint(const
|
||||
return std::make_pair((unsigned)Mips::T9_64, &Mips::GPR64RegClass);
|
||||
// This will generate an error message
|
||||
return std::make_pair(0U, nullptr);
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_Mips_MipsTargetMachine_cpp,v 1.2 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_Mips_MipsTargetMachine_cpp,v 1.3 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Adapt the -mfix-loongson2f-btb workaround from as(1) to LLVM/clang.
|
||||
|
||||
@ -14,7 +14,7 @@ Index: lib/Target/Mips/MipsTargetMachine.cpp
|
||||
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsTarget() {
|
||||
// Register the target.
|
||||
RegisterTargetMachine<MipsebTargetMachine> X(getTheMipsTarget());
|
||||
@@ -280,6 +282,9 @@ bool MipsPassConfig::addInstSelector() {
|
||||
@@ -268,6 +270,9 @@ bool MipsPassConfig::addInstSelector() {
|
||||
|
||||
void MipsPassConfig::addPreRegAlloc() {
|
||||
addPass(createMipsOptimizePICCallPass());
|
||||
|
@ -1,15 +1,13 @@
|
||||
$OpenBSD: patch-lib_Target_PowerPC_CMakeLists_txt,v 1.2 2021/05/13 23:54:24 jca Exp $
|
||||
|
||||
Add RETGUARD implementation for powerpc and powerpc64.
|
||||
$OpenBSD: patch-lib_Target_PowerPC_CMakeLists_txt,v 1.3 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Index: lib/Target/PowerPC/CMakeLists.txt
|
||||
--- lib/Target/PowerPC/CMakeLists.txt.orig
|
||||
+++ lib/Target/PowerPC/CMakeLists.txt
|
||||
@@ -36,6 +36,7 @@ add_llvm_target(PowerPCCodeGen
|
||||
@@ -42,6 +42,7 @@ add_llvm_target(PowerPCCodeGen
|
||||
PPCMacroFusion.cpp
|
||||
PPCMIPeephole.cpp
|
||||
PPCRegisterInfo.cpp
|
||||
+ PPCReturnProtectorLowering.cpp
|
||||
PPCQPXLoadSplat.cpp
|
||||
PPCSubtarget.cpp
|
||||
PPCTargetMachine.cpp
|
||||
PPCTargetObjectFile.cpp
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCAsmPrinter_cpp,v 1.9 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCAsmPrinter_cpp,v 1.10 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add RETGUARD implementation for powerpc and powerpc64.
|
||||
|
||||
Index: lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
--- lib/Target/PowerPC/PPCAsmPrinter.cpp.orig
|
||||
+++ lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
@@ -657,6 +657,85 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr
|
||||
@@ -815,6 +815,85 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCFrameLowering_cpp,v 1.4 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCFrameLowering_cpp,v 1.5 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add RETGUARD implementation for powerpc and powerpc64.
|
||||
|
||||
@ -13,10 +13,10 @@ Index: lib/Target/PowerPC/PPCFrameLowering.cpp
|
||||
#include "PPCSubtarget.h"
|
||||
#include "PPCTargetMachine.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
@@ -2626,4 +2627,8 @@ bool PPCFrameLowering::enableShrinkWrapping(const Mach
|
||||
@@ -2696,4 +2697,8 @@ bool PPCFrameLowering::enableShrinkWrapping(const Mach
|
||||
if (MF.getInfo<PPCFunctionInfo>()->shrinkWrapDisabled())
|
||||
return false;
|
||||
return (MF.getSubtarget<PPCSubtarget>().isSVR4ABI() &&
|
||||
MF.getSubtarget<PPCSubtarget>().isPPC64());
|
||||
return !MF.getSubtarget<PPCSubtarget>().is32BitELFABI();
|
||||
+}
|
||||
+
|
||||
+const ReturnProtectorLowering *PPCFrameLowering::getReturnProtector() const {
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCFrameLowering_h,v 1.4 2021/05/13 23:54:24 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCFrameLowering_h,v 1.5 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add RETGUARD implementation for powerpc and powerpc64.
|
||||
|
||||
@ -13,7 +13,7 @@ Index: lib/Target/PowerPC/PPCFrameLowering.h
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/CodeGen/TargetFrameLowering.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
@@ -169,6 +170,9 @@ class PPCFrameLowering: public TargetFrameLowering { (
|
||||
@@ -173,6 +174,9 @@ class PPCFrameLowering: public TargetFrameLowering { (
|
||||
/// function prologue/epilogue.
|
||||
bool canUseAsPrologue(const MachineBasicBlock &MBB) const override;
|
||||
bool canUseAsEpilogue(const MachineBasicBlock &MBB) const override;
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCInstrInfo_td,v 1.4 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCInstrInfo_td,v 1.5 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add RETGUARD implementation for powerpc and powerpc64.
|
||||
|
||||
Index: lib/Target/PowerPC/PPCInstrInfo.td
|
||||
--- lib/Target/PowerPC/PPCInstrInfo.td.orig
|
||||
+++ lib/Target/PowerPC/PPCInstrInfo.td
|
||||
@@ -1527,6 +1527,31 @@ let Defs = [LR] in
|
||||
@@ -1690,6 +1690,31 @@ let Defs = [LR] in
|
||||
def MoveGOTtoLR : PPCEmitTimePseudo<(outs), (ins), "#MoveGOTtoLR", []>,
|
||||
PPC970_Unit_BRU;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCTargetMachine_cpp,v 1.3 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_PowerPC_PPCTargetMachine_cpp,v 1.4 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Switch Powerpc64 Big Endian to ELFv2 on OpenBSD.
|
||||
|
||||
Index: lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
--- lib/Target/PowerPC/PPCTargetMachine.cpp.orig
|
||||
+++ lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
@@ -216,6 +216,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const
|
||||
@@ -228,6 +228,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const
|
||||
case Triple::ppc64le:
|
||||
return PPCTargetMachine::PPC_ABI_ELFv2;
|
||||
case Triple::ppc64:
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_RISCV_RISCVISelLowering_cpp,v 1.1 2021/05/22 20:27:35 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_RISCV_RISCVISelLowering_cpp,v 1.2 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- enable EmuTLS on RiscV.
|
||||
|
||||
Index: lib/Target/RISCV/RISCVISelLowering.cpp
|
||||
--- lib/Target/RISCV/RISCVISelLowering.cpp.orig
|
||||
+++ lib/Target/RISCV/RISCVISelLowering.cpp
|
||||
@@ -634,6 +634,10 @@ SDValue RISCVTargetLowering::getDynamicTLSAddr(GlobalA
|
||||
@@ -2847,6 +2847,10 @@ SDValue RISCVTargetLowering::getDynamicTLSAddr(GlobalA
|
||||
|
||||
SDValue RISCVTargetLowering::lowerGlobalTLSAddress(SDValue Op,
|
||||
SelectionDAG &DAG) const {
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_Sparc_SparcISelLowering_cpp,v 1.8 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_Sparc_SparcISelLowering_cpp,v 1.9 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Make sure that we really don't emit quad-precision unless the
|
||||
"hard-quad-float" feature is available
|
||||
@ -6,7 +6,7 @@ $OpenBSD: patch-lib_Target_Sparc_SparcISelLowering_cpp,v 1.8 2021/05/13 23:54:25
|
||||
Index: lib/Target/Sparc/SparcISelLowering.cpp
|
||||
--- lib/Target/Sparc/SparcISelLowering.cpp.orig
|
||||
+++ lib/Target/Sparc/SparcISelLowering.cpp
|
||||
@@ -3111,6 +3111,11 @@ SparcTargetLowering::EmitInstrWithCustomInserter(Machi
|
||||
@@ -3116,6 +3116,11 @@ SparcTargetLowering::EmitInstrWithCustomInserter(Machi
|
||||
case SP::SELECT_CC_DFP_ICC:
|
||||
case SP::SELECT_CC_QFP_ICC:
|
||||
return expandSelectCC(MI, BB, SP::BCOND);
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_Sparc_SparcInstrInfo_td,v 1.11 2020/08/05 06:49:48 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_Sparc_SparcInstrInfo_td,v 1.12 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Make sure that we really don't emit quad-precision unless the
|
||||
"hard-quad-float" feature is available
|
||||
@ -6,7 +6,7 @@ Make sure that we really don't emit quad-precision unless the
|
||||
Index: lib/Target/Sparc/SparcInstrInfo.td
|
||||
--- lib/Target/Sparc/SparcInstrInfo.td.orig
|
||||
+++ lib/Target/Sparc/SparcInstrInfo.td
|
||||
@@ -468,6 +468,27 @@ let Uses = [ICC], usesCustomInserter = 1 in {
|
||||
@@ -487,6 +487,27 @@ let Uses = [ICC], usesCustomInserter = 1 in {
|
||||
[(set f128:$dst, (SPselecticc f128:$T, f128:$F, imm:$Cond))]>;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ Index: lib/Target/Sparc/SparcInstrInfo.td
|
||||
let usesCustomInserter = 1, Uses = [FCC0] in {
|
||||
|
||||
def SELECT_CC_Int_FCC
|
||||
@@ -1391,12 +1412,12 @@ let Predicates = [HasV9], Constraints = "$f = $rd" in
|
||||
@@ -1418,12 +1439,12 @@ let Predicates = [HasV9], Constraints = "$f = $rd" in
|
||||
(ins DFPRegs:$rs2, DFPRegs:$f, CCOp:$cond),
|
||||
"fmovd$cond %icc, $rs2, $rd",
|
||||
[(set f64:$rd, (SPselecticc f64:$rs2, f64:$f, imm:$cond))]>;
|
||||
@ -49,7 +49,7 @@ Index: lib/Target/Sparc/SparcInstrInfo.td
|
||||
}
|
||||
|
||||
let Uses = [FCC0], intcc = 0, opf_cc = 0b00 in {
|
||||
@@ -1410,12 +1431,12 @@ let Predicates = [HasV9], Constraints = "$f = $rd" in
|
||||
@@ -1437,12 +1458,12 @@ let Predicates = [HasV9], Constraints = "$f = $rd" in
|
||||
(ins DFPRegs:$rs2, DFPRegs:$f, CCOp:$cond),
|
||||
"fmovd$cond %fcc0, $rs2, $rd",
|
||||
[(set f64:$rd, (SPselectfcc f64:$rs2, f64:$f, imm:$cond))]>;
|
||||
@ -64,7 +64,7 @@ Index: lib/Target/Sparc/SparcInstrInfo.td
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1425,28 +1446,28 @@ let Predicates = [HasV9] in {
|
||||
@@ -1452,28 +1473,28 @@ let Predicates = [HasV9] in {
|
||||
def FMOVD : F3_3u<2, 0b110100, 0b000000010,
|
||||
(outs DFPRegs:$rd), (ins DFPRegs:$rs2),
|
||||
"fmovd $rs2, $rd", []>;
|
||||
@ -99,7 +99,7 @@ Index: lib/Target/Sparc/SparcInstrInfo.td
|
||||
}
|
||||
|
||||
// Floating-point compare instruction with %fcc0-%fcc3.
|
||||
@@ -1493,11 +1514,11 @@ let Predicates = [HasV9] in {
|
||||
@@ -1520,11 +1541,11 @@ let Predicates = [HasV9] in {
|
||||
: F4_3<0b110101, 0b000010, (outs DFPRegs:$rd),
|
||||
(ins FCCRegs:$opf_cc, DFPRegs:$rs2, DFPRegs:$f, CCOp:$cond),
|
||||
"fmovd$cond $opf_cc, $rs2, $rd", []>;
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_CMakeLists_txt,v 1.6 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_CMakeLists_txt,v 1.7 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Add a clang pass that identifies potential ROP gadgets and replaces ROP
|
||||
friendly instructions with safe alternatives. This initial commit fixes
|
||||
@ -10,7 +10,7 @@ $OpenBSD: patch-lib_Target_X86_CMakeLists_txt,v 1.6 2021/05/13 23:54:25 jca Exp
|
||||
Index: lib/Target/X86/CMakeLists.txt
|
||||
--- lib/Target/X86/CMakeLists.txt.orig
|
||||
+++ lib/Target/X86/CMakeLists.txt
|
||||
@@ -34,6 +34,7 @@ set(sources
|
||||
@@ -42,6 +42,7 @@ set(sources
|
||||
X86ExpandPseudo.cpp
|
||||
X86FastISel.cpp
|
||||
X86FixupBWInsts.cpp
|
||||
@ -18,7 +18,7 @@ Index: lib/Target/X86/CMakeLists.txt
|
||||
X86FixupLEAs.cpp
|
||||
X86AvoidStoreForwardingBlocks.cpp
|
||||
X86FixupSetCC.cpp
|
||||
@@ -62,6 +63,7 @@ set(sources
|
||||
@@ -71,6 +72,7 @@ set(sources
|
||||
X86PartialReduction.cpp
|
||||
X86RegisterBankInfo.cpp
|
||||
X86RegisterInfo.cpp
|
||||
|
@ -1,80 +0,0 @@
|
||||
$OpenBSD: patch-lib_Target_X86_MCTargetDesc_X86AsmBackend_cpp,v 1.9 2021/05/13 23:54:25 jca Exp $
|
||||
|
||||
trapsleds
|
||||
|
||||
Index: lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
|
||||
--- lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp.orig
|
||||
+++ lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
|
||||
@@ -1071,57 +1071,23 @@ void X86AsmBackend::finishLayout(MCAssembler const &As
|
||||
/// bytes.
|
||||
/// \return - true on success, false on failure
|
||||
bool X86AsmBackend::writeNopData(raw_ostream &OS, uint64_t Count) const {
|
||||
- static const char Nops[10][11] = {
|
||||
- // nop
|
||||
- "\x90",
|
||||
- // xchg %ax,%ax
|
||||
- "\x66\x90",
|
||||
- // nopl (%[re]ax)
|
||||
- "\x0f\x1f\x00",
|
||||
- // nopl 0(%[re]ax)
|
||||
- "\x0f\x1f\x40\x00",
|
||||
- // nopl 0(%[re]ax,%[re]ax,1)
|
||||
- "\x0f\x1f\x44\x00\x00",
|
||||
- // nopw 0(%[re]ax,%[re]ax,1)
|
||||
- "\x66\x0f\x1f\x44\x00\x00",
|
||||
- // nopl 0L(%[re]ax)
|
||||
- "\x0f\x1f\x80\x00\x00\x00\x00",
|
||||
- // nopl 0L(%[re]ax,%[re]ax,1)
|
||||
- "\x0f\x1f\x84\x00\x00\x00\x00\x00",
|
||||
- // nopw 0L(%[re]ax,%[re]ax,1)
|
||||
- "\x66\x0f\x1f\x84\x00\x00\x00\x00\x00",
|
||||
- // nopw %cs:0L(%[re]ax,%[re]ax,1)
|
||||
- "\x66\x2e\x0f\x1f\x84\x00\x00\x00\x00\x00",
|
||||
- };
|
||||
|
||||
- // This CPU doesn't support long nops. If needed add more.
|
||||
- // FIXME: We could generated something better than plain 0x90.
|
||||
- if (!STI.hasFeature(X86::FeatureNOPL) && !STI.hasFeature(X86::Mode64Bit)) {
|
||||
- for (uint64_t i = 0; i < Count; ++i)
|
||||
- OS << '\x90';
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- // 15-bytes is the longest single NOP instruction, but 10-bytes is
|
||||
- // commonly the longest that can be efficiently decoded.
|
||||
- uint64_t MaxNopLength = 10;
|
||||
- if (STI.getFeatureBits()[X86::FeatureFast7ByteNOP])
|
||||
- MaxNopLength = 7;
|
||||
- else if (STI.getFeatureBits()[X86::FeatureFast15ByteNOP])
|
||||
- MaxNopLength = 15;
|
||||
- else if (STI.getFeatureBits()[X86::FeatureFast11ByteNOP])
|
||||
- MaxNopLength = 11;
|
||||
-
|
||||
- // Emit as many MaxNopLength NOPs as needed, then emit a NOP of the remaining
|
||||
- // length.
|
||||
+ // Write 1 or 2 byte NOP sequences, or a longer trapsled, until
|
||||
+ // we have written Count bytes
|
||||
do {
|
||||
- const uint8_t ThisNopLength = (uint8_t) std::min(Count, MaxNopLength);
|
||||
- const uint8_t Prefixes = ThisNopLength <= 10 ? 0 : ThisNopLength - 10;
|
||||
- for (uint8_t i = 0; i < Prefixes; i++)
|
||||
- OS << '\x66';
|
||||
- const uint8_t Rest = ThisNopLength - Prefixes;
|
||||
- if (Rest != 0)
|
||||
- OS.write(Nops[Rest - 1], Rest);
|
||||
+ const uint8_t ThisNopLength = (uint8_t) std::min(Count, (uint64_t)127);
|
||||
+ switch (ThisNopLength) {
|
||||
+ case 0: break;
|
||||
+ case 1: OS << '\x90';
|
||||
+ break;
|
||||
+ case 2: OS << '\x66';
|
||||
+ OS << '\x90';
|
||||
+ break;
|
||||
+ default: OS << '\xEB';
|
||||
+ OS << (uint8_t)(ThisNopLength - 2);
|
||||
+ for(uint8_t i = 2; i < ThisNopLength; ++i)
|
||||
+ OS << '\xCC';
|
||||
+ }
|
||||
Count -= ThisNopLength;
|
||||
} while (Count != 0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86FrameLowering_cpp,v 1.9 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86FrameLowering_cpp,v 1.10 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -31,7 +31,7 @@ Index: lib/Target/X86/X86FrameLowering.cpp
|
||||
#include "X86Subtarget.h"
|
||||
#include "X86TargetMachine.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
@@ -45,7 +46,7 @@ X86FrameLowering::X86FrameLowering(const X86Subtarget
|
||||
@@ -46,7 +47,7 @@ X86FrameLowering::X86FrameLowering(const X86Subtarget
|
||||
MaybeAlign StackAlignOverride)
|
||||
: TargetFrameLowering(StackGrowsDown, StackAlignOverride.valueOrOne(),
|
||||
STI.is64Bit() ? -8 : -4),
|
||||
@ -40,7 +40,7 @@ Index: lib/Target/X86/X86FrameLowering.cpp
|
||||
// Cache a bunch of frame-related predicates for this subtarget.
|
||||
SlotSize = TRI->getSlotSize();
|
||||
Is64Bit = STI.is64Bit();
|
||||
@@ -53,6 +54,7 @@ X86FrameLowering::X86FrameLowering(const X86Subtarget
|
||||
@@ -54,6 +55,7 @@ X86FrameLowering::X86FrameLowering(const X86Subtarget
|
||||
// standard x86_64 and NaCl use 64-bit frame/stack pointers, x32 - 32-bit.
|
||||
Uses64BitFramePtr = STI.isTarget64BitLP64() || STI.isTargetNaCl64();
|
||||
StackPtr = TRI->getStackRegister();
|
||||
@ -48,7 +48,7 @@ Index: lib/Target/X86/X86FrameLowering.cpp
|
||||
}
|
||||
|
||||
bool X86FrameLowering::hasReservedCallFrame(const MachineFunction &MF) const {
|
||||
@@ -98,7 +100,8 @@ bool X86FrameLowering::hasFP(const MachineFunction &MF
|
||||
@@ -99,7 +101,8 @@ bool X86FrameLowering::hasFP(const MachineFunction &MF
|
||||
MF.getInfo<X86MachineFunctionInfo>()->hasPreallocatedCall() ||
|
||||
MF.callsUnwindInit() || MF.hasEHFunclets() || MF.callsEHReturn() ||
|
||||
MFI.hasStackMap() || MFI.hasPatchPoint() ||
|
||||
@ -58,7 +58,7 @@ Index: lib/Target/X86/X86FrameLowering.cpp
|
||||
}
|
||||
|
||||
static unsigned getSUBriOpcode(bool IsLP64, int64_t Imm) {
|
||||
@@ -1243,6 +1246,24 @@ void X86FrameLowering::BuildStackAlignAND(MachineBasic
|
||||
@@ -1213,6 +1216,24 @@ void X86FrameLowering::BuildStackAlignAND(MachineBasic
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,9 +83,9 @@ Index: lib/Target/X86/X86FrameLowering.cpp
|
||||
bool X86FrameLowering::has128ByteRedZone(const MachineFunction& MF) const {
|
||||
// x86-64 (non Win64) has a 128 byte red zone which is guaranteed not to be
|
||||
// clobbered by any interrupt handler.
|
||||
@@ -1517,6 +1538,43 @@ void X86FrameLowering::emitPrologue(MachineFunction &M
|
||||
nullptr, DwarfFramePtr));
|
||||
}
|
||||
@@ -1537,6 +1558,43 @@ void X86FrameLowering::emitPrologue(MachineFunction &M
|
||||
.addReg(StackPtr)
|
||||
.setMIFlag(MachineInstr::FrameSetup);
|
||||
|
||||
+ if (SaveArgs && !Fn.arg_empty()) {
|
||||
+ ArrayRef<MCPhysReg> GPRs =
|
||||
@ -119,20 +119,21 @@ Index: lib/Target/X86/X86FrameLowering.cpp
|
||||
+ SaveSize += SlotSize;
|
||||
+ }
|
||||
+
|
||||
+ //dlg StackSize -= SaveSize;
|
||||
+ //dlg StackSize -= SaveSize;
|
||||
+ //dlg MFI.setStackSize(StackSize);
|
||||
+ X86FI->setSaveArgSize(SaveSize);
|
||||
+ }
|
||||
+
|
||||
if (NeedsWinFPO) {
|
||||
// .cv_fpo_setframe $FramePtr
|
||||
HasWinCFI = true;
|
||||
@@ -2009,10 +2067,16 @@ void X86FrameLowering::emitEpilogue(MachineFunction &M
|
||||
// AfterPop is the position to insert .cfi_restore.
|
||||
MachineBasicBlock::iterator AfterPop = MBBI;
|
||||
if (HasFP) {
|
||||
if (NeedsDwarfCFI) {
|
||||
// Mark effective beginning of when frame pointer becomes valid.
|
||||
// Define the current CFA to use the EBP/RBP register.
|
||||
@@ -2047,10 +2105,17 @@ void X86FrameLowering::emitEpilogue(MachineFunction &M
|
||||
int Offset = 16 + mergeSPUpdates(MBB, MBBI, true);
|
||||
emitSPUpdate(MBB, MBBI, DL, Offset, /*InEpilogue*/true);
|
||||
}
|
||||
- // Pop EBP.
|
||||
- BuildMI(MBB, MBBI, DL, TII.get(Is64Bit ? X86::POP64r : X86::POP32r),
|
||||
+
|
||||
+ if (X86FI->getSaveArgSize()) {
|
||||
+ // LEAVE is effectively mov rbp,rsp; pop rbp
|
||||
+ BuildMI(MBB, MBBI, DL, TII.get(X86::LEAVE64))
|
||||
@ -143,20 +144,18 @@ Index: lib/Target/X86/X86FrameLowering.cpp
|
||||
MachineFramePtr)
|
||||
.setMIFlag(MachineInstr::FrameDestroy);
|
||||
+ }
|
||||
if (NeedsDwarfCFI) {
|
||||
unsigned DwarfStackPtr =
|
||||
TRI->getDwarfRegNum(Is64Bit ? X86::RSP : X86::ESP, true);
|
||||
@@ -2037,7 +2101,8 @@ void X86FrameLowering::emitEpilogue(MachineFunction &M
|
||||
|
||||
// We need to reset FP to its untagged state on return. Bit 60 is currently
|
||||
// used to show the presence of an extended frame.
|
||||
@@ -2087,6 +2152,7 @@ void X86FrameLowering::emitEpilogue(MachineFunction &M
|
||||
if (Opc != X86::DBG_VALUE && !PI->isTerminator()) {
|
||||
if ((Opc != X86::POP32r || !PI->getFlag(MachineInstr::FrameDestroy)) &&
|
||||
- (Opc != X86::POP64r || !PI->getFlag(MachineInstr::FrameDestroy)))
|
||||
+ (Opc != X86::POP64r || !PI->getFlag(MachineInstr::FrameDestroy)) &&
|
||||
+ (Opc != X86::LEAVE64 || !PI->getFlag(MachineInstr::FrameDestroy)))
|
||||
(Opc != X86::POP64r || !PI->getFlag(MachineInstr::FrameDestroy)) &&
|
||||
+ (Opc != X86::LEAVE64 || !PI->getFlag(MachineInstr::FrameDestroy)) &&
|
||||
(Opc != X86::BTR64ri8 || !PI->getFlag(MachineInstr::FrameDestroy)) &&
|
||||
(Opc != X86::ADD64ri8 || !PI->getFlag(MachineInstr::FrameDestroy)))
|
||||
break;
|
||||
FirstCSPop = PI;
|
||||
}
|
||||
@@ -2202,6 +2267,8 @@ int X86FrameLowering::getFrameIndexReference(const Mac
|
||||
@@ -2266,6 +2332,8 @@ StackOffset X86FrameLowering::getFrameIndexReference(c
|
||||
"FPDelta isn't aligned per the Win64 ABI!");
|
||||
}
|
||||
|
||||
@ -165,7 +164,7 @@ Index: lib/Target/X86/X86FrameLowering.cpp
|
||||
|
||||
if (TRI->hasBasePointer(MF)) {
|
||||
assert(HasFP && "VLAs and dynamic stack realign, but no FP?!");
|
||||
@@ -3603,6 +3670,10 @@ void X86FrameLowering::processFunctionBeforeFrameFinal
|
||||
@@ -3699,6 +3767,10 @@ void X86FrameLowering::adjustFrameForMsvcCxxEh(Machine
|
||||
addFrameReference(BuildMI(MBB, MBBI, DL, TII.get(X86::MOV64mi32)),
|
||||
UnwindHelpFI)
|
||||
.addImm(-2);
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86FrameLowering_h,v 1.7 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86FrameLowering_h,v 1.8 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -29,9 +29,9 @@ Index: lib/Target/X86/X86FrameLowering.h
|
||||
|
||||
+#include "X86ReturnProtectorLowering.h"
|
||||
#include "llvm/CodeGen/TargetFrameLowering.h"
|
||||
#include "llvm/Support/TypeSize.h"
|
||||
|
||||
namespace llvm {
|
||||
@@ -22,6 +23,7 @@ class MCCFIInstruction;
|
||||
@@ -23,6 +24,7 @@ class MCCFIInstruction;
|
||||
class X86InstrInfo;
|
||||
class X86Subtarget;
|
||||
class X86RegisterInfo;
|
||||
@ -39,7 +39,7 @@ Index: lib/Target/X86/X86FrameLowering.h
|
||||
|
||||
class X86FrameLowering : public TargetFrameLowering {
|
||||
public:
|
||||
@@ -32,7 +34,10 @@ class X86FrameLowering : public TargetFrameLowering {
|
||||
@@ -33,7 +35,10 @@ class X86FrameLowering : public TargetFrameLowering {
|
||||
const X86Subtarget &STI;
|
||||
const X86InstrInfo &TII;
|
||||
const X86RegisterInfo *TRI;
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86IndirectThunks_cpp,v 1.1 2021/09/19 17:49:23 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86IndirectThunks_cpp,v 1.2 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
Add lfence after ret in retpoline thunk.
|
||||
|
||||
Index: lib/Target/X86/X86IndirectThunks.cpp
|
||||
--- lib/Target/X86/X86IndirectThunks.cpp.orig
|
||||
+++ lib/Target/X86/X86IndirectThunks.cpp
|
||||
@@ -250,6 +250,7 @@ void RetpolineThunkInserter::populateThunk(MachineFunc
|
||||
@@ -249,6 +249,7 @@ void RetpolineThunkInserter::populateThunk(MachineFunc
|
||||
|
||||
CallTarget->back().setPreInstrSymbol(MF, TargetSym);
|
||||
BuildMI(CallTarget, DebugLoc(), TII->get(RetOpc));
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86InstrCompiler_td,v 1.5 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86InstrCompiler_td,v 1.6 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -22,7 +22,7 @@ $OpenBSD: patch-lib_Target_X86_X86InstrCompiler_td,v 1.5 2021/05/13 23:54:25 jca
|
||||
Index: lib/Target/X86/X86InstrCompiler.td
|
||||
--- lib/Target/X86/X86InstrCompiler.td.orig
|
||||
+++ lib/Target/X86/X86InstrCompiler.td
|
||||
@@ -268,6 +268,25 @@ def MORESTACK_RET_RESTORE_R10 : I<0, Pseudo, (outs), (
|
||||
@@ -277,6 +277,25 @@ def MORESTACK_RET_RESTORE_R10 : I<0, Pseudo, (outs), (
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -36,11 +36,11 @@ Index: lib/Target/X86/X86InstrCompiler.td
|
||||
+// used as a return value. When emitted as a split BB, the single byte
|
||||
+// register would sometimes be widened to 4 bytes, which would corrupt
|
||||
+// the return value (ie mov %ecx, %eax instead of mov %cl, %al).
|
||||
+let isCodeGenOnly = 1, Uses = [EFLAGS] in {
|
||||
+let isCodeGenOnly = 1, hasNoSchedulingInfo = 1, Uses = [EFLAGS] in {
|
||||
+def RETGUARD_JMP_TRAP: I<0, Pseudo, (outs), (ins), "", []>;
|
||||
+}
|
||||
+
|
||||
+let isCodeGenOnly = 1 in {
|
||||
+let isCodeGenOnly = 1, hasNoSchedulingInfo = 1 in {
|
||||
+def JMP_TRAP: I<0, Pseudo, (outs), (ins), "", []>;
|
||||
+}
|
||||
+
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86MCInstLower_cpp,v 1.10 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86MCInstLower_cpp,v 1.11 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -25,7 +25,7 @@ $OpenBSD: patch-lib_Target_X86_X86MCInstLower_cpp,v 1.10 2021/05/13 23:54:25 jca
|
||||
Index: lib/Target/X86/X86MCInstLower.cpp
|
||||
--- lib/Target/X86/X86MCInstLower.cpp.orig
|
||||
+++ lib/Target/X86/X86MCInstLower.cpp
|
||||
@@ -2566,6 +2566,50 @@ void X86AsmPrinter::emitInstruction(const MachineInstr
|
||||
@@ -2570,6 +2570,50 @@ void X86AsmPrinter::emitInstruction(const MachineInstr
|
||||
MCInstBuilder(X86::MOV64rr).addReg(X86::R10).addReg(X86::RAX));
|
||||
return;
|
||||
|
||||
@ -76,7 +76,7 @@ Index: lib/Target/X86/X86MCInstLower.cpp
|
||||
case X86::SEH_PushReg:
|
||||
case X86::SEH_SaveReg:
|
||||
case X86::SEH_SaveXMM:
|
||||
@@ -2615,4 +2659,10 @@ void X86AsmPrinter::emitInstruction(const MachineInstr
|
||||
@@ -2628,4 +2672,10 @@ void X86AsmPrinter::emitInstruction(const MachineInstr
|
||||
}
|
||||
|
||||
EmitAndCountInstruction(TmpInst);
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86MachineFunctionInfo_h,v 1.5 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86MachineFunctionInfo_h,v 1.6 2022/01/03 21:33:51 jca Exp $
|
||||
|
||||
implement -msave-args in clang/llvm, like the sun did for gcc
|
||||
|
||||
@ -15,7 +15,7 @@ Index: lib/Target/X86/X86MachineFunctionInfo.h
|
||||
/// BytesToPopOnReturn - Number of bytes function pops on return (in addition
|
||||
/// to the space used by the return address).
|
||||
/// Used on windows platform for stdcall & fastcall name decoration
|
||||
@@ -138,6 +141,9 @@ class X86MachineFunctionInfo : public MachineFunctionI
|
||||
@@ -145,6 +148,9 @@ class X86MachineFunctionInfo : public MachineFunctionI
|
||||
|
||||
unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
|
||||
void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86RegisterInfo_td,v 1.8 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86RegisterInfo_td,v 1.9 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- The compiler is generally free to allocate general purpose registers in
|
||||
whatever order it chooses. Reasons for choosing one register before another
|
||||
@ -23,7 +23,7 @@ $OpenBSD: patch-lib_Target_X86_X86RegisterInfo_td,v 1.8 2021/05/13 23:54:25 jca
|
||||
Index: lib/Target/X86/X86RegisterInfo.td
|
||||
--- lib/Target/X86/X86RegisterInfo.td.orig
|
||||
+++ lib/Target/X86/X86RegisterInfo.td
|
||||
@@ -421,8 +421,8 @@ def GRH16 : RegisterClass<"X86", [i16], 16,
|
||||
@@ -424,8 +424,8 @@ def GRH16 : RegisterClass<"X86", [i16], 16,
|
||||
R15WH)>;
|
||||
|
||||
def GR32 : RegisterClass<"X86", [i32], 32,
|
||||
@ -34,7 +34,7 @@ Index: lib/Target/X86/X86RegisterInfo.td
|
||||
|
||||
// GR64 - 64-bit GPRs. This oddly includes RIP, which isn't accurate, since
|
||||
// RIP isn't really a register and it can't be used anywhere except in an
|
||||
@@ -431,7 +431,7 @@ def GR32 : RegisterClass<"X86", [i32], 32,
|
||||
@@ -434,7 +434,7 @@ def GR32 : RegisterClass<"X86", [i32], 32,
|
||||
// tests because of the inclusion of RIP in this register class.
|
||||
def GR64 : RegisterClass<"X86", [i64], 64,
|
||||
(add RAX, RCX, RDX, RSI, RDI, R8, R9, R10, R11,
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86Subtarget_h,v 1.9 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86Subtarget_h,v 1.10 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- implement -msave-args in clang/llvm, like the sun did for gcc
|
||||
- Turn on -mretpoline by default in clang on amd64.
|
||||
@ -6,9 +6,9 @@ $OpenBSD: patch-lib_Target_X86_X86Subtarget_h,v 1.9 2021/05/13 23:54:25 jca Exp
|
||||
Index: lib/Target/X86/X86Subtarget.h
|
||||
--- lib/Target/X86/X86Subtarget.h.orig
|
||||
+++ lib/Target/X86/X86Subtarget.h
|
||||
@@ -459,6 +459,9 @@ class X86Subtarget final : public X86GenSubtargetInfo
|
||||
/// entry to the function and which must be maintained by every function.
|
||||
Align stackAlignment = Align(4);
|
||||
@@ -481,6 +481,9 @@ class X86Subtarget final : public X86GenSubtargetInfo
|
||||
|
||||
Align TileConfigAlignment = Align(4);
|
||||
|
||||
+ /// Whether function prologues should save register arguments on the stack.
|
||||
+ bool SaveArgs = false;
|
||||
@ -16,16 +16,16 @@ Index: lib/Target/X86/X86Subtarget.h
|
||||
/// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops.
|
||||
///
|
||||
// FIXME: this is a known good value for Yonah. How about others?
|
||||
@@ -549,6 +552,8 @@ class X86Subtarget final : public X86GenSubtargetInfo
|
||||
return &getInstrInfo()->getRegisterInfo();
|
||||
}
|
||||
@@ -567,6 +570,8 @@ class X86Subtarget final : public X86GenSubtargetInfo
|
||||
unsigned getTileConfigSize() const { return 64; }
|
||||
Align getTileConfigAlignment() const { return TileConfigAlignment; }
|
||||
|
||||
+ bool getSaveArgs() const { return SaveArgs; }
|
||||
+
|
||||
/// Returns the minimum alignment known to hold of the
|
||||
/// stack frame on entry to the function and which must be maintained by every
|
||||
/// function for this subtarget.
|
||||
@@ -809,6 +814,7 @@ class X86Subtarget final : public X86GenSubtargetInfo
|
||||
@@ -832,6 +837,7 @@ class X86Subtarget final : public X86GenSubtargetInfo
|
||||
|
||||
bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
|
||||
bool isTargetFreeBSD() const { return TargetTriple.isOSFreeBSD(); }
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86TargetMachine_cpp,v 1.9 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86TargetMachine_cpp,v 1.10 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Add a clang pass that identifies potential ROP gadgets and replaces ROP
|
||||
friendly instructions with safe alternatives. This initial commit fixes
|
||||
@ -9,7 +9,7 @@ this framework.
|
||||
Index: lib/Target/X86/X86TargetMachine.cpp
|
||||
--- lib/Target/X86/X86TargetMachine.cpp.orig
|
||||
+++ lib/Target/X86/X86TargetMachine.cpp
|
||||
@@ -517,6 +517,7 @@ void X86PassConfig::addPreEmitPass() {
|
||||
@@ -546,6 +546,7 @@ void X86PassConfig::addPreEmitPass() {
|
||||
addPass(createX86EvexToVexInsts());
|
||||
addPass(createX86DiscriminateMemOpsPass());
|
||||
addPass(createX86InsertPrefetchPass());
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86_h,v 1.4 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86_h,v 1.5 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Add a clang pass that identifies potential ROP gadgets and replaces ROP
|
||||
friendly instructions with safe alternatives. This initial commit fixes
|
||||
@ -9,7 +9,7 @@ this framework.
|
||||
Index: lib/Target/X86/X86.h
|
||||
--- lib/Target/X86/X86.h.orig
|
||||
+++ lib/Target/X86/X86.h
|
||||
@@ -113,6 +113,10 @@ FunctionPass *createX86FixupBWInsts();
|
||||
@@ -122,6 +122,10 @@ FunctionPass *createX86FixupBWInsts();
|
||||
/// to another, when profitable.
|
||||
FunctionPass *createX86DomainReassignmentPass();
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-lib_Target_X86_X86_td,v 1.6 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Target_X86_X86_td,v 1.7 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
implement -msave-args in clang/llvm, like the sun did for gcc
|
||||
|
||||
Index: lib/Target/X86/X86.td
|
||||
--- lib/Target/X86/X86.td.orig
|
||||
+++ lib/Target/X86/X86.td
|
||||
@@ -313,6 +313,9 @@ def FeatureLZCNTFalseDeps : SubtargetFeature<"false-de
|
||||
@@ -321,6 +321,9 @@ def FeatureLZCNTFalseDeps : SubtargetFeature<"false-de
|
||||
"LZCNT/TZCNT have a false dependency on dest register">;
|
||||
def FeaturePCONFIG : SubtargetFeature<"pconfig", "HasPCONFIG", "true",
|
||||
"platform configuration instruction">;
|
||||
@ -14,4 +14,4 @@ Index: lib/Target/X86/X86.td
|
||||
+ "Save register arguments on the stack.">;
|
||||
// On recent X86 (port bound) processors, its preferable to combine to a single shuffle
|
||||
// using a variable mask over multiple fixed shuffles.
|
||||
def FeatureFastVariableShuffle
|
||||
def FeatureFastVariableCrossLaneShuffle
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-lib_Transforms_Scalar_LoopIdiomRecognize_cpp,v 1.7 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-lib_Transforms_Scalar_LoopIdiomRecognize_cpp,v 1.8 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Disable loop idiom recognition for _libc_memset and _libc_memcpy. These are
|
||||
the internal names we use in libc for memset and memcpy and having the
|
||||
@ -8,7 +8,7 @@ recursion.
|
||||
Index: lib/Transforms/Scalar/LoopIdiomRecognize.cpp
|
||||
--- lib/Transforms/Scalar/LoopIdiomRecognize.cpp.orig
|
||||
+++ lib/Transforms/Scalar/LoopIdiomRecognize.cpp
|
||||
@@ -312,6 +312,8 @@ bool LoopIdiomRecognize::runOnLoop(Loop *L) {
|
||||
@@ -367,6 +367,8 @@ bool LoopIdiomRecognize::runOnLoop(Loop *L) {
|
||||
StringRef Name = L->getHeader()->getParent()->getName();
|
||||
if (Name == "memset" || Name == "memcpy")
|
||||
return false;
|
||||
|
@ -1,24 +0,0 @@
|
||||
$OpenBSD: patch-lib_Transforms_Scalar_SCCP_cpp,v 1.1 2021/05/13 23:54:25 jca Exp $
|
||||
|
||||
[SCCP] Avoid modifying AdditionalUsers while iterating over it
|
||||
https://reviews.llvm.org/rG6abb92f2103a58d097620b4410054c5bb18c48ec
|
||||
|
||||
Index: lib/Transforms/Scalar/SCCP.cpp
|
||||
--- lib/Transforms/Scalar/SCCP.cpp.orig
|
||||
+++ lib/Transforms/Scalar/SCCP.cpp
|
||||
@@ -541,9 +541,14 @@ class SCCPSolver : public InstVisitor<SCCPSolver> { (p
|
||||
|
||||
auto Iter = AdditionalUsers.find(I);
|
||||
if (Iter != AdditionalUsers.end()) {
|
||||
+ // Copy additional users before notifying them of changes, because new
|
||||
+ // users may be added, potentially invalidating the iterator.
|
||||
+ SmallVector<Instruction *, 2> ToNotify;
|
||||
for (User *U : Iter->second)
|
||||
if (auto *UI = dyn_cast<Instruction>(U))
|
||||
- OperandChangedState(UI);
|
||||
+ ToNotify.push_back(UI);
|
||||
+ for (Instruction *UI : ToNotify)
|
||||
+ OperandChangedState(UI);
|
||||
}
|
||||
}
|
||||
void handleCallOverdefined(CallBase &CB);
|
@ -1,18 +0,0 @@
|
||||
$OpenBSD: patch-lib_WindowsManifest_CMakeLists_txt,v 1.2 2020/08/05 06:49:48 jca Exp $
|
||||
|
||||
For upstream:
|
||||
bogus dep on all headers in ${Backtrace_INCLUDE_DIRS} ie /usr/local/include.
|
||||
|
||||
Index: lib/WindowsManifest/CMakeLists.txt
|
||||
--- lib/WindowsManifest/CMakeLists.txt.orig
|
||||
+++ lib/WindowsManifest/CMakeLists.txt
|
||||
@@ -2,8 +2,7 @@ add_llvm_component_library(LLVMWindowsManifest
|
||||
WindowsManifestMerger.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
- ${LLVM_MAIN_INCLUDE_DIR}/llvm/WindowsManifest
|
||||
- ${Backtrace_INCLUDE_DIRS})
|
||||
+ ${LLVM_MAIN_INCLUDE_DIR}/llvm/WindowsManifest)
|
||||
|
||||
if(LIBXML2_LIBRARIES)
|
||||
target_link_libraries(LLVMWindowsManifest PUBLIC ${LIBXML2_LIBRARIES})
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_include_clang_Basic_CodeGenOptions_def,v 1.7 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_include_clang_Basic_CodeGenOptions_def,v 1.8 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -22,7 +22,7 @@ $OpenBSD: patch-tools_clang_include_clang_Basic_CodeGenOptions_def,v 1.7 2021/05
|
||||
Index: tools/clang/include/clang/Basic/CodeGenOptions.def
|
||||
--- tools/clang/include/clang/Basic/CodeGenOptions.def.orig
|
||||
+++ tools/clang/include/clang/Basic/CodeGenOptions.def
|
||||
@@ -312,6 +312,9 @@ VALUE_CODEGENOPT(SmallDataLimit, 32, 0)
|
||||
@@ -340,6 +340,9 @@ VALUE_CODEGENOPT(SmallDataLimit, 32, 0)
|
||||
/// The lower bound for a buffer to be considered for stack protection.
|
||||
VALUE_CODEGENOPT(SSPBufferSize, 32, 0)
|
||||
|
||||
@ -30,5 +30,5 @@ Index: tools/clang/include/clang/Basic/CodeGenOptions.def
|
||||
+CODEGENOPT(ReturnProtector, 1, 0)
|
||||
+
|
||||
/// The kind of generated debug info.
|
||||
ENUM_CODEGENOPT(DebugInfo, codegenoptions::DebugInfoKind, 3, codegenoptions::NoDebugInfo)
|
||||
ENUM_CODEGENOPT(DebugInfo, codegenoptions::DebugInfoKind, 4, codegenoptions::NoDebugInfo)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_include_clang_Basic_DiagnosticSemaKinds_td,v 1.10 2021/09/19 17:49:23 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_include_clang_Basic_DiagnosticSemaKinds_td,v 1.11 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Disable -Waddress-of-packed-member by default.
|
||||
|
||||
@ -14,25 +14,25 @@ base gcc does the same.
|
||||
Index: tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
|
||||
--- tools/clang/include/clang/Basic/DiagnosticSemaKinds.td.orig
|
||||
+++ tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
|
||||
@@ -6440,7 +6440,7 @@ def warn_pointer_indirection_from_incompatible_type :
|
||||
@@ -6768,7 +6768,7 @@ def warn_pointer_indirection_from_incompatible_type :
|
||||
InGroup<UndefinedReinterpretCast>, DefaultIgnore;
|
||||
def warn_taking_address_of_packed_member : Warning<
|
||||
"taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
|
||||
- InGroup<DiagGroup<"address-of-packed-member">>;
|
||||
+ InGroup<DiagGroup<"address-of-packed-member">>, DefaultIgnore;
|
||||
|
||||
def err_objc_object_assignment : Error<
|
||||
"cannot assign to class object (%0 invalid)">;
|
||||
@@ -7607,7 +7607,7 @@ def ext_typecheck_convert_incompatible_pointer_sign :
|
||||
"sending to parameter of different type}0,1"
|
||||
def warn_param_mismatched_alignment : Warning<
|
||||
"passing %0-byte aligned argument to %1-byte aligned parameter %2 of %3 may result in an unaligned pointer access">,
|
||||
InGroup<DiagGroup<"align-mismatch">>;
|
||||
@@ -7980,7 +7980,7 @@ def ext_typecheck_convert_incompatible_pointer_sign :
|
||||
"|%diff{casting $ to type $|casting between types}0,1}2"
|
||||
" converts between pointers to integer types with different sign">,
|
||||
" converts between pointers to integer types %select{with different sign|"
|
||||
"where one is of the unique plain 'char' type and the other is not}3">,
|
||||
- InGroup<DiagGroup<"pointer-sign">>;
|
||||
+ InGroup<DiagGroup<"pointer-sign">>, DefaultIgnore;
|
||||
def err_typecheck_convert_incompatible_pointer_sign : Error<
|
||||
"%select{%diff{assigning to $ from $|assigning to different types}0,1"
|
||||
"|%diff{passing $ to parameter of type $|"
|
||||
@@ -9103,6 +9103,9 @@ def err_os_log_argument_too_big : Error<
|
||||
def err_typecheck_convert_incompatible_pointer_sign :
|
||||
Error<ext_typecheck_convert_incompatible_pointer_sign.Text>;
|
||||
def ext_typecheck_convert_incompatible_pointer : ExtWarn<
|
||||
@@ -9512,6 +9512,9 @@ def err_os_log_argument_too_big : Error<
|
||||
"os_log() argument %0 is too big (%1 bytes, max %2)">;
|
||||
def warn_os_log_format_narg : Error<
|
||||
"os_log() '%%n' format specifier is not allowed">, DefaultError;
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_include_clang_Driver_Options_td,v 1.28 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_include_clang_Driver_Options_td,v 1.29 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Add ret protector options as no-ops.
|
||||
- Improve the X86FixupGadgets pass
|
||||
@ -9,7 +9,7 @@ $OpenBSD: patch-tools_clang_include_clang_Driver_Options_td,v 1.28 2021/05/13 23
|
||||
Index: tools/clang/include/clang/Driver/Options.td
|
||||
--- tools/clang/include/clang/Driver/Options.td.orig
|
||||
+++ tools/clang/include/clang/Driver/Options.td
|
||||
@@ -1799,6 +1799,16 @@ def ftrivial_auto_var_init : Joined<["-"], "ftrivial-a
|
||||
@@ -2528,6 +2528,16 @@ def ftrivial_auto_var_init : Joined<["-"], "ftrivial-a
|
||||
def enable_trivial_var_init_zero : Flag<["-"], "enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">,
|
||||
Flags<[CC1Option, CoreOption]>,
|
||||
HelpText<"Trivial automatic variable initialization to zero is only here for benchmarks, it'll eventually be removed, and I'm OK with that because I'm only using it to benchmark">;
|
||||
@ -24,9 +24,9 @@ Index: tools/clang/include/clang/Driver/Options.td
|
||||
+def ffixup_gadgets : Flag<["-"], "ffixup-gadgets">, Group<f_Group>, Flags<[CoreOption]>,
|
||||
+ HelpText<"Replace ROP friendly instructions with safe alternatives (x86 only)">;
|
||||
def ftrivial_auto_var_init_stop_after : Joined<["-"], "ftrivial-auto-var-init-stop-after=">, Group<f_Group>,
|
||||
Flags<[CC1Option, CoreOption]>, HelpText<"Stop initializing trivial automatic stack variables after the specified number of instances">;
|
||||
def fstandalone_debug : Flag<["-"], "fstandalone-debug">, Group<f_Group>, Flags<[CoreOption]>,
|
||||
@@ -2548,6 +2558,8 @@ def mno_check_zero_division : Flag<["-"], "mno-check-z
|
||||
Flags<[CC1Option, CoreOption]>, HelpText<"Stop initializing trivial automatic stack variables after the specified number of instances">,
|
||||
MarshallingInfoInt<LangOpts<"TrivialAutoVarInitStopAfter">>;
|
||||
@@ -3493,6 +3503,8 @@ def mno_check_zero_division : Flag<["-"], "mno-check-z
|
||||
Group<m_mips_Features_Group>;
|
||||
def mcompact_branches_EQ : Joined<["-"], "mcompact-branches=">,
|
||||
Group<m_mips_Features_Group>;
|
||||
@ -35,16 +35,16 @@ Index: tools/clang/include/clang/Driver/Options.td
|
||||
def mbranch_likely : Flag<["-"], "mbranch-likely">, Group<m_Group>,
|
||||
IgnoredGCCCompat;
|
||||
def mno_branch_likely : Flag<["-"], "mno-branch-likely">, Group<m_Group>,
|
||||
@@ -2760,7 +2772,7 @@ def pthreads : Flag<["-"], "pthreads">;
|
||||
def pthread : Flag<["-"], "pthread">, Flags<[CC1Option]>,
|
||||
HelpText<"Support POSIX threads in generated code">;
|
||||
def no_pthread : Flag<["-"], "no-pthread">, Flags<[CC1Option]>;
|
||||
@@ -3721,7 +3733,7 @@ defm pthread : BoolOption<"", "pthread",
|
||||
LangOpts<"POSIXThreads">, DefaultFalse,
|
||||
PosFlag<SetTrue, [], "Support POSIX threads in generated code">,
|
||||
NegFlag<SetFalse>, BothFlags<[CC1Option]>>;
|
||||
-def p : Flag<["-"], "p">;
|
||||
+def p : Flag<["-"], "p">, Alias<pg>;
|
||||
def pie : Flag<["-"], "pie">;
|
||||
def static_pie : Flag<["-"], "static-pie">;
|
||||
def pie : Flag<["-"], "pie">, Group<Link_Group>;
|
||||
def static_pie : Flag<["-"], "static-pie">, Group<Link_Group>;
|
||||
def read__only__relocs : Separate<["-"], "read_only_relocs">;
|
||||
@@ -3243,6 +3255,8 @@ def mshstk : Flag<["-"], "mshstk">, Group<m_x86_Featur
|
||||
@@ -4252,6 +4264,8 @@ def mshstk : Flag<["-"], "mshstk">, Group<m_x86_Featur
|
||||
def mno_shstk : Flag<["-"], "mno-shstk">, Group<m_x86_Features_Group>;
|
||||
def mretpoline_external_thunk : Flag<["-"], "mretpoline-external-thunk">, Group<m_x86_Features_Group>;
|
||||
def mno_retpoline_external_thunk : Flag<["-"], "mno-retpoline-external-thunk">, Group<m_x86_Features_Group>;
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-tools_clang_include_clang_Sema_Sema_h,v 1.7 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_include_clang_Sema_Sema_h,v 1.8 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Teach Clang about syslog format attribute
|
||||
|
||||
Index: tools/clang/include/clang/Sema/Sema.h
|
||||
--- tools/clang/include/clang/Sema/Sema.h.orig
|
||||
+++ tools/clang/include/clang/Sema/Sema.h
|
||||
@@ -12226,6 +12226,7 @@ class Sema final { (public)
|
||||
@@ -12648,6 +12648,7 @@ class Sema final { (public)
|
||||
FST_FreeBSDKPrintf,
|
||||
FST_OSTrace,
|
||||
FST_OSLog,
|
||||
|
@ -1,23 +0,0 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Basic_Targets_RISCV_cpp,v 1.1 2021/06/27 16:10:23 jca Exp $
|
||||
|
||||
[RISCV] Set __GCC_HAVE_SYNC_COMPARE_AND_SWAP_x defines.
|
||||
|
||||
Index: tools/clang/lib/Basic/Targets/RISCV.cpp
|
||||
--- tools/clang/lib/Basic/Targets/RISCV.cpp.orig
|
||||
+++ tools/clang/lib/Basic/Targets/RISCV.cpp
|
||||
@@ -115,8 +115,14 @@ void RISCVTargetInfo::getTargetDefines(const LangOptio
|
||||
Builder.defineMacro("__riscv_muldiv");
|
||||
}
|
||||
|
||||
- if (HasA)
|
||||
+ if (HasA) {
|
||||
Builder.defineMacro("__riscv_atomic");
|
||||
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
|
||||
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
|
||||
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
|
||||
+ if (Is64Bit)
|
||||
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
|
||||
+ }
|
||||
|
||||
if (HasF || HasD) {
|
||||
Builder.defineMacro("__riscv_flen", HasD ? "64" : "32");
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Basic_Targets_X86_cpp,v 1.6 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Basic_Targets_X86_cpp,v 1.7 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
implement -msave-args in clang/llvm, like the sun did for gcc
|
||||
|
||||
Index: tools/clang/lib/Basic/Targets/X86.cpp
|
||||
--- tools/clang/lib/Basic/Targets/X86.cpp.orig
|
||||
+++ tools/clang/lib/Basic/Targets/X86.cpp
|
||||
@@ -296,6 +296,8 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<s
|
||||
@@ -309,6 +309,8 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<s
|
||||
HasPTWRITE = true;
|
||||
} else if (Feature == "+invpcid") {
|
||||
HasINVPCID = true;
|
||||
@ -13,8 +13,8 @@ Index: tools/clang/lib/Basic/Targets/X86.cpp
|
||||
+ HasSaveArgs = true;
|
||||
} else if (Feature == "+enqcmd") {
|
||||
HasENQCMD = true;
|
||||
} else if (Feature == "+amx-bf16") {
|
||||
@@ -930,6 +932,7 @@ bool X86TargetInfo::hasFeature(StringRef Feature) cons
|
||||
} else if (Feature == "+hreset") {
|
||||
@@ -984,6 +986,7 @@ bool X86TargetInfo::hasFeature(StringRef Feature) cons
|
||||
.Case("movbe", HasMOVBE)
|
||||
.Case("movdiri", HasMOVDIRI)
|
||||
.Case("movdir64b", HasMOVDIR64B)
|
||||
|
@ -1,15 +1,15 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Basic_Targets_X86_h,v 1.7 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Basic_Targets_X86_h,v 1.8 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- implement -msave-args in clang/llvm, like the sun did for gcc.
|
||||
|
||||
Index: tools/clang/lib/Basic/Targets/X86.h
|
||||
--- tools/clang/lib/Basic/Targets/X86.h.orig
|
||||
+++ tools/clang/lib/Basic/Targets/X86.h
|
||||
@@ -124,6 +124,7 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public T
|
||||
@@ -131,6 +131,7 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public T
|
||||
bool HasMOVDIR64B = false;
|
||||
bool HasPTWRITE = false;
|
||||
bool HasINVPCID = false;
|
||||
+ bool HasSaveArgs = false;
|
||||
bool HasENQCMD = false;
|
||||
bool HasAMXTILE = false;
|
||||
bool HasAMXINT8 = false;
|
||||
bool HasKL = false; // For key locker
|
||||
bool HasWIDEKL = false; // For wide key locker
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_lib_CodeGen_CGCall_cpp,v 1.5 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_CodeGen_CGCall_cpp,v 1.6 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -21,7 +21,7 @@ remove these gadgets will continue through other mechanisms.
|
||||
Index: tools/clang/lib/CodeGen/CGCall.cpp
|
||||
--- tools/clang/lib/CodeGen/CGCall.cpp.orig
|
||||
+++ tools/clang/lib/CodeGen/CGCall.cpp
|
||||
@@ -2068,6 +2068,9 @@ void CodeGenModule::ConstructAttributeList(
|
||||
@@ -2215,6 +2215,9 @@ void CodeGenModule::ConstructAttributeList(StringRef N
|
||||
// CPU/feature overrides. addDefaultFunctionDefinitionAttributes
|
||||
// handles these separately to set them based on the global defaults.
|
||||
GetCPUAndFeaturesAttributes(CalleeInfo.getCalleeDecl(), FuncAttrs);
|
||||
|
@ -1,23 +0,0 @@
|
||||
$OpenBSD: patch-tools_clang_lib_CodeGen_TargetInfo_cpp,v 1.7 2021/05/13 23:54:25 jca Exp $
|
||||
|
||||
- Fix va_arg in C++, Objective-C on 32-bit powerpc.
|
||||
|
||||
Index: tools/clang/lib/CodeGen/TargetInfo.cpp
|
||||
--- tools/clang/lib/CodeGen/TargetInfo.cpp.orig
|
||||
+++ tools/clang/lib/CodeGen/TargetInfo.cpp
|
||||
@@ -4711,13 +4711,12 @@ Address PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction
|
||||
// };
|
||||
|
||||
bool isI64 = Ty->isIntegerType() && getContext().getTypeSize(Ty) == 64;
|
||||
- bool isInt =
|
||||
- Ty->isIntegerType() || Ty->isPointerType() || Ty->isAggregateType();
|
||||
+ bool isInt = !Ty->isFloatingType();
|
||||
bool isF64 = Ty->isFloatingType() && getContext().getTypeSize(Ty) == 64;
|
||||
|
||||
// All aggregates are passed indirectly? That doesn't seem consistent
|
||||
// with the argument-lowering code.
|
||||
- bool isIndirect = Ty->isAggregateType();
|
||||
+ bool isIndirect = isAggregateTypeForABI(Ty);
|
||||
|
||||
CGBuilderTy &Builder = CGF.Builder;
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Arch_RISCV_cpp,v 1.1 2021/05/22 20:27:35 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Arch_RISCV_cpp,v 1.2 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- ld.lld doesn't properly support R_RISCV_RELAX relocations, switch the default to -no-relax
|
||||
|
||||
Index: tools/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
|
||||
--- tools/clang/lib/Driver/ToolChains/Arch/RISCV.cpp.orig
|
||||
+++ tools/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
|
||||
@@ -536,11 +536,19 @@ void riscv::getRISCVTargetFeatures(const Driver &D, co
|
||||
@@ -556,11 +556,19 @@ void riscv::getRISCVTargetFeatures(const Driver &D, co
|
||||
if (Args.hasArg(options::OPT_ffixed_x31))
|
||||
Features.push_back("+reserve-x31");
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Arch_X86_cpp,v 1.6 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Arch_X86_cpp,v 1.7 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Turn on -mretpoline by default in clang on amd64.
|
||||
|
||||
Index: tools/clang/lib/Driver/ToolChains/Arch/X86.cpp
|
||||
--- tools/clang/lib/Driver/ToolChains/Arch/X86.cpp.orig
|
||||
+++ tools/clang/lib/Driver/ToolChains/Arch/X86.cpp
|
||||
@@ -148,6 +148,12 @@ void x86::getX86TargetFeatures(const Driver &D, const
|
||||
@@ -149,6 +149,12 @@ void x86::getX86TargetFeatures(const Driver &D, const
|
||||
// consider deprecating this and instead warn if the user requests external
|
||||
// retpoline thunks and *doesn't* request some form of retpolines.
|
||||
auto SpectreOpt = clang::driver::options::ID::OPT_INVALID;
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Clang_cpp,v 1.21 2021/05/17 21:46:34 tb Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Clang_cpp,v 1.22 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Switch Powerpc64 Big Endian to ELFv2 on OpenBSD.
|
||||
- Adapt the -mfix-loongson2f-btb workaround from as(1) to LLVM/clang.
|
||||
@ -35,7 +35,7 @@ $OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Clang_cpp,v 1.21 2021/05/17 21
|
||||
Index: tools/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
--- tools/clang/lib/Driver/ToolChains/Clang.cpp.orig
|
||||
+++ tools/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
@@ -2328,6 +2328,11 @@ static void CollectArgsForIntegratedAssembler(Compilat
|
||||
@@ -2489,6 +2489,11 @@ static void CollectArgsForIntegratedAssembler(Compilat
|
||||
CmdArgs.push_back("-soft-float");
|
||||
continue;
|
||||
}
|
||||
@ -47,7 +47,7 @@ Index: tools/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
|
||||
MipsTargetFeature = llvm::StringSwitch<const char *>(Value)
|
||||
.Case("-mips1", "+mips1")
|
||||
@@ -4570,9 +4575,12 @@ void Clang::ConstructJob(Compilation &C, const JobActi
|
||||
@@ -4943,9 +4948,12 @@ void Clang::ConstructJob(Compilation &C, const JobActi
|
||||
OFastEnabled ? options::OPT_Ofast : options::OPT_fstrict_aliasing;
|
||||
// We turn strict aliasing off by default if we're in CL mode, since MSVC
|
||||
// doesn't do any TBAA.
|
||||
@ -62,7 +62,7 @@ Index: tools/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
CmdArgs.push_back("-relaxed-aliasing");
|
||||
if (!Args.hasFlag(options::OPT_fstruct_path_tbaa,
|
||||
options::OPT_fno_struct_path_tbaa))
|
||||
@@ -5342,7 +5350,8 @@ void Clang::ConstructJob(Compilation &C, const JobActi
|
||||
@@ -5868,7 +5876,8 @@ void Clang::ConstructJob(Compilation &C, const JobActi
|
||||
options::OPT_fno_strict_overflow)) {
|
||||
if (A->getOption().matches(options::OPT_fno_strict_overflow))
|
||||
CmdArgs.push_back("-fwrapv");
|
||||
@ -72,14 +72,11 @@ Index: tools/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
|
||||
if (Arg *A = Args.getLastArg(options::OPT_freroll_loops,
|
||||
options::OPT_fno_reroll_loops))
|
||||
@@ -5359,10 +5368,51 @@ void Clang::ConstructJob(Compilation &C, const JobActi
|
||||
@@ -5888,7 +5897,48 @@ void Clang::ConstructJob(Compilation &C, const JobActi
|
||||
options::OPT_mno_speculative_load_hardening, false))
|
||||
CmdArgs.push_back(Args.MakeArgString("-mspeculative-load-hardening"));
|
||||
|
||||
- RenderSSPOptions(TC, Args, CmdArgs, KernelOrKext);
|
||||
RenderSCPOptions(TC, Args, CmdArgs);
|
||||
RenderTrivialAutoVarInitOptions(D, TC, Args, CmdArgs);
|
||||
|
||||
- RenderSSPOptions(D, TC, Args, CmdArgs, KernelOrKext);
|
||||
+ // -ret-protector
|
||||
+ unsigned RetProtector = 1;
|
||||
+ if (Arg *A = Args.getLastArg(options::OPT_fno_ret_protector,
|
||||
@ -109,7 +106,7 @@ Index: tools/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
+ options::OPT__param); // ssp-buffer-size
|
||||
+ } else {
|
||||
+ // If we're not using retguard, then do the usual stack protector
|
||||
+ RenderSSPOptions(TC, Args, CmdArgs, KernelOrKext);
|
||||
+ RenderSSPOptions(D, TC, Args, CmdArgs, KernelOrKext);
|
||||
+ }
|
||||
+
|
||||
+ // -fixup-gadgets
|
||||
@ -122,10 +119,10 @@ Index: tools/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
+ CmdArgs.push_back(Args.MakeArgString(Twine("-x86-fixup-gadgets=true")));
|
||||
+ }
|
||||
+
|
||||
// Translate -mstackrealign
|
||||
if (Args.hasFlag(options::OPT_mstackrealign, options::OPT_mno_stackrealign,
|
||||
false))
|
||||
@@ -5857,6 +5907,18 @@ void Clang::ConstructJob(Compilation &C, const JobActi
|
||||
RenderSCPOptions(TC, Args, CmdArgs);
|
||||
RenderTrivialAutoVarInitOptions(D, TC, Args, CmdArgs);
|
||||
|
||||
@@ -6445,6 +6495,18 @@ void Clang::ConstructJob(Compilation &C, const JobActi
|
||||
options::OPT_fno_rewrite_imports, false);
|
||||
if (RewriteImports)
|
||||
CmdArgs.push_back("-frewrite-imports");
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Gnu_cpp,v 1.10 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_Gnu_cpp,v 1.11 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Disable IAS for OpenBSD SPARC.
|
||||
|
||||
Index: tools/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
--- tools/clang/lib/Driver/ToolChains/Gnu.cpp.orig
|
||||
+++ tools/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
@@ -2711,7 +2711,7 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const
|
||||
@@ -2763,7 +2763,7 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const
|
||||
case llvm::Triple::sparc:
|
||||
case llvm::Triple::sparcel:
|
||||
case llvm::Triple::sparcv9:
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_OpenBSD_cpp,v 1.19 2021/09/19 17:49:23 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_OpenBSD_cpp,v 1.20 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Add support for building against libestdc++ from ports-gcc.
|
||||
- Allow the compiler driver to link the libclang_rt.profile library.
|
||||
@ -7,7 +7,7 @@ $OpenBSD: patch-tools_clang_lib_Driver_ToolChains_OpenBSD_cpp,v 1.19 2021/09/19
|
||||
Index: tools/clang/lib/Driver/ToolChains/OpenBSD.cpp
|
||||
--- tools/clang/lib/Driver/ToolChains/OpenBSD.cpp.orig
|
||||
+++ tools/clang/lib/Driver/ToolChains/OpenBSD.cpp
|
||||
@@ -12,6 +12,8 @@
|
||||
@@ -12,10 +12,13 @@
|
||||
#include "CommonArgs.h"
|
||||
#include "clang/Config/config.h"
|
||||
#include "clang/Driver/Compilation.h"
|
||||
@ -16,7 +16,12 @@ Index: tools/clang/lib/Driver/ToolChains/OpenBSD.cpp
|
||||
#include "clang/Driver/Options.h"
|
||||
#include "clang/Driver/SanitizerArgs.h"
|
||||
#include "llvm/Option/ArgList.h"
|
||||
@@ -191,7 +193,13 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
|
||||
#include "llvm/Support/Path.h"
|
||||
+#include "llvm/Support/VirtualFileSystem.h"
|
||||
|
||||
using namespace clang::driver;
|
||||
using namespace clang::driver::tools;
|
||||
@@ -197,7 +200,13 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
|
||||
}
|
||||
// FIXME: For some reason GCC passes -lgcc before adding
|
||||
// the default system libraries. Just mimic this for now.
|
||||
@ -31,7 +36,7 @@ Index: tools/clang/lib/Driver/ToolChains/OpenBSD.cpp
|
||||
|
||||
if (Args.hasArg(options::OPT_pthread)) {
|
||||
if (!Args.hasArg(options::OPT_shared) && Args.hasArg(options::OPT_pg))
|
||||
@@ -207,7 +215,10 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
|
||||
@@ -213,7 +222,10 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
|
||||
CmdArgs.push_back("-lc");
|
||||
}
|
||||
|
||||
@ -43,27 +48,25 @@ Index: tools/clang/lib/Driver/ToolChains/OpenBSD.cpp
|
||||
}
|
||||
|
||||
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
|
||||
@@ -220,6 +231,8 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
|
||||
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
|
||||
}
|
||||
|
||||
+ ToolChain.addProfileRTLibs(Args, CmdArgs);
|
||||
+
|
||||
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
@@ -288,20 +301,21 @@ void OpenBSD::addLibCxxIncludePaths(const llvm::opt::A
|
||||
getDriver().SysRoot + "/usr/include/c++/v1");
|
||||
}
|
||||
|
||||
-void OpenBSD::AddCXXStdlibLibArgs(const ArgList &Args,
|
||||
- ArgStringList &CmdArgs) const {
|
||||
- bool Profiling = Args.hasArg(options::OPT_pg);
|
||||
@@ -301,17 +313,34 @@ void OpenBSD::AddCXXStdlibLibArgs(const ArgList &Args,
|
||||
ArgStringList &CmdArgs) const {
|
||||
bool Profiling = Args.hasArg(options::OPT_pg);
|
||||
|
||||
- CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
|
||||
- CmdArgs.push_back(Profiling ? "-lc++abi_p" : "-lc++abi");
|
||||
-}
|
||||
-
|
||||
- CmdArgs.push_back(Profiling ? "-lpthread_p" : "-lpthread");
|
||||
+ switch (GetCXXStdlibType(Args)) {
|
||||
+ case ToolChain::CST_Libcxx:
|
||||
+ CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
|
||||
+ CmdArgs.push_back(Profiling ? "-lc++abi_p" : "-lc++abi");
|
||||
+ CmdArgs.push_back(Profiling ? "-lpthread_p" : "-lpthread");
|
||||
+ break;
|
||||
+ case ToolChain::CST_Libstdcxx:
|
||||
+ CmdArgs.push_back("-lestdc++");
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
std::string OpenBSD::getCompilerRT(const ArgList &Args,
|
||||
StringRef Component,
|
||||
FileType Type) const {
|
||||
@ -77,14 +80,16 @@ Index: tools/clang/lib/Driver/ToolChains/OpenBSD.cpp
|
||||
+ } else {
|
||||
+ SmallString<128> P(getDriver().ResourceDir);
|
||||
+ std::string CRTBasename =
|
||||
+ getCompilerRTBasename(Args, Component, Type, /*AddArch=*/false);
|
||||
+ buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/false);
|
||||
+ llvm::sys::path::append(P, "lib", CRTBasename);
|
||||
+ return std::string(P.str());
|
||||
+ if (getVFS().exists(P))
|
||||
+ return std::string(P.str());
|
||||
+ return ToolChain::getCompilerRT(Args, Component, Type);
|
||||
+ }
|
||||
}
|
||||
|
||||
Tool *OpenBSD::buildAssembler() const {
|
||||
@@ -311,3 +325,70 @@ Tool *OpenBSD::buildAssembler() const {
|
||||
@@ -321,3 +350,54 @@ Tool *OpenBSD::buildAssembler() const {
|
||||
Tool *OpenBSD::buildLinker() const { return new tools::openbsd::Linker(*this); }
|
||||
|
||||
bool OpenBSD::HasNativeLLVMSupport() const { return true; }
|
||||
@ -139,19 +144,3 @@ Index: tools/clang/lib/Driver/ToolChains/OpenBSD.cpp
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void OpenBSD::AddCXXStdlibLibArgs(const ArgList &Args,
|
||||
+ ArgStringList &CmdArgs) const {
|
||||
+ bool Profiling = Args.hasArg(options::OPT_pg);
|
||||
+
|
||||
+ switch (GetCXXStdlibType(Args)) {
|
||||
+ case ToolChain::CST_Libcxx:
|
||||
+ CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
|
||||
+ CmdArgs.push_back(Profiling ? "-lc++abi_p" : "-lc++abi");
|
||||
+ CmdArgs.push_back(Profiling ? "-lpthread_p" : "-lpthread");
|
||||
+ break;
|
||||
+ case ToolChain::CST_Libstdcxx:
|
||||
+ CmdArgs.push_back("-lestdc++");
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_OpenBSD_h,v 1.9 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_OpenBSD_h,v 1.10 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Add support for building against libestdc++ from ports-gcc.
|
||||
- Make clang emit the proper path to our libcompiler_rt.a when asked to.
|
||||
@ -6,7 +6,7 @@ $OpenBSD: patch-tools_clang_lib_Driver_ToolChains_OpenBSD_h,v 1.9 2021/05/13 23:
|
||||
Index: tools/clang/lib/Driver/ToolChains/OpenBSD.h
|
||||
--- tools/clang/lib/Driver/ToolChains/OpenBSD.h.orig
|
||||
+++ tools/clang/lib/Driver/ToolChains/OpenBSD.h
|
||||
@@ -76,6 +76,11 @@ class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic
|
||||
@@ -77,6 +77,11 @@ class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic
|
||||
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
|
||||
llvm::opt::ArgStringList &CmdArgs) const override;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Frontend_CompilerInvocation_cpp,v 1.10 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Frontend_CompilerInvocation_cpp,v 1.11 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Add RETGUARD to clang for amd64. This security mechanism uses per-function
|
||||
random cookies to protect access to function return instructions, with the
|
||||
@ -21,12 +21,23 @@ $OpenBSD: patch-tools_clang_lib_Frontend_CompilerInvocation_cpp,v 1.10 2021/05/1
|
||||
Index: tools/clang/lib/Frontend/CompilerInvocation.cpp
|
||||
--- tools/clang/lib/Frontend/CompilerInvocation.cpp.orig
|
||||
+++ tools/clang/lib/Frontend/CompilerInvocation.cpp
|
||||
@@ -1250,6 +1250,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, Arg
|
||||
Opts.StackAlignment = StackAlignment;
|
||||
@@ -1470,6 +1470,10 @@ void CompilerInvocation::GenerateCodeGenArgs(
|
||||
F.Filename, SA);
|
||||
}
|
||||
|
||||
+ Opts.ReturnProtector = Args.hasArg(OPT_ret_protector);
|
||||
+ if (Opts.ReturnProtector) {
|
||||
+ GenerateArg(Args, OPT_ret_protector, SA);
|
||||
+ }
|
||||
+
|
||||
if (Arg *A = Args.getLastArg(OPT_mstack_probe_size)) {
|
||||
StringRef Val = A->getValue();
|
||||
unsigned StackProbeSize = Opts.StackProbeSize;
|
||||
// TODO: Consider removing marshalling annotations from f[no_]emulated_tls.
|
||||
// That would make it easy to generate the option only **once** if it was
|
||||
// explicitly set to non-default value.
|
||||
@@ -1805,6 +1809,8 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptio
|
||||
}
|
||||
Opts.LinkBitcodeFiles.push_back(F);
|
||||
}
|
||||
+
|
||||
+ Opts.ReturnProtector = Args.hasArg(OPT_ret_protector);
|
||||
|
||||
if (Args.getLastArg(OPT_femulated_tls) ||
|
||||
Args.getLastArg(OPT_fno_emulated_tls)) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Sema_SemaChecking_cpp,v 1.10 2021/09/19 17:49:23 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Sema_SemaChecking_cpp,v 1.11 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Teach Clang about syslog format attribute
|
||||
- Enable the kprintf format attribute
|
||||
@ -10,7 +10,7 @@ $OpenBSD: patch-tools_clang_lib_Sema_SemaChecking_cpp,v 1.10 2021/09/19 17:49:23
|
||||
Index: tools/clang/lib/Sema/SemaChecking.cpp
|
||||
--- tools/clang/lib/Sema/SemaChecking.cpp.orig
|
||||
+++ tools/clang/lib/Sema/SemaChecking.cpp
|
||||
@@ -7095,7 +7095,7 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef
|
||||
@@ -7847,7 +7847,7 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef
|
||||
Sema::FormatStringType Sema::GetFormatStringType(const FormatAttr *Format) {
|
||||
return llvm::StringSwitch<FormatStringType>(Format->getType()->getName())
|
||||
.Case("scanf", FST_Scanf)
|
||||
@ -19,7 +19,7 @@ Index: tools/clang/lib/Sema/SemaChecking.cpp
|
||||
.Cases("NSString", "CFString", FST_NSString)
|
||||
.Case("strftime", FST_Strftime)
|
||||
.Case("strfmon", FST_Strfmon)
|
||||
@@ -7192,6 +7192,7 @@ bool Sema::CheckFormatArguments(ArrayRef<const Expr *>
|
||||
@@ -7944,6 +7944,7 @@ bool Sema::CheckFormatArguments(ArrayRef<const Expr *>
|
||||
case FST_Kprintf:
|
||||
case FST_FreeBSDKPrintf:
|
||||
case FST_Printf:
|
||||
@ -27,7 +27,7 @@ Index: tools/clang/lib/Sema/SemaChecking.cpp
|
||||
Diag(FormatLoc, diag::note_format_security_fixit)
|
||||
<< FixItHint::CreateInsertion(FormatLoc, "\"%s\", ");
|
||||
break;
|
||||
@@ -8017,19 +8018,34 @@ CheckPrintfHandler::HandlePrintfSpecifier(const analyz
|
||||
@@ -8769,19 +8770,34 @@ CheckPrintfHandler::HandlePrintfSpecifier(const analyz
|
||||
// Claim the second argument.
|
||||
CoveredArgs.set(argIndex + 1);
|
||||
|
||||
@ -71,7 +71,7 @@ Index: tools/clang/lib/Sema/SemaChecking.cpp
|
||||
// Type check the second argument (char * for both %b and %D)
|
||||
Ex = getDataArg(argIndex + 1);
|
||||
const analyze_printf::ArgType &AT2 = ArgType::CStrTy;
|
||||
@@ -8067,6 +8083,15 @@ CheckPrintfHandler::HandlePrintfSpecifier(const analyz
|
||||
@@ -8819,6 +8835,15 @@ CheckPrintfHandler::HandlePrintfSpecifier(const analyz
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ Index: tools/clang/lib/Sema/SemaChecking.cpp
|
||||
// Only scalars are allowed for os_trace.
|
||||
if (FSType == Sema::FST_OSTrace &&
|
||||
(CS.getKind() == ConversionSpecifier::PArg ||
|
||||
@@ -8810,8 +8835,9 @@ static void CheckFormatString(Sema &S, const FormatStr
|
||||
@@ -9565,8 +9590,9 @@ static void CheckFormatString(Sema &S, const FormatStr
|
||||
}
|
||||
|
||||
if (Type == Sema::FST_Printf || Type == Sema::FST_NSString ||
|
||||
@ -99,7 +99,7 @@ Index: tools/clang/lib/Sema/SemaChecking.cpp
|
||||
CheckPrintfHandler H(
|
||||
S, FExpr, OrigFormatExpr, Type, firstDataArg, numDataArgs,
|
||||
(Type == Sema::FST_NSString || Type == Sema::FST_OSTrace), Str,
|
||||
@@ -8821,7 +8847,7 @@ static void CheckFormatString(Sema &S, const FormatStr
|
||||
@@ -9576,7 +9602,7 @@ static void CheckFormatString(Sema &S, const FormatStr
|
||||
if (!analyze_format_string::ParsePrintfString(H, Str, Str + StrLen,
|
||||
S.getLangOpts(),
|
||||
S.Context.getTargetInfo(),
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Sema_SemaDeclAttr_cpp,v 1.12 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Sema_SemaDeclAttr_cpp,v 1.13 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Teach Clang about syslog format attribute
|
||||
|
||||
Index: tools/clang/lib/Sema/SemaDeclAttr.cpp
|
||||
--- tools/clang/lib/Sema/SemaDeclAttr.cpp.orig
|
||||
+++ tools/clang/lib/Sema/SemaDeclAttr.cpp
|
||||
@@ -3267,6 +3267,7 @@ static FormatAttrKind getFormatAttrKind(StringRef Form
|
||||
@@ -3411,6 +3411,7 @@ static FormatAttrKind getFormatAttrKind(StringRef Form
|
||||
.Case("freebsd_kprintf", SupportedFormat) // FreeBSD.
|
||||
.Case("os_trace", SupportedFormat)
|
||||
.Case("os_log", SupportedFormat)
|
||||
|
@ -0,0 +1,15 @@
|
||||
$OpenBSD: patch-tools_clang_tools_clang-shlib_CMakeLists_txt,v 1.1 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
-Bsymbolic-functions is not supported by our ld.bfd version.
|
||||
|
||||
Index: tools/clang/tools/clang-shlib/CMakeLists.txt
|
||||
--- tools/clang/tools/clang-shlib/CMakeLists.txt.orig
|
||||
+++ tools/clang/tools/clang-shlib/CMakeLists.txt
|
||||
@@ -50,6 +50,6 @@ add_clang_library(clang-cpp
|
||||
${_DEPS})
|
||||
# Optimize function calls for default visibility definitions to avoid PLT and
|
||||
# reduce dynamic relocations.
|
||||
-if (NOT APPLE AND NOT MINGW)
|
||||
+if (NOT APPLE AND NOT MINGW AND ${OPENBSD_LD_IS_LLD})
|
||||
target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
|
||||
endif()
|
@ -1,13 +1,13 @@
|
||||
$OpenBSD: patch-tools_clang_tools_scan-build_libexec_ccc-analyzer,v 1.1 2021/05/17 21:45:09 tb Exp $
|
||||
$OpenBSD: patch-tools_clang_tools_scan-build_libexec_ccc-analyzer,v 1.2 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Our default compilers are cc/c++.
|
||||
|
||||
Index: tools/clang/tools/scan-build/libexec/ccc-analyzer
|
||||
--- tools/clang/tools/scan-build/libexec/ccc-analyzer.orig
|
||||
+++ tools/clang/tools/scan-build/libexec/ccc-analyzer
|
||||
@@ -81,8 +81,8 @@ if (`uname -a` =~ m/Darwin/) {
|
||||
$UseXCRUN = 1;
|
||||
}
|
||||
@@ -84,8 +84,8 @@ if (`uname -a` =~ m/Darwin/) {
|
||||
$DefaultCCompiler = 'cc';
|
||||
$DefaultCXXCompiler = 'c++';
|
||||
} else {
|
||||
- $DefaultCCompiler = 'gcc';
|
||||
- $DefaultCXXCompiler = 'g++';
|
||||
|
16
devel/llvm/patches/patch-tools_lld_CMakeLists_txt
Normal file
16
devel/llvm/patches/patch-tools_lld_CMakeLists_txt
Normal file
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-tools_lld_CMakeLists_txt,v 1.3 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Don't build MachO2 support in lld. This code reaches into libunwind
|
||||
internals.
|
||||
|
||||
Index: tools/lld/CMakeLists.txt
|
||||
--- tools/lld/CMakeLists.txt.orig
|
||||
+++ tools/lld/CMakeLists.txt
|
||||
@@ -206,7 +206,6 @@ endif()
|
||||
add_subdirectory(docs)
|
||||
add_subdirectory(COFF)
|
||||
add_subdirectory(ELF)
|
||||
-add_subdirectory(MachO)
|
||||
add_subdirectory(MinGW)
|
||||
add_subdirectory(wasm)
|
||||
|
@ -1,23 +0,0 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_Arch_PPC_cpp,v 1.2 2021/05/13 23:54:25 jca Exp $
|
||||
|
||||
Add R_PPC_ADDR24 to lld.
|
||||
|
||||
Index: tools/lld/ELF/Arch/PPC.cpp
|
||||
--- tools/lld/ELF/Arch/PPC.cpp.orig
|
||||
+++ tools/lld/ELF/Arch/PPC.cpp
|
||||
@@ -223,6 +223,7 @@ RelExpr PPC::getRelExpr(RelType type, const Symbol &s,
|
||||
case R_PPC_ADDR16_HA:
|
||||
case R_PPC_ADDR16_HI:
|
||||
case R_PPC_ADDR16_LO:
|
||||
+ case R_PPC_ADDR24:
|
||||
case R_PPC_ADDR32:
|
||||
return R_ABS;
|
||||
case R_PPC_DTPREL16:
|
||||
@@ -347,6 +348,7 @@ void PPC::relocate(uint8_t *loc, const Relocation &rel
|
||||
break;
|
||||
}
|
||||
case R_PPC_REL24:
|
||||
+ case R_PPC_ADDR24:
|
||||
case R_PPC_LOCAL24PC:
|
||||
case R_PPC_PLTREL24: {
|
||||
uint32_t mask = 0x03FFFFFC;
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_Config_h,v 1.9 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_lld_ELF_Config_h,v 1.10 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- XXX no comment
|
||||
|
||||
Index: tools/lld/ELF/Config.h
|
||||
--- tools/lld/ELF/Config.h.orig
|
||||
+++ tools/lld/ELF/Config.h
|
||||
@@ -249,8 +249,13 @@ struct Configuration {
|
||||
@@ -266,8 +266,13 @@ struct Configuration {
|
||||
ELFKind ekind = ELFNoneKind;
|
||||
uint16_t emachine = llvm::ELF::EM_NONE;
|
||||
llvm::Optional<uint64_t> imageBase;
|
||||
|
@ -1,11 +1,11 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_DriverUtils_cpp,v 1.11 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_lld_ELF_DriverUtils_cpp,v 1.12 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Handle the OpenBSD-style major/minor shared library version scheme.
|
||||
|
||||
Index: tools/lld/ELF/DriverUtils.cpp
|
||||
--- tools/lld/ELF/DriverUtils.cpp.orig
|
||||
+++ tools/lld/ELF/DriverUtils.cpp
|
||||
@@ -227,9 +227,36 @@ Optional<std::string> elf::findFromSearchPaths(StringR
|
||||
@@ -234,9 +234,36 @@ Optional<std::string> elf::findFromSearchPaths(StringR
|
||||
// search paths.
|
||||
Optional<std::string> elf::searchLibraryBaseName(StringRef name) {
|
||||
for (StringRef dir : config->searchPaths) {
|
||||
|
@ -1,22 +1,31 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_Driver_cpp,v 1.16 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_lld_ELF_Driver_cpp,v 1.17 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- enable retpoline by default
|
||||
- allow-shlib-undefined by default
|
||||
- anable PIE by default.
|
||||
|
||||
- Enable PIE by default.
|
||||
- XXX retpoline, EM_SPARCV9, ???
|
||||
|
||||
Index: tools/lld/ELF/Driver.cpp
|
||||
--- tools/lld/ELF/Driver.cpp.orig
|
||||
+++ tools/lld/ELF/Driver.cpp
|
||||
@@ -439,7 +439,8 @@ static bool isKnownZFlag(StringRef s) {
|
||||
s == "nocombreloc" || s == "nocopyreloc" || s == "nodefaultlib" ||
|
||||
s == "nodelete" || s == "nodlopen" || s == "noexecstack" ||
|
||||
s == "nognustack" || s == "nokeep-text-section-prefix" ||
|
||||
- s == "norelro" || s == "noseparate-code" || s == "notext" ||
|
||||
+ s == "norelro" || s == "noretpolineplt" ||
|
||||
+ s == "noseparate-code" || s == "notext" ||
|
||||
@@ -455,6 +455,7 @@ static bool isKnownZFlag(StringRef s) {
|
||||
s == "nodefaultlib" || s == "nodelete" || s == "nodlopen" ||
|
||||
s == "noexecstack" || s == "nognustack" ||
|
||||
s == "nokeep-text-section-prefix" || s == "norelro" ||
|
||||
+ s == "noretpolineplt" ||
|
||||
s == "noseparate-code" || s == "nostart-stop-gc" || s == "notext" ||
|
||||
s == "now" || s == "origin" || s == "pac-plt" || s == "rel" ||
|
||||
s == "rela" || s == "relro" || s == "retpolineplt" ||
|
||||
s == "rodynamic" || s == "shstk" || s == "text" || s == "undefs" ||
|
||||
@@ -948,7 +949,8 @@ static void readConfigs(opt::InputArgList &args) {
|
||||
@@ -598,7 +599,7 @@ static void setUnresolvedSymbolPolicy(opt::InputArgLis
|
||||
: UnresolvedPolicy::Warn;
|
||||
// -shared implies -unresolved-symbols=ignore-all because missing
|
||||
// symbols are likely to be resolved at runtime.
|
||||
- bool diagRegular = !config->shared, diagShlib = !config->shared;
|
||||
+ bool diagRegular = !config->shared, diagShlib = false;
|
||||
|
||||
for (const opt::Arg *arg : args) {
|
||||
switch (arg->getOption().getID()) {
|
||||
@@ -1064,7 +1065,8 @@ static void readConfigs(opt::InputArgList &args) {
|
||||
config->ignoreDataAddressEquality =
|
||||
args.hasArg(OPT_ignore_data_address_equality);
|
||||
config->ignoreFunctionAddressEquality =
|
||||
@ -26,7 +35,7 @@ Index: tools/lld/ELF/Driver.cpp
|
||||
config->init = args.getLastArgValue(OPT_init, "_init");
|
||||
config->ltoAAPipeline = args.getLastArgValue(OPT_lto_aa_pipeline);
|
||||
config->ltoCSProfileGenerate = args.hasArg(OPT_lto_cs_profile_generate);
|
||||
@@ -986,7 +988,12 @@ static void readConfigs(opt::InputArgList &args) {
|
||||
@@ -1118,7 +1120,12 @@ static void readConfigs(opt::InputArgList &args) {
|
||||
config->optimize = args::getInteger(args, OPT_O, 1);
|
||||
config->orphanHandling = getOrphanHandling(args);
|
||||
config->outputFile = args.getLastArgValue(OPT_o);
|
||||
@ -39,7 +48,7 @@ Index: tools/lld/ELF/Driver.cpp
|
||||
config->printIcfSections =
|
||||
args.hasFlag(OPT_print_icf_sections, OPT_no_print_icf_sections, false);
|
||||
config->printGcSections =
|
||||
@@ -1061,7 +1068,11 @@ static void readConfigs(opt::InputArgList &args) {
|
||||
@@ -1188,7 +1195,11 @@ static void readConfigs(opt::InputArgList &args) {
|
||||
config->zOrigin = hasZOption(args, "origin");
|
||||
config->zPacPlt = hasZOption(args, "pac-plt");
|
||||
config->zRelro = getZFlag(args, "relro", "norelro", true);
|
||||
@ -52,7 +61,7 @@ Index: tools/lld/ELF/Driver.cpp
|
||||
config->zRodynamic = hasZOption(args, "rodynamic");
|
||||
config->zSeparate = getZSeparate(args);
|
||||
config->zShstk = hasZOption(args, "shstk");
|
||||
@@ -1421,7 +1432,7 @@ void LinkerDriver::inferMachineType() {
|
||||
@@ -1596,7 +1607,7 @@ void LinkerDriver::inferMachineType() {
|
||||
}
|
||||
|
||||
// Parse -z max-page-size=<value>. The default value is defined by
|
||||
@ -61,7 +70,7 @@ Index: tools/lld/ELF/Driver.cpp
|
||||
static uint64_t getMaxPageSize(opt::InputArgList &args) {
|
||||
uint64_t val = args::getZOptionValue(args, OPT_z, "max-page-size",
|
||||
target->defaultMaxPageSize);
|
||||
@@ -1436,7 +1447,7 @@ static uint64_t getMaxPageSize(opt::InputArgList &args
|
||||
@@ -1611,7 +1622,7 @@ static uint64_t getMaxPageSize(opt::InputArgList &args
|
||||
}
|
||||
|
||||
// Parse -z common-page-size=<value>. The default value is defined by
|
||||
@ -70,7 +79,7 @@ Index: tools/lld/ELF/Driver.cpp
|
||||
static uint64_t getCommonPageSize(opt::InputArgList &args) {
|
||||
uint64_t val = args::getZOptionValue(args, OPT_z, "common-page-size",
|
||||
target->defaultCommonPageSize);
|
||||
@@ -1453,6 +1464,16 @@ static uint64_t getCommonPageSize(opt::InputArgList &a
|
||||
@@ -1628,6 +1639,16 @@ static uint64_t getCommonPageSize(opt::InputArgList &a
|
||||
return val;
|
||||
}
|
||||
|
||||
@ -87,7 +96,7 @@ Index: tools/lld/ELF/Driver.cpp
|
||||
// Parses -image-base option.
|
||||
static Optional<uint64_t> getImageBase(opt::InputArgList &args) {
|
||||
// Because we are using "Config->maxPageSize" here, this function has to be
|
||||
@@ -2088,6 +2109,11 @@ template <class ELFT> void LinkerDriver::link(opt::Inp
|
||||
@@ -2414,6 +2435,11 @@ template <class ELFT> void LinkerDriver::link(opt::Inp
|
||||
// optimizations such as DATA_SEGMENT_ALIGN in linker scripts. LLD's use of it
|
||||
// is limited to writing trap instructions on the last executable segment.
|
||||
config->commonPageSize = getCommonPageSize(args);
|
||||
|
@ -1,19 +0,0 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_InputSection_cpp,v 1.7 2021/08/14 02:46:18 jca Exp $
|
||||
|
||||
[ELF] Allow R_386_GOTOFF from .debug_info.
|
||||
|
||||
Index: tools/lld/ELF/InputSection.cpp
|
||||
--- tools/lld/ELF/InputSection.cpp.orig
|
||||
+++ tools/lld/ELF/InputSection.cpp
|
||||
@@ -891,7 +891,10 @@ void InputSection::relocateNonAlloc(uint8_t *buf, Arra
|
||||
continue;
|
||||
}
|
||||
|
||||
- if (expr != R_ABS && expr != R_DTPREL && expr != R_RISCV_ADD) {
|
||||
+ // R_ABS/R_DTPREL and some other relocations can be used from non-SHF_ALLOC
|
||||
+ // sections.
|
||||
+ if (expr != R_ABS && expr != R_DTPREL && expr != R_GOTPLTREL &&
|
||||
+ expr != R_RISCV_ADD) {
|
||||
std::string msg = getLocation<ELFT>(offset) +
|
||||
": has non-ABS relocation " + toString(type) +
|
||||
" against symbol '" + toString(sym) + "'";
|
@ -1,19 +1,19 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_LinkerScript_cpp,v 1.7 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_lld_ELF_LinkerScript_cpp,v 1.8 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- XXX no comment
|
||||
|
||||
Index: tools/lld/ELF/LinkerScript.cpp
|
||||
--- tools/lld/ELF/LinkerScript.cpp.orig
|
||||
+++ tools/lld/ELF/LinkerScript.cpp
|
||||
@@ -873,7 +873,6 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
|
||||
expandMemoryRegion(ctx->memRegion, dot - ctx->memRegion->curPos,
|
||||
ctx->memRegion->name, sec->name);
|
||||
@@ -954,7 +954,6 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
|
||||
ctx->memRegion->name, sec->name);
|
||||
}
|
||||
|
||||
- switchTo(sec);
|
||||
|
||||
// ctx->lmaOffset is LMA minus VMA. If LMA is explicitly specified via AT() or
|
||||
// AT>, recompute ctx->lmaOffset; otherwise, if both previous/current LMA
|
||||
@@ -887,6 +886,8 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
|
||||
@@ -968,6 +967,8 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
|
||||
ctx->lmaOffset = alignTo(mr->curPos, sec->alignment) - dot;
|
||||
else if (!sameMemRegion || !prevLMARegionIsDefault)
|
||||
ctx->lmaOffset = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_Options_td,v 1.7 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_lld_ELF_Options_td,v 1.8 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- [ELF] Add -nopie alias for -no-pie
|
||||
- defm ignore_function_address_equality: TODO (document it)
|
||||
@ -6,7 +6,7 @@ $OpenBSD: patch-tools_lld_ELF_Options_td,v 1.7 2021/05/13 23:54:25 jca Exp $
|
||||
Index: tools/lld/ELF/Options.td
|
||||
--- tools/lld/ELF/Options.td.orig
|
||||
+++ tools/lld/ELF/Options.td
|
||||
@@ -232,8 +232,9 @@ def icf_safe: F<"icf=safe">, HelpText<"Enable safe ide
|
||||
@@ -248,8 +248,9 @@ def icf_safe: F<"icf=safe">, HelpText<"Enable safe ide
|
||||
|
||||
def icf_none: F<"icf=none">, HelpText<"Disable identical code folding (default)">;
|
||||
|
||||
@ -18,7 +18,7 @@ Index: tools/lld/ELF/Options.td
|
||||
|
||||
def ignore_data_address_equality: F<"ignore-data-address-equality">,
|
||||
HelpText<"lld can break the address equality of data">;
|
||||
@@ -489,6 +490,7 @@ def: Separate<["-"], "F">, Alias<filter>, HelpText<"Al
|
||||
@@ -520,6 +521,7 @@ def: Separate<["-"], "F">, Alias<filter>, HelpText<"Al
|
||||
def: Separate<["-"], "b">, Alias<format>, HelpText<"Alias for --format">;
|
||||
def: JoinedOrSeparate<["-"], "l">, Alias<library>, HelpText<"Alias for --library">;
|
||||
def: JoinedOrSeparate<["-"], "L">, Alias<library_path>, HelpText<"Alias for --library-path">;
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_Symbols_cpp,v 1.4 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_lld_ELF_Symbols_cpp,v 1.5 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Generate __data_start symbol that marks the start of .data when __data_start
|
||||
is referenced from code being linked.
|
||||
@ -6,7 +6,7 @@ is referenced from code being linked.
|
||||
Index: tools/lld/ELF/Symbols.cpp
|
||||
--- tools/lld/ELF/Symbols.cpp.orig
|
||||
+++ tools/lld/ELF/Symbols.cpp
|
||||
@@ -50,6 +50,7 @@ std::string lld::toELFString(const Archive::Symbol &b)
|
||||
@@ -48,6 +48,7 @@ std::string lld::toELFString(const Archive::Symbol &b)
|
||||
}
|
||||
|
||||
Defined *ElfSym::bss;
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_Symbols_h,v 1.6 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_lld_ELF_Symbols_h,v 1.7 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Generate __data_start symbol that marks the start of .data when __data_start
|
||||
is referenced from code being linked.
|
||||
@ -6,7 +6,7 @@ is referenced from code being linked.
|
||||
Index: tools/lld/ELF/Symbols.h
|
||||
--- tools/lld/ELF/Symbols.h.orig
|
||||
+++ tools/lld/ELF/Symbols.h
|
||||
@@ -425,6 +425,9 @@ struct ElfSym {
|
||||
@@ -436,6 +436,9 @@ struct ElfSym {
|
||||
// __bss_start
|
||||
static Defined *bss;
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_SyntheticSections_cpp,v 1.17 2021/05/13 23:54:25 jca Exp $
|
||||
|
||||
- Always allocate GOT header entries on powerpc.
|
||||
- Do not reserve PowerPC GOT header entries when creating a relocatable object file.
|
||||
|
||||
Index: tools/lld/ELF/SyntheticSections.cpp
|
||||
--- tools/lld/ELF/SyntheticSections.cpp.orig
|
||||
+++ tools/lld/ELF/SyntheticSections.cpp
|
||||
@@ -607,6 +607,8 @@ GotSection::GotSection()
|
||||
// ElfSym::globalOffsetTable.
|
||||
if (ElfSym::globalOffsetTable && !target->gotBaseSymInGotPlt)
|
||||
numEntries += target->gotHeaderEntriesNum;
|
||||
+ else if (config->emachine == EM_PPC && !config->relocatable)
|
||||
+ numEntries += target->gotHeaderEntriesNum;
|
||||
}
|
||||
|
||||
void GotSection::addEntry(Symbol &sym) {
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_lld_ELF_Writer_cpp,v 1.15 2021/05/13 23:54:25 jca Exp $
|
||||
$OpenBSD: patch-tools_lld_ELF_Writer_cpp,v 1.16 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
- Merge '.openbsd.randomdata.*' sections into a single '.openbsd.randomdata'
|
||||
section when linking, as we do when using ld from binutils.
|
||||
@ -10,7 +10,7 @@ $OpenBSD: patch-tools_lld_ELF_Writer_cpp,v 1.15 2021/05/13 23:54:25 jca Exp $
|
||||
Index: tools/lld/ELF/Writer.cpp
|
||||
--- tools/lld/ELF/Writer.cpp.orig
|
||||
+++ tools/lld/ELF/Writer.cpp
|
||||
@@ -140,7 +140,8 @@ StringRef elf::getOutputSectionName(const InputSection
|
||||
@@ -145,7 +145,8 @@ StringRef elf::getOutputSectionName(const InputSection
|
||||
for (StringRef v :
|
||||
{".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.rel.ro.",
|
||||
".bss.", ".init_array.", ".fini_array.", ".ctors.", ".dtors.", ".tbss.",
|
||||
@ -20,7 +20,7 @@ Index: tools/lld/ELF/Writer.cpp
|
||||
if (isSectionPrefix(v, s->name))
|
||||
return v.drop_back();
|
||||
|
||||
@@ -319,6 +320,7 @@ void elf::addReservedSymbols() {
|
||||
@@ -324,6 +325,7 @@ void elf::addReservedSymbols() {
|
||||
};
|
||||
|
||||
ElfSym::bss = add("__bss_start", 0);
|
||||
@ -28,7 +28,7 @@ Index: tools/lld/ELF/Writer.cpp
|
||||
ElfSym::end1 = add("end", -1);
|
||||
ElfSym::end2 = add("_end", -1);
|
||||
ElfSym::etext1 = add("etext", -1);
|
||||
@@ -870,7 +872,11 @@ static bool isRelroSection(const OutputSection *sec) {
|
||||
@@ -883,7 +885,11 @@ static bool isRelroSection(const OutputSection *sec) {
|
||||
// However, if "-z now" is given, the lazy symbol resolution is
|
||||
// disabled, which enables us to put it into RELRO.
|
||||
if (sec == in.gotPlt->getParent())
|
||||
@ -40,7 +40,7 @@ Index: tools/lld/ELF/Writer.cpp
|
||||
|
||||
// .dynamic section contains data for the dynamic linker, and
|
||||
// there's no need to write to it at runtime, so it's better to put
|
||||
@@ -1180,6 +1186,9 @@ template <class ELFT> void Writer<ELFT>::setReservedSy
|
||||
@@ -1193,6 +1199,9 @@ template <class ELFT> void Writer<ELFT>::setReservedSy
|
||||
if (ElfSym::bss)
|
||||
ElfSym::bss->section = findSection(".bss");
|
||||
|
||||
@ -50,7 +50,7 @@ Index: tools/lld/ELF/Writer.cpp
|
||||
// Setup MIPS _gp_disp/__gnu_local_gp symbols which should
|
||||
// be equal to the _gp symbol's value.
|
||||
if (ElfSym::mipsGp) {
|
||||
@@ -2499,6 +2508,31 @@ template <class ELFT> void Writer<ELFT>::fixSectionAli
|
||||
@@ -2576,6 +2585,31 @@ template <class ELFT> void Writer<ELFT>::fixSectionAli
|
||||
};
|
||||
}
|
||||
};
|
||||
|
16
devel/llvm/patches/patch-tools_lld_tools_lld_CMakeLists_txt
Normal file
16
devel/llvm/patches/patch-tools_lld_tools_lld_CMakeLists_txt
Normal file
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-tools_lld_tools_lld_CMakeLists_txt,v 1.1 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Don't build MachO2 support in lld. This code reaches into libunwind
|
||||
internals.
|
||||
|
||||
Index: tools/lld/tools/lld/CMakeLists.txt
|
||||
--- tools/lld/tools/lld/CMakeLists.txt.orig
|
||||
+++ tools/lld/tools/lld/CMakeLists.txt
|
||||
@@ -15,7 +15,6 @@ target_link_libraries(lld
|
||||
lldCOFF
|
||||
lldDriver
|
||||
lldELF
|
||||
- lldMachO2
|
||||
lldMinGW
|
||||
lldWasm
|
||||
)
|
21
devel/llvm/patches/patch-tools_lld_tools_lld_lld_cpp
Normal file
21
devel/llvm/patches/patch-tools_lld_tools_lld_lld_cpp
Normal file
@ -0,0 +1,21 @@
|
||||
$OpenBSD: patch-tools_lld_tools_lld_lld_cpp,v 1.1 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
Don't build MachO2 support in lld. This code reaches into libunwind
|
||||
internals.
|
||||
|
||||
Index: tools/lld/tools/lld/lld.cpp
|
||||
--- tools/lld/tools/lld/lld.cpp.orig
|
||||
+++ tools/lld/tools/lld/lld.cpp
|
||||
@@ -148,10 +148,12 @@ static int lldMain(int argc, const char **argv, llvm::
|
||||
return !elf::link(args, exitEarly, stdoutOS, stderrOS);
|
||||
case WinLink:
|
||||
return !coff::link(args, exitEarly, stdoutOS, stderrOS);
|
||||
+#if 0
|
||||
case Darwin:
|
||||
return !macho::link(args, exitEarly, stdoutOS, stderrOS);
|
||||
case DarwinOld:
|
||||
return !mach_o::link(args, exitEarly, stdoutOS, stderrOS);
|
||||
+#endif
|
||||
case Wasm:
|
||||
return !lld::wasm::link(args, exitEarly, stdoutOS, stderrOS);
|
||||
default:
|
16
devel/llvm/patches/patch-tools_llvm-shlib_CMakeLists_txt
Normal file
16
devel/llvm/patches/patch-tools_llvm-shlib_CMakeLists_txt
Normal file
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-tools_llvm-shlib_CMakeLists_txt,v 1.4 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
-Bsymbolic-functions is not supported by our ld.bfd version.
|
||||
|
||||
Index: tools/llvm-shlib/CMakeLists.txt
|
||||
--- tools/llvm-shlib/CMakeLists.txt.orig
|
||||
+++ tools/llvm-shlib/CMakeLists.txt
|
||||
@@ -50,7 +50,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
|
||||
# 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()
|
||||
- if (NOT MINGW)
|
||||
+ if (NOT MINGW AND ${OPENBSD_LD_IS_LLD})
|
||||
# Optimize function calls for default visibility definitions to avoid PLT and
|
||||
# reduce dynamic relocations.
|
||||
# Note: for -fno-pic default, the address of a function may be different from
|
@ -1,4 +1,4 @@
|
||||
@comment $OpenBSD: PLIST-lldb,v 1.8 2021/05/13 23:54:25 jca Exp $
|
||||
@comment $OpenBSD: PLIST-lldb,v 1.9 2022/01/03 21:33:52 jca Exp $
|
||||
@conflict ${MODPY_PY_PREFIX}llvm-<6.0.1p3
|
||||
@conflict llvm-<10.0.0p0
|
||||
@bin bin/lldb
|
||||
@ -64,7 +64,6 @@ include/lldb/API/SBThread.h
|
||||
include/lldb/API/SBThreadCollection.h
|
||||
include/lldb/API/SBThreadPlan.h
|
||||
include/lldb/API/SBTrace.h
|
||||
include/lldb/API/SBTraceOptions.h
|
||||
include/lldb/API/SBType.h
|
||||
include/lldb/API/SBTypeCategory.h
|
||||
include/lldb/API/SBTypeEnumMember.h
|
||||
@ -99,7 +98,8 @@ include/lldb/Breakpoint/BreakpointSite.h
|
||||
include/lldb/Breakpoint/BreakpointSiteList.h
|
||||
include/lldb/Breakpoint/Stoppoint.h
|
||||
include/lldb/Breakpoint/StoppointCallbackContext.h
|
||||
include/lldb/Breakpoint/StoppointLocation.h
|
||||
include/lldb/Breakpoint/StoppointHitCounter.h
|
||||
include/lldb/Breakpoint/StoppointSite.h
|
||||
include/lldb/Breakpoint/Watchpoint.h
|
||||
include/lldb/Breakpoint/WatchpointList.h
|
||||
include/lldb/Breakpoint/WatchpointOptions.h
|
||||
@ -108,10 +108,10 @@ include/lldb/Core/Address.h
|
||||
include/lldb/Core/AddressRange.h
|
||||
include/lldb/Core/AddressResolver.h
|
||||
include/lldb/Core/AddressResolverFileLine.h
|
||||
include/lldb/Core/AddressResolverName.h
|
||||
include/lldb/Core/Architecture.h
|
||||
include/lldb/Core/Communication.h
|
||||
include/lldb/Core/Debugger.h
|
||||
include/lldb/Core/Declaration.h
|
||||
include/lldb/Core/Disassembler.h
|
||||
include/lldb/Core/DumpDataExtractor.h
|
||||
include/lldb/Core/DumpRegisterValue.h
|
||||
@ -133,9 +133,11 @@ include/lldb/Core/ModuleSpec.h
|
||||
include/lldb/Core/Opcode.h
|
||||
include/lldb/Core/PluginInterface.h
|
||||
include/lldb/Core/PluginManager.h
|
||||
include/lldb/Core/Progress.h
|
||||
include/lldb/Core/RichManglingContext.h
|
||||
include/lldb/Core/SearchFilter.h
|
||||
include/lldb/Core/Section.h
|
||||
include/lldb/Core/SourceLocationSpec.h
|
||||
include/lldb/Core/SourceManager.h
|
||||
include/lldb/Core/StreamAsynchronousIO.h
|
||||
include/lldb/Core/StreamBuffer.h
|
||||
@ -159,6 +161,7 @@ include/lldb/Core/ValueObjectList.h
|
||||
include/lldb/Core/ValueObjectMemory.h
|
||||
include/lldb/Core/ValueObjectRegister.h
|
||||
include/lldb/Core/ValueObjectSyntheticFilter.h
|
||||
include/lldb/Core/ValueObjectUpdater.h
|
||||
include/lldb/Core/ValueObjectVariable.h
|
||||
include/lldb/Core/dwarf.h
|
||||
include/lldb/DataFormatters/
|
||||
@ -255,6 +258,7 @@ include/lldb/Host/freebsd/
|
||||
include/lldb/Host/freebsd/HostInfoFreeBSD.h
|
||||
include/lldb/Host/linux/
|
||||
include/lldb/Host/linux/AbstractSocket.h
|
||||
include/lldb/Host/linux/Host.h
|
||||
include/lldb/Host/linux/HostInfoLinux.h
|
||||
include/lldb/Host/linux/Ptrace.h
|
||||
include/lldb/Host/linux/Support.h
|
||||
@ -286,7 +290,6 @@ include/lldb/Host/windows/LockFileWindows.h
|
||||
include/lldb/Host/windows/PipeWindows.h
|
||||
include/lldb/Host/windows/PosixApi.h
|
||||
include/lldb/Host/windows/ProcessLauncherWindows.h
|
||||
include/lldb/Host/windows/editlinewin.h
|
||||
include/lldb/Host/windows/windows.h
|
||||
include/lldb/Initialization/
|
||||
include/lldb/Initialization/SystemInitializer.h
|
||||
@ -299,7 +302,6 @@ include/lldb/Interpreter/CommandHistory.h
|
||||
include/lldb/Interpreter/CommandInterpreter.h
|
||||
include/lldb/Interpreter/CommandObject.h
|
||||
include/lldb/Interpreter/CommandObjectMultiword.h
|
||||
include/lldb/Interpreter/CommandObjectRegexCommand.h
|
||||
include/lldb/Interpreter/CommandOptionValidators.h
|
||||
include/lldb/Interpreter/CommandReturnObject.h
|
||||
include/lldb/Interpreter/OptionArgParser.h
|
||||
@ -324,6 +326,7 @@ include/lldb/Interpreter/OptionValueBoolean.h
|
||||
include/lldb/Interpreter/OptionValueChar.h
|
||||
include/lldb/Interpreter/OptionValueDictionary.h
|
||||
include/lldb/Interpreter/OptionValueEnumeration.h
|
||||
include/lldb/Interpreter/OptionValueFileColonLine.h
|
||||
include/lldb/Interpreter/OptionValueFileSpec.h
|
||||
include/lldb/Interpreter/OptionValueFileSpecList.h
|
||||
include/lldb/Interpreter/OptionValueFormat.h
|
||||
@ -340,6 +343,7 @@ include/lldb/Interpreter/OptionValues.h
|
||||
include/lldb/Interpreter/Options.h
|
||||
include/lldb/Interpreter/Property.h
|
||||
include/lldb/Interpreter/ScriptInterpreter.h
|
||||
include/lldb/Interpreter/ScriptedProcessInterface.h
|
||||
include/lldb/Symbol/
|
||||
include/lldb/Symbol/ArmUnwindInfo.h
|
||||
include/lldb/Symbol/Block.h
|
||||
@ -352,7 +356,6 @@ include/lldb/Symbol/CompilerType.h
|
||||
include/lldb/Symbol/DWARFCallFrameInfo.h
|
||||
include/lldb/Symbol/DebugMacros.h
|
||||
include/lldb/Symbol/DeclVendor.h
|
||||
include/lldb/Symbol/Declaration.h
|
||||
include/lldb/Symbol/FuncUnwinders.h
|
||||
include/lldb/Symbol/Function.h
|
||||
include/lldb/Symbol/LineEntry.h
|
||||
@ -392,12 +395,15 @@ include/lldb/Target/LanguageRuntime.h
|
||||
include/lldb/Target/Memory.h
|
||||
include/lldb/Target/MemoryHistory.h
|
||||
include/lldb/Target/MemoryRegionInfo.h
|
||||
include/lldb/Target/MemoryTagManager.h
|
||||
include/lldb/Target/ModuleCache.h
|
||||
include/lldb/Target/OperatingSystem.h
|
||||
include/lldb/Target/PathMappingList.h
|
||||
include/lldb/Target/Platform.h
|
||||
include/lldb/Target/PostMortemProcess.h
|
||||
include/lldb/Target/Process.h
|
||||
include/lldb/Target/ProcessStructReader.h
|
||||
include/lldb/Target/ProcessTrace.h
|
||||
include/lldb/Target/Queue.h
|
||||
include/lldb/Target/QueueItem.h
|
||||
include/lldb/Target/QueueList.h
|
||||
@ -406,6 +412,7 @@ include/lldb/Target/RegisterContext.h
|
||||
include/lldb/Target/RegisterContextUnwind.h
|
||||
include/lldb/Target/RegisterNumber.h
|
||||
include/lldb/Target/RemoteAwarePlatform.h
|
||||
include/lldb/Target/Runtime.h
|
||||
include/lldb/Target/SectionLoadHistory.h
|
||||
include/lldb/Target/SectionLoadList.h
|
||||
include/lldb/Target/StackFrame.h
|
||||
@ -440,6 +447,10 @@ include/lldb/Target/ThreadPlanStepThrough.h
|
||||
include/lldb/Target/ThreadPlanStepUntil.h
|
||||
include/lldb/Target/ThreadPlanTracer.h
|
||||
include/lldb/Target/ThreadSpec.h
|
||||
include/lldb/Target/Trace.h
|
||||
include/lldb/Target/TraceCursor.h
|
||||
include/lldb/Target/TraceExporter.h
|
||||
include/lldb/Target/TraceInstructionDumper.h
|
||||
include/lldb/Target/UnixSignals.h
|
||||
include/lldb/Target/Unwind.h
|
||||
include/lldb/Target/UnwindAssembly.h
|
||||
@ -450,6 +461,7 @@ include/lldb/Utility/ArchSpec.h
|
||||
include/lldb/Utility/Args.h
|
||||
include/lldb/Utility/Baton.h
|
||||
include/lldb/Utility/Broadcaster.h
|
||||
include/lldb/Utility/Cloneable.h
|
||||
include/lldb/Utility/CompletionRequest.h
|
||||
include/lldb/Utility/Connection.h
|
||||
include/lldb/Utility/ConstString.h
|
||||
@ -471,6 +483,7 @@ include/lldb/Utility/Listener.h
|
||||
include/lldb/Utility/Log.h
|
||||
include/lldb/Utility/Logging.h
|
||||
include/lldb/Utility/NameMatches.h
|
||||
include/lldb/Utility/OptionDefinition.h
|
||||
include/lldb/Utility/Predicate.h
|
||||
include/lldb/Utility/ProcessInfo.h
|
||||
include/lldb/Utility/RangeMap.h
|
||||
@ -478,6 +491,7 @@ include/lldb/Utility/RegisterValue.h
|
||||
include/lldb/Utility/RegularExpression.h
|
||||
include/lldb/Utility/Reproducer.h
|
||||
include/lldb/Utility/ReproducerInstrumentation.h
|
||||
include/lldb/Utility/ReproducerProvider.h
|
||||
include/lldb/Utility/Scalar.h
|
||||
include/lldb/Utility/SelectHelper.h
|
||||
include/lldb/Utility/SharedCluster.h
|
||||
@ -495,8 +509,10 @@ include/lldb/Utility/StructuredData.h
|
||||
include/lldb/Utility/TildeExpressionResolver.h
|
||||
include/lldb/Utility/Timeout.h
|
||||
include/lldb/Utility/Timer.h
|
||||
include/lldb/Utility/TraceOptions.h
|
||||
include/lldb/Utility/TraceGDBRemotePackets.h
|
||||
include/lldb/Utility/TraceIntelPTGDBRemotePackets.h
|
||||
include/lldb/Utility/UUID.h
|
||||
include/lldb/Utility/UnimplementedError.h
|
||||
include/lldb/Utility/UriParser.h
|
||||
include/lldb/Utility/UserID.h
|
||||
include/lldb/Utility/UserIDResolver.h
|
||||
@ -546,6 +562,12 @@ lib/python${MODPY_VERSION}/site-packages/lldb/formatters/cpp/libcxx.py
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/formatters/metrics.py
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/formatters/synth.py
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/lldb-argdumper
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/plugins/
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/plugins/__init__.py
|
||||
${MODPY_COMMENT}lib/python${MODPY_VERSION}/site-packages/lldb/plugins/${MODPY_PYCACHE}/
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/plugins/${MODPY_PYCACHE}__init__.${MODPY_PYC_MAGIC_TAG}pyc
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/plugins/${MODPY_PYCACHE}scripted_process.${MODPY_PYC_MAGIC_TAG}pyc
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/plugins/scripted_process.py
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/utils/
|
||||
lib/python${MODPY_VERSION}/site-packages/lldb/utils/__init__.py
|
||||
${MODPY_COMMENT}lib/python${MODPY_VERSION}/site-packages/lldb/utils/${MODPY_PYCACHE}/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
# $OpenBSD: clang.port.mk,v 1.36 2021/05/13 23:54:25 jca Exp $
|
||||
# $OpenBSD: clang.port.mk,v 1.37 2022/01/03 21:33:52 jca Exp $
|
||||
|
||||
MODCLANG_VERSION= 11.1.0
|
||||
MODCLANG_VERSION= 13.0.0
|
||||
|
||||
MODCLANG_ARCHS ?= ${LLVM_ARCHS}
|
||||
MODCLANG_LANGS ?=
|
||||
|
Loading…
Reference in New Issue
Block a user