Commit Graph

2065 Commits

Author SHA1 Message Date
Matthias Krüger
6c4502d97d Rollup merge of #143660 - cuviper:lib-doc-false, r=tgross35
Disable docs for `compiler-builtins` and `sysroot`

Bootstrap already had a manual doc filter for the `sysroot` crate, but
other library crates keep themselves out of the public docs by setting
`[lib] doc = false` in their manifest. This seems like a better solution
to hide `compiler-builtins` docs, and removes the `sysroot` hack too.

Fixes rust-lang/rust#143215 (after backport)
```@rustbot``` label beta-nominated
2025-07-10 20:28:50 +02:00
Josh Stone
87e7539fcd Disable docs for compiler-builtins and sysroot
Bootstrap already had a manual doc filter for the `sysroot` crate, but
other library crates keep themselves out of the public docs by setting
`[lib] doc = false` in their manifest. This seems like a better solution
to hide `compiler-builtins` docs, and removes the `sysroot` hack too.
2025-07-08 16:59:44 -07:00
Trevor Gross
016bc61312 Test building custom targets and resolve an issue probing rustc
The `rustc` probe done in our build scripts needs to pass `--target` to
get the correct configuration, which usually comes from the `TARGET`
environment variable. However, for targets specified via a `target.json`
file, `TARGET` gets set to the file name without an extension or path.
`rustc` will check a search path to attempt to locate the file, but this
is likely to fail since the directory where Cargo invokes build scripts
(and hence where those scripts invoke `rustc`) might not have any
relation to the JSON spec file.

Resolve this for now by leaving `f16` and `f128` disabled if the `rustc`
command fails. Result of the discussion at CARGO-14208 may eventually
provide a better solution.

A CI test is also added since custom JSON files are an edge case that
could fail in other ways. I verified this fails without the fix here.
The JSON file is the output for `thumbv7em-none-eabi`, just renamed so
`rustc` doesn't identify it.
2025-07-04 21:09:56 -05:00
Trevor Gross
19ab6461fb Remove unused custom target JSON files
8521530f4938 ("Fix __divsi3 and __udivsi3 on thumbv6m targets") removed
tests that use these `thumb*-linux` target files in favor of tests that
use the `thumb*-none` targets, which are available via Rustup. The JSON
files haven't been used since then and are outdated, so remove them.
2025-07-04 19:30:31 -05:00
Trevor Gross
84060f608b symcheck: Improve diagnostics from spawned Cargo
Rather than printing the entire JSON dump, use the rendered version.
2025-07-04 18:18:31 -05:00
Trevor Gross
e164811f5d symcheck: Make target a positional argument
This makes it more obvious what we intend to check rather than looking
for `--target`.
2025-07-04 17:44:54 -05:00
Trevor Gross
6ae56f4e96 Remove the let_chains feature now that it is stable 2025-07-04 16:53:19 -05:00
Trevor Gross
be35d37d8b Use the compiler to determine whether or not to enable f16 and f128
Currently we whether or not to build and test `f16` and `f128` support
mostly based on the target triple. This isn't always accurate, however,
since support also varies by backend and the backend version.

Since recently, `rustc` is aware of this with the unstable config option
`target_has_reliable_{f16,f128}`, which better represents when the types
are actually expected to be available and usable. Switch our
compiler-builtins and libm configuration to use this by probing `rustc`
for the target's settings.

A few small `cfg` fixes are needed with this.
2025-07-02 01:18:54 -05:00
quaternic
6c4221818e libm: Improved integer utilities, implement shifts and bug fixes for i256 and u256
`i256` and `u256`
- operators now use the same overflow convention as primitives
- implement `<<` and `-` (previously just `>>` and `+`)
- implement `Ord` correctly (the previous `PartialOrd` was broken)
- correct `i256::SIGNED` to `true`

The `Int`-trait is extended with `trailing_zeros`, `carrying_add`, and
`borrowing_sub`.
2025-07-01 08:07:48 +00:00
Trevor Gross
a4d584e7a6 josh-sync: Replace #xxxx-style links in messages
Often our short summaries will pick up a Bors "Auto merge of #xxxx ...`
commit message. Replace these with something like `rust-lang/rust#1234`
to avoid broken links when going between repositories.
2025-06-30 09:01:21 -05:00
quaternic
76b9fbf5b2 apply suggestions for clippy::manual_is_multiple_of in libm-test 2025-06-29 05:03:12 -05:00
Folkert de Vries
962ff16101 Use asm_cfg in probestack
cc https://www.github.com/rust-lang/rust/issues/140364
2025-06-24 14:40:08 -04:00
Trevor Gross
9f4670fd2b symcheck: Add a wrapper around an archive
Rather than re-opening the archive file for each check, add a wrapper
that keeps the data in memory. Additionally, collect the `--target`
argument so it can be used within this crate.
2025-06-14 23:47:58 +00:00
Urgau
bcc96da3c3 Add minimal triagebot config
This PR adds a minimal `triagebot.toml` config to make contributions to
this repository respect upstream rust-lang/rust conventions and avoid
issues when syncing this subtree.
2025-06-14 22:43:17 +00:00
Folkert de Vries
a413cca7d3 use extern "custom" on naked functions with a custom calling convention 2025-06-14 18:17:23 +00:00
Folkert de Vries
3dc3017691 use is_multiple_of to check if an addr is aligned 2025-06-14 13:10:25 -04:00
Trevor Gross
7222fa6f34 Work around out-of-tree testing with a shim crate
Out-of-tree testing is broken with the most recent update from
rust-lang/rust because it makes `compiler-builtins` depend on `core` by
path, which isn't usually available. In order to enable testing outside
of rust-lang/rust, add a new crate `builtins-shim` that uses the same
source as `compiler-builtins` but drops the `core` dependency. This has
replaced `compiler-builtins` as the workspace member and entrypoint for
tests.
2025-06-14 06:56:18 +00:00
Trevor Gross
c1cd1ef5fc Merge ref 'd087f112b7d1:/library/compiler-builtins' from https://github.com/rust-lang/rust
Pull recent changes from rust-lang/rust via Josh.

Upstream ref: d087f112b7
Filtered ref: 2d43ce8ac022170e5383f7e5a188b55564b6566a
2025-06-14 06:56:04 +00:00
Trevor Gross
c629d857b0 Update the upstream Rust version
To prepare for merging from rust-lang/rust, set the version file to:

    d087f112b7 Auto merge of #134841 - estebank:serde-attr-4, r=wesleywiser
2025-06-14 04:25:55 +00:00
Trevor Gross
4b2b463eea Delete .release-plz.toml
The config file is not needed anymore since compiler-builtins is no
longer published. Removing it will resolve a CI failure.
2025-06-14 03:38:53 +00:00
Trevor Gross
19b47ae1f4 Mark compiler-builtins as publish = false
Now that this repository is a subtree, we have no need to continue
publishing `compiler-builtins`.
2025-06-13 18:15:18 +00:00
Trevor Gross
509b8f2291 Clean up and sort manifest keys
Use a consistent ordering for top-level manifest keys, and remove those
that are now redundant (`homapage` isn't supposed to be the same as
`repository`, and `documentation` automatically points to docs.rs now).
2025-06-13 17:35:21 +00:00
Trevor Gross
10ba25f7ce fmaximum,fminimum: Fix incorrect result and add tests
After adding tests, the current implementation for fminimum fails when
provided a negative zero and NaN as inputs:

    ---- math::fminimum_fmaximum_num::tests::fmaximum_num_spec_tests_f64 stdout ----

    thread 'math::fminimum_fmaximum_num::tests::fmaximum_num_spec_tests_f64' panicked at libm/src/math/fminimum_fmaximum_num.rs:240:13:
    fmaximum_num(-0x0p+0, NaN)
    l: NaN (0x7ff8000000000000)
    r: -0.0 (0x8000000000000000)

    ---- math::fminimum_fmaximum_num::tests::fmaximum_num_spec_tests_f32 stdout ----

    thread 'math::fminimum_fmaximum_num::tests::fmaximum_num_spec_tests_f32' panicked at libm/src/math/fminimum_fmaximum_num.rs:240:13:
    fmaximum_num(-0x0p+0, NaN)
    l: NaN (0x7fc00000)
    r: -0.0 (0x80000000)

Add more thorough spec tests for these functions and correct the
implementations.

Canonicalization is also moved to a trait method to centralize
documentation about what it does and doesn't do.
2025-06-13 15:36:58 +00:00
qinghon
013e06c5ff Eliminate build.rs-generated Aarch64 atomic macros (#951)
Replace `build.rs` Rust generation with macros, using the unstable
`${concat(...)}`.

Fixes: https://github.com/rust-lang/compiler-builtins/issues/947
2025-06-13 01:27:47 -04:00
Folkert de Vries
b030442eb6 indent the probestack inline assembly 2025-06-10 10:09:00 +02:00
Folkert de Vries
45d649e2ea merge the sgx/fortanix __rust_probestack into the general x86_64 one 2025-06-10 10:09:00 +02:00
Folkert de Vries
b6eb4f9c3a use #[naked] for __rust_probestack 2025-06-10 10:08:57 +02:00
Folkert de Vries
f3af86010b add a fixme to use extern_custom when available 2025-06-10 10:08:08 +02:00
Trevor Gross
b5fafd9816 ci: Fix a typo that was causing a command failure 2025-06-10 07:02:57 +00:00
Trevor Gross
3497619ec1 compiler-builtins: Remove unused lints.rust table
The unexpected configs are now unused or known to `rustc` in our CI.
2025-06-10 06:49:28 +00:00
Trevor Gross
fc71544932 compiler-builtins: Emit rustc-check-cfg earlier
The `build.rs` entrypoint returns early for some targets, so emscripten
and OpenBSD were not getting check-cfg set. Emit these earlier to avoid
the `unexpected_cfgs` lint.
2025-06-09 04:46:54 +00:00
Trevor Gross
f131c2fa47 compiler-builtins: Specify :r registers for usize
On the ILP32 `x86_64-unknown-linux-gnux32` target, `usize` is 32 bits so
there is a sub-register alignment warning. Specify the 64-bit `r`
registers, which matches the current default as well as the size of the
other operands in the routines.
2025-06-09 04:46:54 +00:00
Trevor Gross
58bef69b81 compiler-builtins: Resolve unsafe_op_in_unsafe_fn on Arm32 Android
There are a few places that violate this lint, which showed up in
rust-lang/rust CI (the relevent module is gated behind
`kernel_user_helpers` which is only set for `armv4t`, `armv5te`, and
`arm-linux-androideabi`; none of these are tested in compiler-builtins
CI). Add new `unsafe { /* ... */ }` blocks where needed to address this.

Some blocks should get a more thorough review of their preconditions, so
their safety comments are left as `FIXME`s.
2025-06-09 04:46:52 +00:00
Trevor Gross
f43bb2ac99 compiler-builtins: Fix a rustdoc::bare-urls error 2025-06-08 02:36:58 +00:00
Trevor Gross
cc3e57147e Use the in-tree compiler-builtins
Many of `std`'s dependency have a dependency on the crates.io
`compiler-builtins` when used with the feature
`rustc-std-workspace-core`. Use a Cargo patch to select the in-tree
version instead.

`compiler-builtins` is also added as a dependency of
`rustc-std-workspace-core` so these crates can remove their crates.io
dependency in the future.
2025-06-08 02:36:58 +00:00
Trevor Gross
ab453db3c4 panic-handler: Remove the no_core feature
This was introduced before `#[panic_handler]` was stable, but should no
longer be needed. Additionally, we only need it for
`builtins-test-intrinsics`, not as a dependency of `compiler-builtins`.
2025-06-04 21:27:00 +00:00
Trevor Gross
1599091459 Merge ref 'df8102fe5f24:/library/compiler-builtins' from https://github.com/rust-lang/rust
Pull recent changes from rust-lang/rust via Josh.

Upstream ref: df8102fe5f
Filtered ref: 3c30d8cb1ec24e0b8a88a5cedcf6b9bece0117d7
2025-06-04 18:10:09 +00:00
Trevor Gross
eb45e57afe Update the upstream Rust version
To prepare for merging from rust-lang/rust, set the version file to:

    df8102fe5f Auto merge of #142002 - onur-ozkan:follow-ups2, r=jieyouxu
2025-06-04 18:10:07 +00:00
Trevor Gross
3353a891e3 Add tooling for josh syncs
Create a crate that handles pulling from and pushing to rust-lang/rust.
This can be invoked with the following:

    $ cargo run -p josh-sync -- rustc-pull
    $ RUSTC_GIT=/path/to/rust/checkout cargo run -p josh-sync -- rustc-push <username>
2025-06-04 18:06:15 +00:00
Trevor Gross
f67ca0fe37 Add an empty rust-version file
This will be used by `josh` tooling.
2025-06-04 17:30:37 +00:00
Trevor Gross
e1e3cc24a2 Replace the musl submodule with a download script
The submodule was causing issues in rust-lang/rust, so eliminiate it
here. `build-musl` is also removed from `libm-test`'s default features
so the crate doesn't need to be built by default.
2025-06-04 17:20:43 +00:00
Trevor Gross
aff21f659f compiler-builtins: Eliminate symlinks
compiler-builtins has a symlink to the `libm` source directory so the
two crates can share files but still act as two separate crates. This
causes problems with some sysroot-related tooling, however, since
directory symlinks seem to not be supported.

The reason this was a symlink in the first place is that there isn't an
easy for Cargo to publish two crates that share source (building works
fine but publishing rejects `include`d files from parent directories, as
well as nested package roots). However, after the switch to a subtree,
we no longer need to publish compiler-builtins; this means that we can
eliminate the link and just use `#[path]`.

Similarly, the LICENSE file was symlinked so it could live in the
repository root but be included in the package. This is also removed as
it caused problems with the dist job (error from bootstrap's
`tarball.rs`, "generated a symlink in a tarball").

If we need to publish compiler-builtins again for any reason, it would
be easy to revert these changes in a preprocess step.
2025-06-02 23:59:11 +00:00
Trevor Gross
5778643174 libm-test: Fix unintentional skips in binop_common
`binop_common` emits a `SKIP` that is intended to apply only to
`copysign`, but is instead applying to all binary operators. Correct the
general case but leave the currently-failing `maximum_num` tests as a
FIXME, to be resolved separately in [1].

Also simplify skip logic and NaN checking, and add a few more `copysign`
checks.

[1]: https://github.com/rust-lang/compiler-builtins/pull/939
2025-06-02 22:47:15 +00:00
Trevor Gross
ba7cdb6814 ci: Refactor benchmark regression checks
iai-callgrind now correctly exits with error if regressions were found
[1], so we no longer need to check for regressions manually. Remove this
check and instead exit based on the exit status of the benchmark run.

[1] https://github.com/iai-callgrind/iai-callgrind/issues/337
2025-06-02 21:29:46 +00:00
Trevor Gross
e83ca86341 cleanup: Use x.biteq(y) rather than x.to_bits() == y.to_bits() 2025-06-02 16:10:49 +00:00
Trevor Gross
0a7e59265a Upgrade all dependencies to the latest available version
In particular, this includes a fix to `iai-callgrind` that will allow us
to simplify our benchmark runner.
2025-06-01 19:57:14 +00:00
Trevor Gross
c6df6a72d8 Fix new dead_code warnings from recent nightlies 2025-06-01 19:54:30 +00:00
github-actions[bot]
3c35505fe9 chore: release 2025-05-30 15:18:27 +00:00
Trevor Gross
4d325e8b2c ci: Allow for multiple icount benchmarks in the same run
We don't actually need this for now, but eventually it would be nice to
run icount benchmarks on multiple targets. Start tagging artifact names
with the architecture, and allow passing `--tag` to `ci-util.py` in
order to retrieve the correct one.
2025-05-29 21:58:21 +00:00
Trevor Gross
8edaa6e5c8 libm-test: Make extensive an attribute rather than a test type
Currently we run logspace tests for extensive tests, but there isn't any
reason we couldn't also run more kinds of tests more extensively (e.g.
more edge cases, combine edge cases with logspace for multi-input
functions, etc). As a first step toward making this possible, make
`extensive` a new field in `CheckCtx`, and rename `QuickSpaced` to
`Spaced`.
2025-05-29 21:06:44 +00:00