Skip to content

Tidy up beneath-std, support Windows-MSVC without libc #450

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented May 15, 2024

I've run into this because my other PR breaks these examples: rust-lang/rust#124050

(also the comment about crt0.o on these can't be right, because this was being built on Windows)

@saethlin saethlin marked this pull request as ready for review May 15, 2024 13:23
@bjorn3
Copy link
Member

bjorn3 commented May 15, 2024

On Unix a dependency on libc is still necessary for crt1.o. As is libunwind for any panic=unwind target (even when compiling with panic=abort, as libcore references it _Unwind_Resume from libunwind)

@saethlin
Copy link
Member Author

Ah! I'll improve the comments.

@saethlin saethlin force-pushed the remove-libc branch 2 times, most recently from c56312b to 74df978 Compare May 19, 2024 00:15
#![feature(panic_unwind)]
extern crate unwind;

// Pull in the system libc library for what crt0.o likely requires.
#[cfg(not(windows))]
Copy link
Member

Choose a reason for hiding this comment

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

I suspect windows-gnu still needs it, but I'm not entirely sure.

Copy link
Member

Choose a reason for hiding this comment

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

windows-gnu includes gnu libc via the compiler. The libc crate doesn't add anything, as far as I'm aware.

@saethlin saethlin changed the title Remove libc from beneath-std, it's not actually required anymore Tidy up beneath-std, support Windows-MSVC without libc May 25, 2024
with an `extern crate libc;` declaration as shown in the examples below.
with an `extern crate libc;` declaration as shown in the examples below. Note that
windows-msvc targets do not require a libc, and correspondingly there is no `libc`
crate in their sysroot. We not need the `extern crate libc;` below, and having it
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
crate in their sysroot. We not need the `extern crate libc;` below, and having it
crate in their sysroot. We do not need the `extern crate libc;` below, and having it

or something like that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, yeah your fix is correct.

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

@ehuss ehuss merged commit 0ebdaca into rust-lang:master Jun 5, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2024
Update nomicon

Updates the nomicon to pull in rust-lang/nomicon#450 to fix toolstate.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2024
Update nomicon

Updates the nomicon to pull in rust-lang/nomicon#450 to fix toolstate.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2024
Update nomicon

Updates the nomicon to pull in rust-lang/nomicon#450 to fix toolstate.
@saethlin saethlin deleted the remove-libc branch June 5, 2024 03:01
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants