-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Enable xray support for Mac #140790
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
base: master
Are you sure you want to change the base?
Enable xray support for Mac #140790
Conversation
These commits modify compiler targets. |
This comment has been minimized.
This comment has been minimized.
Since this affects the Tier 1 @rustbot ping apple |
Hey Apple notification group! This issue or PR could use some Apple-specific (In case it's useful, here are some instructions for tackling these sorts of cc @BlackHoleFox @hkratz @inflation @madsmtm @nvzqz @shepmaster @thomcc |
@rustbot author (test nits) |
Reminder, once the PR becomes ready for a review, use |
Responded to your questions in #140790 (comment). |
I added tests for assembly output, which should be seen as supplementing the previous missing tests for xray. I also added flag stable test, but I still don't think it's necessary. I don't see any other flags have this test, I can only get this from https://github.com/rust-lang/rust/blob/1.87.0/tests/ui/bootstrap/rustc_bootstrap.rs#L36 . @rustbot ready |
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.
Thanks, just a nit on the platform support test
Sorry I shouldn't have said "platform stability", I should've said "platform support". @rustbot author |
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.
As someone with very little experience with XRay, I tried to test this end-to-end:
$ ./x build --set=build.sanitizers=true
$ echo "fn main() {}" > main.rs
$ rustc +stage1 -Zinstrument-xray=always main.rs
$ objdump -h -j xray_instr_map main # Works
$ XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic verbosity=1" ./main # No-op?
But it doesn't seem to do anything? Probably because I'm not linking the runtime, but it's not clear to me how I'd go about doing that? Does bootstrap
need to build it?
@madsmtm As with linux, you need to link to Anyway I don't really care about that, because I'll be using my own rt, like uftrace. So just rustc generate the correct nop sled and |
Could you add that as a remark on the unstable docs for this flag? I imagine Mads won't be the only person asking that question. |
@jieyouxu I think it is already mentioned in unstable book. https://github.com/rust-lang/rust/blob/1.87.0/src/doc/unstable-book/src/compiler-flags/instrument-xray.md?plain=1#L35 |
This comment has been minimized.
This comment has been minimized.
@rustbot ready |
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.
Thanks
@bors r+ rollup |
Enable xray support for Mac rust-lang#102921 Upstream has supported Mac for a while, let's enable it. I've tested it on M4 and it generates nop sled correctly. * https://maskray.me/blog/2023-06-18-port-llvm-xray-to-apple-systems * https://github.com/llvm/llvm-project/blob/llvmorg-20.1.4/clang/lib/Driver/XRayArgs.cpp#L31
Rollup of 8 pull requests Successful merges: - #140790 (Enable xray support for Mac) - #141405 (GetUserProfileDirectoryW is now documented to always store the size) - #141413 (Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRING) - #141427 (Disable `triagebot`'s `glacier` handler) - #141429 (Dont walk into unsafe binders when emiting error for non-structural type match) - #141438 (Do not try to confirm non-dyn compatible method) - #141444 (Improve CONTRIBUTING.md grammar and clarity) - #141446 (Add 2nd Solaris target maintainer) r? `@ghost` `@rustbot` modify labels: rollup
#102921
Upstream has supported Mac for a while, let's enable it.
I've tested it on M4 and it generates nop sled correctly.