Skip to content
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

use "gcc" instead of "cc" on *-sun-solaris systems when linking #70068

Merged
merged 2 commits into from
Mar 27, 2020

Conversation

jclulow
Copy link
Contributor

@jclulow jclulow commented Mar 17, 2020

On illumos and Solaris systems, Rust will use GCC as the link editor.
Rust does this by invoking "cc", which on many (Linux and perhaps BSD)
systems is generally either GCC or a GCC-compatible front-end. On
historical Solaris systems, "cc" was often the Sun Studio compiler.
This history casts a long shadow, and as such, even most modern
illumos-based operating systems tend to install GCC as "gcc", without
also making it available as "cc".

We should invoke GCC as "gcc" on such systems to ensure we get the right
compiler driver.

On illumos and Solaris systems, Rust will use GCC as the link editor.
Rust does this by invoking "cc", which on many (Linux and perhaps BSD)
systems is generally either GCC or a GCC-compatible front-end.  On
historical Solaris systems, "cc" was often the Sun Studio compiler.
This history casts a long shadow, and as such, even most modern
illumos-based operating systems tend to install GCC as "gcc", without
also making it available as "cc".

We should invoke GCC as "gcc" on such systems to ensure we get the right
compiler driver.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cramertj (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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 17, 2020
@mati865
Copy link
Contributor

mati865 commented Mar 17, 2020

Wouldn't it be better to set proper linker name in the solaris spec files?

@jclulow
Copy link
Contributor Author

jclulow commented Mar 17, 2020

Wouldn't it be better to set proper linker name in the solaris spec files?

It seems, at first glance, that making a change there would affect the link editor program name any time Solaris is the target. That is, whether cross-building an x86_64-sun-solaris binary on a Linux system, or natively building one on an illumos host, we'd use gcc instead of cc. Conversely, if trying to cross-build a Linux binary, but on an illumos host, we would still incorrectly use cc.

What I'm trying to do here is, instead, to change the behaviour of a Rust toolchain built for and running on an illumos host, for any target (including Linux) where the linker flavour is GCC by default -- but without changing what a Linux toolchain will do today, even when targetting illumos, because that already works correctly.

I'm new to this part of the code, so please correct me if I'm mistaken!

@jclulow jclulow requested a review from cramertj March 20, 2020 21:49
@jclulow
Copy link
Contributor Author

jclulow commented Mar 25, 2020

Hi folks! I've added the comment and tried to explain why I think this change belongs here and not in the spec files. It's obviously a busy and stressful time right now, but I wanted to check in and make sure there isn't anything else I should be doing with this change.

Thank you all for looking thus far!

@cramertj
Copy link
Member

Thanks for the update! Sorry for the delay getting this in.

@bors r+

@bors
Copy link
Contributor

bors commented Mar 26, 2020

📌 Commit 1c191c3 has been approved by cramertj

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 26, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2020
Rollup of 4 pull requests

Successful merges:

 - rust-lang#65222 (Proposal: `fold_self` and `try_fold_self` for Iterators)
 - rust-lang#69887 (clean up E0404 explanation)
 - rust-lang#70068 (use "gcc" instead of "cc" on *-sun-solaris systems when linking)
 - rust-lang#70470 (Clean up E0463 explanation)

Failed merges:

r? @ghost
@bors bors merged commit 4d079a8 into rust-lang:master Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants