From ce5c6091e04d27530a356b475ba18b2b45dba57d Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 22 May 2014 22:57:39 +0000 Subject: Don't reduce the stack protector level given -fstack-protector. Before -fstack-protector would always force a level of 1, even if the default was 2. Patch by Brad Smith. llvm-svn: 209479 --- clang/lib/Driver/Tools.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/lib/Driver/Tools.cpp') diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 3fe552db822..7670daa1713 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -3379,9 +3379,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fstack_protector_all, options::OPT_fstack_protector_strong, options::OPT_fstack_protector)) { - if (A->getOption().matches(options::OPT_fstack_protector)) - StackProtectorLevel = LangOptions::SSPOn; - else if (A->getOption().matches(options::OPT_fstack_protector_strong)) + if (A->getOption().matches(options::OPT_fstack_protector)) { + StackProtectorLevel = std::max(LangOptions::SSPOn, + getToolChain().GetDefaultStackProtectorLevel(KernelOrKext)); + } else if (A->getOption().matches(options::OPT_fstack_protector_strong)) StackProtectorLevel = LangOptions::SSPStrong; else if (A->getOption().matches(options::OPT_fstack_protector_all)) StackProtectorLevel = LangOptions::SSPReq; -- cgit v1.2.3