Skip to content

Commit 216dbd9

Browse files
author
Francis Visoiu Mistrih
committed
[Driver] Disable -fsanitize=function for all MachO (except x86)
Some embedded platforms don't fall into the Darwin category.
1 parent 90dc75c commit 216dbd9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
570570

571571
Kinds |= Default;
572572

573-
if (TC.getTriple().isOSDarwin() && !TC.getTriple().isX86())
573+
if (TC.getTriple().isOSBinFormatMachO() && !TC.getTriple().isX86())
574574
Kinds &= ~SanitizerKind::Function;
575575

576576
// We disable the vptr sanitizer if it was enabled by group expansion but RTTI

clang/test/CodeGen/ubsan-function.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,GNU,64
44
// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,GNU,64
55
// RUN: %clang_cc1 -triple arm-none-eabi -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,ARM,GNU,32
6+
// RUN: %clang_cc1 -triple apple-macosx-x86_64 -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,64
7+
68

79
// GNU: define{{.*}} void @_Z3funv() #0 !func_sanitize ![[FUNCSAN:.*]] {
810
// MSVC: define{{.*}} void @"?fun@@YAXXZ"() #0 !func_sanitize ![[FUNCSAN:.*]] {

0 commit comments

Comments
 (0)