Automatically add --no-rosegment flag#456
Open
itsjunetime wants to merge 5 commits into
Open
Conversation
Author
|
Hmm, yeah I made some changes to CI and I guess I didn't understand how to use the rust-toolchain action correctly. Gotta poke around to fix it. |
djc
reviewed
Jun 29, 2026
djc
left a comment
Contributor
There was a problem hiding this comment.
This seems to add a lot of specifically targeted complexity that I don't really feel confident reviewing, to the point that I'm not sure it's a good fit for the flamegraph tooling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I regularly run my projects with various different profiles and configurations, and regularly forget to include the
--no-rosegmentflag when I try to run perf/flamegraph stuff. This causes some annoyance and confusion when I get the flamegraph and it doesn't show me any useful information, so I figured it would be nice to try to detect when it's needed and include it automatically.To do so, this PR:
RUSTFLAGSenv var and the target's rustflags settings withincargo/config.tomlusingcargo config get(on nightly; if the user doesn't have the nightly toolchain installed, it just silently doesn't check the flags from that source)a. If they're using
gold, which doesn't require this flag (according to the README)b. If they are explicitly using a linker which requires it
c. If they've already specified the
--no-rosegmentflagIf ((they're using rust >= 1.90 && not explicitly using gold) || using a linker that needs this flag) && not already specifying the no-rosegment flag, then we add it to the
RUSTFLAGSenv var for cargo compilation.I've also added some tests since this has some potentially finnicky parsing behavior, and adding configuration to CI to run those tests.