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

--print=native-static-libs produces no output for #![no_std] staticlib #108825

Open
pnkfelix opened this issue Mar 6, 2023 · 4 comments
Open
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pnkfelix
Copy link
Member

pnkfelix commented Mar 6, 2023

(spawned off of #53281 (comment) )
I tried this code:

// compile-args: -Cpanic=abort --print=native-static-libs /tmp/hello.rs
#![crate_type="staticlib"]

#![no_std]

use core::panic::PanicInfo;
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
    loop { }
}

I expected to see this happen:

A line of output that includes the prefix:

note: Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.

note: native-static-libs: [...]

Instead, this happened:

No output.

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (7820b62d2 2023-03-05)
binary: rustc
commit-hash: 7820b62d20bc548096d4632a3487987308cb4b5d
commit-date: 2023-03-05
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7
@pnkfelix
Copy link
Member Author

pnkfelix commented Mar 6, 2023

  • I'm trying to figure out whether the lack of output in that scenario is by design.
  • One mindset about a staticlib crate is that it is a standalone deliverable, with no symbols that remain to be linked in.
  • However, I do not think our current staticlib output satisfies that criteria, and thus I suspect it still makes sense for a staticlib crate to support --print=native-static-libs.

@pnkfelix
Copy link
Member Author

pnkfelix commented Mar 7, 2023

Oh, I think this will actually get fixed by PR #106560

@bjorn3
Copy link
Member

bjorn3 commented Mar 7, 2023

Yeah, I removed the if !all_native_libs.is_empty() condition in #106560.

@pnkfelix pnkfelix added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Mar 7, 2023
@bjorn3
Copy link
Member

bjorn3 commented Jul 13, 2023

Looks like there is still the if !lib_args.is_empty() condition.

@bjorn3 bjorn3 removed the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jul 13, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 13, 2024
Always emit `native-static-libs` note, even if it is empty

Fixes rust-lang#108825.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 13, 2024
Always emit `native-static-libs` note, even if it is empty

Fixes rust-lang#108825.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 13, 2024
Always emit `native-static-libs` note, even if it is empty

Fixes rust-lang#108825.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 13, 2024
Always emit `native-static-libs` note, even if it is empty

Fixes rust-lang#108825.
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Jun 13, 2024
Always emit `native-static-libs` note, even if it is empty

Fixes rust-lang#108825.
@Enselic Enselic added A-linkage Area: linking into static, shared libraries and binaries T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage-legacy labels Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants