This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGfdce098b49cb: [Clang][ASan] Teach Clang to not emit ASan module destructors when compiling… (authored by delcypher).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96573/new/ https://reviews.llvm.org/D96573 Files: clang/lib/Driver/SanitizerArgs.cpp clang/test/Driver/darwin-asan-mkernel-kext.c Index: clang/test/Driver/darwin-asan-mkernel-kext.c =================================================================== --- /dev/null +++ clang/test/Driver/darwin-asan-mkernel-kext.c @@ -0,0 +1,15 @@ +// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -mkernel -### \ +// RUN: %s 2>&1 | FileCheck %s +// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \ +// RUN: -### %s 2>&1 | FileCheck %s +// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \ +// RUN: -mkernel -### %s 2>&1 | FileCheck %s + +// CHECK: "-fsanitize-address-destructor-kind=none" + +// Check it's possible to override the driver's decision. +// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \ +// RUN: -mkernel -### -fsanitize-address-destructor-kind=global %s 2>&1 | \ +// RUN: FileCheck -check-prefix=CHECK-OVERRIDE %s + +// CHECK-OVERRIDE: "-fsanitize-address-destructor-kind=global" Index: clang/lib/Driver/SanitizerArgs.cpp =================================================================== --- clang/lib/Driver/SanitizerArgs.cpp +++ clang/lib/Driver/SanitizerArgs.cpp @@ -825,6 +825,12 @@ AsanInvalidPointerSub = true; } + if (TC.getTriple().isOSDarwin() && + (Args.hasArg(options::OPT_mkernel) || + Args.hasArg(options::OPT_fapple_kext))) { + AsanDtorKind = llvm::AsanDtorKind::None; + } + if (const auto *Arg = Args.getLastArg(options::OPT_sanitize_address_destructor_kind_EQ)) { auto parsedAsanDtorKind = AsanDtorKindFromString(Arg->getValue());
Index: clang/test/Driver/darwin-asan-mkernel-kext.c =================================================================== --- /dev/null +++ clang/test/Driver/darwin-asan-mkernel-kext.c @@ -0,0 +1,15 @@ +// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -mkernel -### \ +// RUN: %s 2>&1 | FileCheck %s +// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \ +// RUN: -### %s 2>&1 | FileCheck %s +// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \ +// RUN: -mkernel -### %s 2>&1 | FileCheck %s + +// CHECK: "-fsanitize-address-destructor-kind=none" + +// Check it's possible to override the driver's decision. +// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \ +// RUN: -mkernel -### -fsanitize-address-destructor-kind=global %s 2>&1 | \ +// RUN: FileCheck -check-prefix=CHECK-OVERRIDE %s + +// CHECK-OVERRIDE: "-fsanitize-address-destructor-kind=global" Index: clang/lib/Driver/SanitizerArgs.cpp =================================================================== --- clang/lib/Driver/SanitizerArgs.cpp +++ clang/lib/Driver/SanitizerArgs.cpp @@ -825,6 +825,12 @@ AsanInvalidPointerSub = true; } + if (TC.getTriple().isOSDarwin() && + (Args.hasArg(options::OPT_mkernel) || + Args.hasArg(options::OPT_fapple_kext))) { + AsanDtorKind = llvm::AsanDtorKind::None; + } + if (const auto *Arg = Args.getLastArg(options::OPT_sanitize_address_destructor_kind_EQ)) { auto parsedAsanDtorKind = AsanDtorKindFromString(Arg->getValue());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits