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

native lib: defer the duplicate check after relevant_lib check. #85554

Merged
merged 2 commits into from
May 23, 2021

Conversation

12101111
Copy link
Contributor

#84794 break code using conditional-compilation with #[link] attributes.

#[cfg(target_env = "musl")]
cfg_if::cfg_if! {
    if #[cfg(any(target_feature = "crt-static", feature = "llvm-libunwind"))] {
        #[link(name = "unwind", kind = "static", modifiers = "-bundle")]
        extern "C" {}
    } else {
        #[link(name = "unwind", cfg(feature = "system-llvm-libunwind"))]
        #[link(name = "gcc_s", cfg(not(feature = "system-llvm-libunwind")))]
        extern "C" {}
    }
}

@rust-highfive
Copy link
Collaborator

r? @varkor

(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 May 21, 2021
@petrochenkov
Copy link
Contributor

r? @petrochenkov

@rust-highfive rust-highfive assigned petrochenkov and unassigned varkor May 21, 2021
@petrochenkov
Copy link
Contributor

I don't know how I missed this, I remember specifically considering this case.
Looks like I've seen that we are already going through relevant_libs only in fn add_local_native_libraries, and didn't notice that it's not the case in fn add_upstream_native_libraries.

let name = match lib.name {
Some(l) => l,
None => continue,
};

// Skip if this library is the same as the last.
last = if (lib.kind, lib.name) == last { continue } else { (lib.kind, lib.name) };
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is not strictly necessary for the fix, but let's leave it for consistency.
It also improves deduplication in the (unlikely) case of #[link(name = "foo")] #[link(wasm_import_module = "...")] #[link(name = "foo")].

@petrochenkov
Copy link
Contributor

Could you add a test for this?
Preferably a UI test with -Z print-link-args (possibly with // normalize-stdout-test), or something like src/test/run-make-fulldeps/link-args-order if the former doesn't work out.

@petrochenkov petrochenkov 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 May 21, 2021
@12101111
Copy link
Contributor Author

@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 May 22, 2021
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 23, 2021

📌 Commit 8e42fa5 has been approved by petrochenkov

@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 May 23, 2021
@bors
Copy link
Contributor

bors commented May 23, 2021

⌛ Testing commit 8e42fa5 with merge f64503e...

@bors
Copy link
Contributor

bors commented May 23, 2021

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing f64503e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 23, 2021
@bors bors merged commit f64503e into rust-lang:master May 23, 2021
@rustbot rustbot added this to the 1.54.0 milestone May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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