-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Prevent syntax error in LD linker version script #63965
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @zackmdavis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
for sym in self.info.exports[&crate_type].iter() { | ||
debug!(" {};", sym); | ||
writeln!(f, " {};", sym)?; | ||
writeln!(f, "{{")?; |
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.
It's probably fine but shouldn't there be a newline after {{
?
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 believe the writeln!
macro is already appending a newline after {{
, so the formatting should look the same as the original.
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.
You're absolutely right of course :)
Thanks for the PR, @loganwendholt! Looks good to me. @bors r+ rollup |
📌 Commit 42bd6fa has been approved by |
…michaelwoerister Prevent syntax error in LD linker version script As discussed in rust-lang#63925, there is an edge case in which an invalid LD version script is generated when building a `cdylib` with no exported symbols. This PR makes a slight modification to the LD version script generation by first checking to see if any symbols need to be exported. If not, the `global` section of the linker script is simply omitted, and the syntax error is averted.
Rollup of 11 pull requests Successful merges: - #63811 (Correctly suggest adding bounds to `impl Trait` argument) - #63933 (Resolve some small issues related to #63580) - #63938 (or-pattern: fix typo in error message) - #63945 (Recover `mut $pat` and other improvements) - #63958 (const_prop: only call error_to_const_error if we are actually showing something) - #63961 (Add Option<Span> to `require_lang_item`) - #63963 (remove the reference to __cxa_thread_atexit_impl) - #63965 (Prevent syntax error in LD linker version script) - #63968 (rustc_apfloat: make the crate #![no_std] explicitly.) - #63970 (Notify me (flip1995) when Clippy toolstate changes) - #63980 (add missing `#[repr(C)]` on the Slices union) Failed merges: - #63989 (Add Yaah to clippy toolstain notification list) r? @ghost
As discussed in #63925, there is an edge case in which an invalid LD version script is generated when building a
cdylib
with no exported symbols. This PR makes a slight modification to the LD version script generation by first checking to see if any symbols need to be exported. If not, theglobal
section of the linker script is simply omitted, and the syntax error is averted.