mirror of https://github.com/microsoft/clang.git
[Darwin] Enable -fstack-protector (back) by default with -ffreestanding
Go back to behavior prior to r289005. rdar://problem/32987198 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312595 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
76d5546427
commit
804ffcea63
|
@ -2302,11 +2302,6 @@ static void RenderSSPOptions(const ToolChain &TC, const ArgList &Args,
|
|||
else if (A->getOption().matches(options::OPT_fstack_protector_all))
|
||||
StackProtectorLevel = LangOptions::SSPReq;
|
||||
} else {
|
||||
// Only use a default stack protector on Darwin in case -ffreestanding is
|
||||
// not specified.
|
||||
if (EffectiveTriple.isOSDarwin() && !IsHosted)
|
||||
StackProtectorLevel = 0;
|
||||
else
|
||||
StackProtectorLevel = DefaultStackProtectorLevel;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,27 +36,20 @@
|
|||
// Test default stack protector values for Darwin platforms
|
||||
|
||||
// RUN: %clang -target armv7k-apple-watchos2.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_WATCHOS
|
||||
// RUN: %clang -ffreestanding -target armv7k-apple-watchos2.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_WATCHOS
|
||||
// SSP_WATCHOS: "-stack-protector" "1"
|
||||
// RUN: %clang -target arm64-apple-ios8.0.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_IOS
|
||||
// RUN: %clang -ffreestanding -target arm64-apple-ios8.0.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_IOS
|
||||
// SSP_IOS: "-stack-protector" "1"
|
||||
// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX
|
||||
// RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX
|
||||
// SSP_MACOSX: "-stack-protector" "1"
|
||||
// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.5 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_5
|
||||
// RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacosx-version-min=10.5 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_5
|
||||
// SSP_MACOSX_10_5: "-stack-protector" "1"
|
||||
// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.5 -mkernel -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_KERNEL
|
||||
// SSP_MACOSX_KERNEL-NOT: "-stack-protector"
|
||||
// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_6_KERNEL
|
||||
// RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_6_KERNEL
|
||||
// SSP_MACOSX_10_6_KERNEL: "-stack-protector" "1"
|
||||
|
||||
// Test default stack protector values for Darwin platforms with -ffreestanding
|
||||
|
||||
// RUN: %clang -ffreestanding -target armv7k-apple-watchos2.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_FREE_WATCHOS
|
||||
// SSP_FREE_WATCHOS-NOT: "-stack-protector"
|
||||
// RUN: %clang -ffreestanding -target arm64-apple-ios8.0.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_FREE_IOS
|
||||
// SSP_FREE_IOS-NOT: "-stack-protector"
|
||||
// RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_FREE_MACOSX
|
||||
// SSP_FREE_MACOSX-NOT: "-stack-protector"
|
||||
// RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacosx-version-min=10.5 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_FREE_MACOSX_10_5
|
||||
// SSP_FREE_MACOSX_10_5-NOT: "-stack-protector"
|
||||
// RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_FREE_MACOSX_10_6_KERNEL
|
||||
// SSP_FREE_MACOSX_10_6_KERNEL-NOT: "-stack-protector"
|
||||
|
|
Loading…
Reference in New Issue