-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Implement -Z function-sections=yes|no #78414
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
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
I implemented it as a flag because AFAIK that particular setting doesn't require libstd etc to be built the same thing, thus it is a bit unfortunate that it requires building a whole new target currently to change the value. Plus, it would make it easier to check on Windows if we can turn back |
a46eea0
to
b8934ee
Compare
@bors delegate=bjorn3 |
✌️ @bjorn3 can now approve this pull request |
@@ -904,6 +904,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, | |||
"force all crates to be `rustc_private` unstable (default: no)"), | |||
fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED], | |||
"set the optimization fuel quota for a crate"), | |||
function_sections: Option<bool> = (None, parse_opt_bool, [TRACKED], | |||
"whether each function should go in its own .text section"), |
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.
.text
is not exactly the most portable name (e.g. machO uses __text
AFAIR). I suggest dropping the .
or perhaps the whole .text
.
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.
That's a good point, I removed it.
This lets rustc users tweak whether all functions should be put in their own TEXT section, using whatever default value the target defines if the flag is missing.
b8934ee
to
0569422
Compare
@bors r=nagisa,bjorn3 |
📌 Commit 0569422 has been approved by |
Any chance I could get a |
Its the next PR in the bors queue. |
☀️ Test successful - checks-actions |
This lets rustc users tweak whether all functions should be put in their own TEXT section, using whatever default value the target defines if the flag is missing.
I'm having fun experimenting with musl libc and trying to implement the start symbol in Rust, that means avoiding code that requires relocations, and AFAIK putting everything in its own section makes the toolchain generate
GOTPCREL
relocations for symbols that could use plain old PC-relative addressing (at least onx86_64
) if they were all in the same section.