summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormortimer <mortimer@openbsd.org>2019-08-01 01:09:09 +0000
committermortimer <mortimer@openbsd.org>2019-08-01 01:09:09 +0000
commitac01d30ce880eeb475479bed69a1fa12c43f3cfd (patch)
tree607bf9c2402f84bcd1853ecd25e3cdc0b28e343c
parentWhen walking a leaf return the value itself instead of returning the (diff)
downloadwireguard-openbsd-ac01d30ce880eeb475479bed69a1fa12c43f3cfd.tar.xz
wireguard-openbsd-ac01d30ce880eeb475479bed69a1fa12c43f3cfd.zip
The GlobalISel IRTranslator pass assumes that it is safe to use the
LOAD_STACK_GUARD pseudo without consulting the value of useLoadStackGuardNode(), and then tries to add the return from getSDagStackGuard() as a parameter without consulting the return from getIRStackGuard() to see if it should do that. This means that the GlobalISel IRTranslator's implementation for Intrinsic::stackprotector is broken for platforms that implement getIRStackGuard() like we do, and this causes a segfault later when the incomplete LOAD_STACK_GUARD pseudo is lowered in the back end. Since GlobalISel is disabled on aarch64 most of the time anyway, add a bit that disables it for OpenBSD/aarch64 all the time. Fixes a crash when building on aarch64 without retguard, with a stack protector and without optimizations, which manifests when building cross-tools. ok patrick@ deraadt@
-rw-r--r--gnu/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnu/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp b/gnu/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
index 219c33ef73c..994130c66af 100644
--- a/gnu/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
+++ b/gnu/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
@@ -276,7 +276,8 @@ AArch64TargetMachine::AArch64TargetMachine(const Target &T, const Triple &TT,
}
// Enable GlobalISel at or below EnableGlobalISelAt0.
- if (getOptLevel() <= EnableGlobalISelAtO) {
+ if (getOptLevel() <= EnableGlobalISelAtO &&
+ !getTargetTriple().isOSOpenBSD()) {
setGlobalISel(true);
setGlobalISelAbort(GlobalISelAbortMode::Disable);
}