-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Enable ASan, TSan, UBSan for aarch64-apple-darwin. #79883
Changes from all commits
5940c19
7420776
d1911dd
01029e2
d517333
25bfa15
5ab1602
7ee606f
26cc060
d482de3
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 |
---|---|---|
|
@@ -356,15 +356,12 @@ fn copy_sanitizers( | |
let dst = libdir.join(&runtime.name); | ||
builder.copy(&runtime.path, &dst); | ||
|
||
if target == "x86_64-apple-darwin" { | ||
// Update the library install name reflect the fact it has been renamed. | ||
let status = Command::new("install_name_tool") | ||
.arg("-id") | ||
.arg(format!("@rpath/{}", runtime.name)) | ||
.arg(&dst) | ||
.status() | ||
.expect("failed to execute `install_name_tool`"); | ||
assert!(status.success()); | ||
if target == "x86_64-apple-darwin" || target == "aarch64-apple-darwin" { | ||
// Update the library’s install name to reflect that it has has been renamed. | ||
apple_darwin_update_library_name(&dst, &format!("@rpath/{}", &runtime.name)); | ||
// Upon renaming the install name, the code signature of the file will invalidate, | ||
// so we will sign it again. | ||
Comment on lines
+362
to
+363
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 don't follow this. Renaming other signed files doesn't cause problems; why does this? 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. Renaming the file with Searching for "install_name_tool invalidate signature" on Google returns other projects that have hit this. For example: https://community.intel.com/t5/Intel-oneAPI-Threading-Building/Mac-install-location-conflicts-with-code-signing/m-p/1008483/highlight/true#M12505 |
||
apple_darwin_sign_file(&dst); | ||
} | ||
|
||
target_deps.push(dst); | ||
|
@@ -373,6 +370,27 @@ fn copy_sanitizers( | |
target_deps | ||
} | ||
|
||
fn apple_darwin_update_library_name(library_path: &Path, new_name: &str) { | ||
let status = Command::new("install_name_tool") | ||
.arg("-id") | ||
.arg(new_name) | ||
.arg(library_path) | ||
.status() | ||
.expect("failed to execute `install_name_tool`"); | ||
assert!(status.success()); | ||
} | ||
|
||
fn apple_darwin_sign_file(file_path: &Path) { | ||
let status = Command::new("codesign") | ||
.arg("-f") // Force to rewrite the existing signature | ||
.arg("-s") | ||
.arg("-") | ||
.arg(file_path) | ||
.status() | ||
.expect("failed to execute `codesign`"); | ||
assert!(status.success()); | ||
} | ||
|
||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] | ||
pub struct StartupObjects { | ||
pub compiler: Compiler, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error: `-Zsanitizer=leak` only works with targets: aarch64-unknown-linux-gnu, x86_64-apple-darwin, x86_64-unknown-linux-gnu | ||
error: `-Zsanitizer=leak` only works with targets: aarch64-apple-darwin, aarch64-unknown-linux-gnu, x86_64-apple-darwin, x86_64-unknown-linux-gnu | ||
|
||
error: aborting due to previous error | ||
|
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.
Why not MSAN :-)
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.
I returned my new Macbook Air (need more memory and waiting for the new one to ship), so I can't easily confirm, but I recall there being an error message saying macOS is not supported by MSan, which is maybe why
x86_64-apple-darwin
is also not listed here. These docs also back up this claimThere 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.
I clearly have the reading comprehension of a goldfish, I totally missed that no macOS platforms were there.
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.
https://github.com/llvm/llvm-project/blob/62ec4ac90738a5f2d209ed28c822223e58aaaeb7/compiler-rt/cmake/config-ix.cmake#L696-L701