newlib: Fix ambiguous glob exports and other warnings for Vita and 3DS #4875
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is actually a followup of #4811. It turns out that it accidentally introduced an ambiguous glob export for
_SC_PAGESIZEand_SC_GETPW_R_SIZE_MAX. After updating newlib, rustc is fails to compile for these targets as it can't resolve_SC_PAGESIZEhere: https://github.com/rust-lang/rust/blob/5325015e29874334003d33d77b295d57f593f06a/library/std/src/sys/pal/unix/os.rs#L530-L532While checking, I realized there were also other warnings, for many newlib structures that ended up being unused, which I fixed:
hostentdefinitions:src/unix/mod.rs: The only actually resolved by rustc, and the most similar to newlib since at least 2017
src/unix/newlib/mod.rs: This one has been there since the start of the newlib module, which matched the 3DS upstream definition at the time. Since then, Revise network definitions for HorizonOS #3863 arrived removing the 3DS (horizon) from that definition as the upstream header had been updated.
src/unix/newlib/horizon/mod.rs: This one is the new correct definition for horizon, which was deliberately added in Revise network definitions for HorizonOS #3863 but is not being used as it's shadowed by
1.. I updated1.so this definition will now be used.pollfdThe definition in src/unix/mod.rs is the one being used and it matches with upstream newlib and the vita.
The definition in src/unix/newlib/mod.rs was unused but it matches with the 3ds headers, so I moved it into horizon and opted it out from the above.
unix::newlib::generic::{sigset_t, stat, dirent}All unused as they were shadowed by
vita's own definitions. Same goes forhorizonexcept fordirent.Sources
Checklist
libc-test/semverhave been updated*LASTor*MAXareincluded (see #3131)
cd libc-test && cargo test --target mytarget);especially relevant for platforms that may not be checked in CI
Checked locally using
cargo +nightly check --target {target} -Z build-std=corefor:armv7-sony-vita-newlibeabihf: No warningsarmv6k-nintendo-3ds: No warningsarmv7-rtems-eabihf: Only an unused import warning onsrc/new/mod.rs:pub(crate) use rtems::*;@rustbot label +stable-nominated