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

Implement raw-dylib support for windows-gnu #90782

Merged
merged 1 commit into from
Jan 19, 2022

Conversation

ricobbe
Copy link
Contributor

@ricobbe ricobbe commented Nov 10, 2021

Add support for #[link(kind = "raw-dylib")] on windows-gnu targets. Work around binutils's linker's inability to read import libraries produced by LLVM by calling out to the binutils dlltool utility to create an import library from a temporary .DEF file; this approach is effectively a slightly refined version of @mati865's earlier attempt at this strategy in PR #88801. (In particular, this attempt at this strategy adds support for #[link_ordinal(...)] as well.)

In support of #58713.

@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 10, 2021
@ricobbe
Copy link
Contributor Author

ricobbe commented Nov 10, 2021

@petrochenkov this may interest you

@rust-log-analyzer

This comment has been minimized.

@petrochenkov petrochenkov self-assigned this Nov 11, 2021
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 11, 2021
@joshtriplett
Copy link
Member

One nit in a comment, and also I do think we need better handling for errors writing files. But otherwise this looks good to me.

@michaelwoerister
Copy link
Member

@joshtriplett, did you review this closely enough to approve it? If not, I'll take a closer look tomorrow.

@ricobbe
Copy link
Contributor Author

ricobbe commented Nov 17, 2021

General note: I have seen @joshtriplett 's requests for modifications, and I'll look into those. It may be a while before I can get to that, unfortunately, as an unrelated high-priority project has come up at work that is consuming all my bandwidth at the moment. I have no intention of abandoning this PR, but I'm not sure how quickly I'll be able to respond.

@michaelwoerister michaelwoerister added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 18, 2021
@petrochenkov petrochenkov removed their assignment Nov 19, 2021
@ricobbe
Copy link
Contributor Author

ricobbe commented Nov 23, 2021

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 23, 2021
@mati865
Copy link
Contributor

mati865 commented Nov 24, 2021

cc @nagisa who left some unresolved comments in the original PR.

@joshtriplett
Copy link
Member

@michaelwoerister Closely enough to post a comment and feedback, but not closely enough to r+ it myself.

Copy link
Member

@michaelwoerister michaelwoerister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @ricobbe! This looks great. I appreciate the solid tests.

I left a few comments below.

compiler/rustc_codegen_llvm/src/back/archive.rs Outdated Show resolved Hide resolved
compiler/rustc_codegen_llvm/src/back/archive.rs Outdated Show resolved Hide resolved
compiler/rustc_codegen_llvm/src/back/archive.rs Outdated Show resolved Hide resolved
src/test/run-make/raw-dylib-stdcall-ordinal/output.txt Outdated Show resolved Hide resolved
compiler/rustc_codegen_llvm/src/back/archive.rs Outdated Show resolved Hide resolved
compiler/rustc_codegen_llvm/src/back/archive.rs Outdated Show resolved Hide resolved
@michaelwoerister michaelwoerister added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 29, 2021
@rust-log-analyzer

This comment has been minimized.

@ricobbe
Copy link
Contributor Author

ricobbe commented Dec 2, 2021

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 2, 2021
@ricobbe
Copy link
Contributor Author

ricobbe commented Dec 2, 2021

I went ahead and marked this "waiting on review" even though there's an unresolved comment; I'd like to hear feedback on my response before starting to work on that particular point.

@mati865
Copy link
Contributor

mati865 commented Dec 2, 2021

Once if works with dlltool.exe shipped in rust-mingw component (in other words there is no external mingw-w64 toolchain in the PATH) and @nagisa's comments from #88801 are addressed I think this would be good to go.

@ricobbe
Copy link
Contributor Author

ricobbe commented Jan 6, 2022

@michaelwoerister , @mati865 I'd particularly like to hear your feedback on the question I raised in a comment in rustc_codegen_llvm/src/back/archive.rs, line 453

@ricobbe
Copy link
Contributor Author

ricobbe commented Jan 11, 2022

Are there any other outstanding concerns with this PR? We'd really like to get it merged soon, if that's at all possible.

@michaelwoerister
Copy link
Member

Looks good to me now. I think it's better to merge it and then do the rustup testing. Trying to coax CI to produce the right binaries before merging seems like an unnecessary complication since this is all still behind a feature flag anyway.

@ricobbe, would you mind squashing the commits? The history has become a bit too messy to merge as is.

@mati865
Copy link
Contributor

mati865 commented Jan 12, 2022

I still doubt this will work without external mingw-w64 based toolchain in PATH but given the fact this is nightly feature I agree there is no need to block this PR.
Verifying (and likely fixing) that should block stabilisation though.

@michaelwoerister
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 13, 2022

📌 Commit 0cf7fd1 has been approved by michaelwoerister

@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 Jan 13, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 14, 2022
…woerister

Implement raw-dylib support for windows-gnu

Add support for `#[link(kind = "raw-dylib")]` on windows-gnu targets.  Work around binutils's linker's inability to read import libraries produced by LLVM by calling out to the binutils `dlltool` utility to create an import library from a temporary .DEF file; this approach is effectively a slightly refined version of `@mati865's` earlier attempt at this strategy in PR rust-lang#88801.  (In particular, this attempt at this strategy adds support for `#[link_ordinal(...)]` as well.)

In support of rust-lang#58713.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 14, 2022
…woerister

Implement raw-dylib support for windows-gnu

Add support for `#[link(kind = "raw-dylib")]` on windows-gnu targets.  Work around binutils's linker's inability to read import libraries produced by LLVM by calling out to the binutils `dlltool` utility to create an import library from a temporary .DEF file; this approach is effectively a slightly refined version of ``@mati865's`` earlier attempt at this strategy in PR rust-lang#88801.  (In particular, this attempt at this strategy adds support for `#[link_ordinal(...)]` as well.)

In support of rust-lang#58713.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 14, 2022
…woerister

Implement raw-dylib support for windows-gnu

Add support for `#[link(kind = "raw-dylib")]` on windows-gnu targets.  Work around binutils's linker's inability to read import libraries produced by LLVM by calling out to the binutils `dlltool` utility to create an import library from a temporary .DEF file; this approach is effectively a slightly refined version of ```@mati865's``` earlier attempt at this strategy in PR rust-lang#88801.  (In particular, this attempt at this strategy adds support for `#[link_ordinal(...)]` as well.)

In support of rust-lang#58713.
@ricobbe
Copy link
Contributor Author

ricobbe commented Jan 18, 2022

Just checking to make sure I understand the state of this PR: it's been approved, but there have been troubles getting a clean roll-up PR. Is that correct?

Also, just to confirm: no action is needed on my part at the moment, right?

@mati865
Copy link
Contributor

mati865 commented Jan 18, 2022

Correct, you can see it's position in the queue over https://bors.rust-lang.org/queue/rust
I think it should land by tomorrow if nothing goes bad.

@ricobbe
Copy link
Contributor Author

ricobbe commented Jan 18, 2022

Sounds good. Thanks for the confirmation!

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 18, 2022
…askrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#90782 (Implement raw-dylib support for windows-gnu)
 - rust-lang#91150 (Let qpath contain NtTy: `<$:ty as $:ty>::…`)
 - rust-lang#92425 (Improve SIMD casts)
 - rust-lang#92692 (Simplify and unify rustdoc sidebar styles)
 - rust-lang#92780 (Directly use ConstValue for single literals in blocks)
 - rust-lang#92924 (Delete pretty printer tracing)
 - rust-lang#93018 (Remove some unused `Ord` derives based on `Span`)
 - rust-lang#93026 (fix typo in `max` description for f32/f64)
 - rust-lang#93035 (Fix stdarch submodule pointing to commit outside tree)

Failed merges:

 - rust-lang#92861 (Rustdoc mobile: put out-of-band info on its own line)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dd621a4 into rust-lang:master Jan 19, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 19, 2022
@ricobbe ricobbe deleted the binutils-dlltool branch January 19, 2022 16:30
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 28, 2022
…dylib, r=michaelwoerister

Fix MinGW target detection in raw-dylib

LLVM target doesn't have to be the same as Rust target so relying on it is wrong.

It was one of concerns in rust-lang#88801 that was not fixed in rust-lang#90782.
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.