-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Sanitizers] Add new sanitize-stable-abi flag for libsanitizers. #69943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -317,8 +317,13 @@ toolchains::Darwin::addSanitizerArgs(ArgStringList &Arguments, | |
// Linking sanitizers will add rpaths, which might negatively interact when | ||
// other rpaths are involved, so we should make sure we add the rpaths after | ||
// all user-specified rpaths. | ||
if (context.OI.SelectedSanitizers & SanitizerKind::Address) | ||
addLinkSanitizerLibArgsForDarwin(context.Args, Arguments, "asan", *this); | ||
if (context.OI.SelectedSanitizers & SanitizerKind::Address) { | ||
if (context.OI.SanitizerUseStableABI) | ||
addLinkSanitizerLibArgsForDarwin(context.Args, Arguments, "asan_abi", | ||
*this, false); | ||
else | ||
addLinkSanitizerLibArgsForDarwin(context.Args, Arguments, "asan", *this); | ||
Comment on lines
+321
to
+325
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could use something like this to reduce diff/duplication. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an extra boolean argument in one of the cases, so this would require two ternary operators, so using an if feels cleaner here. |
||
} | ||
|
||
if (context.OI.SelectedSanitizers & SanitizerKind::Thread) | ||
addLinkSanitizerLibArgsForDarwin(context.Args, Arguments, "tsan", *this); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// REQUIRES: asan_runtime | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-stable-abi %s 2>&1 | %FileCheck %s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I read "-sanitize-stable-abi` as "sanitize stable ABI" it's not the right meaning. Compare "Sanitize address" which describes pretty well what it does. The variable names for this are I think the "sanitizer" prefix here is a noun vs. "sanitize" (verb). If we want to include a verb, we could spell the option with "use". I would pick one of these:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I matched the convention used in clang where we use |
||
|
||
// Link against stable ABI | ||
// CHECK: libclang_rt.asan_abi{{.*}}.a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the rpath still be added? If it's not necessary is it just a NOP or could it cause a problem?