summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2017-06-06 09:40:24 +0000
committerjsg <jsg@openbsd.org>2017-06-06 09:40:24 +0000
commit7b4a6572144bf7b3a2d98f06f0d85f1eb74d6bc8 (patch)
treec51267c1f09bae079b691195e94ca99c1f34f4c2 /gnu/llvm/tools/clang/lib/Driver/Tools.cpp
parentFix compression output stats broken in rev 1.201. Patch originally by (diff)
downloadwireguard-openbsd-7b4a6572144bf7b3a2d98f06f0d85f1eb74d6bc8.tar.xz
wireguard-openbsd-7b4a6572144bf7b3a2d98f06f0d85f1eb74d6bc8.zip
Enable -fwrapv by default with clang to treat signed integer overflows
as defined. This is done to prevent dangerous optimisations which could remove security critical overflow checks. Base gcc has -fno-strict-overflow by default, with clang this is identical to -fwrapv. Prompted by naddy@ discovering a hang with a clang compiled i386 kernel that was resolved with -fwrapv. ok kettenis@ pascal@
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Driver/Tools.cpp')
-rw-r--r--gnu/llvm/tools/clang/lib/Driver/Tools.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnu/llvm/tools/clang/lib/Driver/Tools.cpp b/gnu/llvm/tools/clang/lib/Driver/Tools.cpp
index bd736c822c9..5eeb81f3039 100644
--- a/gnu/llvm/tools/clang/lib/Driver/Tools.cpp
+++ b/gnu/llvm/tools/clang/lib/Driver/Tools.cpp
@@ -5466,7 +5466,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT_fno_strict_overflow)) {
if (A->getOption().matches(options::OPT_fno_strict_overflow))
CmdArgs.push_back("-fwrapv");
- }
+ } else if (getToolChain().getTriple().isOSOpenBSD())
+ CmdArgs.push_back("-fwrapv");
if (Arg *A = Args.getLastArg(options::OPT_freroll_loops,
options::OPT_fno_reroll_loops))