-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Rollup of 7 pull requests #148331
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
Closed
Closed
Rollup of 7 pull requests #148331
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Both gcc and llvm accept -fjump-tables as well as -fno-jump-tables. For consistency, allow rustc to accept -Zjump-tables=yes too.
Be more verbose about what this option can and cannot do.
Targets theoretically possible, but not provided yet: - 32-bit arm See also notes in the PR, I was unable to run anything non-trivial on ARM HelenOS, there are issues with the linker/loader, incomplete support of atomics, and overall a lot of confusion about the precise version of ARM architecture that the HelenOS builds target. - riscv, mips (These targets currently don't run HelenOS at all. HelenOS says it should work, but the builds are broken for quite some time now.)
Signed-off-by: tison <wander4096@gmail.com>
…wiser add first HelenOS compilation targets I'm working on adding a HelenOS compilation target for Rust as my bachelor thesis. I understood that the policy for tier 3 targets is quite liberal, so here's my attempt at upstreaming the initial support. I'm quite new to Rust internals, so thanks in advance for all assistance with my stupid questions :) libstd support is coming, but I understood compiler support must come first before libc bindings can get merged (rust-lang/libc#4355 (comment)) Locally, I also needed to update `cc-rs`, to do two things: - add [here](https://github.com/rust-lang/cc-rs/blob/59578addda0233c8e9a0b399769cedb538ac8052/src/lib.rs#L3397) the binutils prefixes (`x86_64-unknown-helenos` -> `amd64-helenos` - add the targets to `generated.rs` From the "Adding tier 3 target" guide it sound like the latter will happen automatically, the first I need to do manually? I'm not sure if the test suite will pass or fail without it. I'm also quite unsure about all the target spec configuration flags. I copied the specs from other small OSs with some tweaks and things seems to work now, but I have no idea how to better judge if it's correct. Finally, I'm also working on support for arm (32-bit and 64), but there I'm currently running into some issues with linking, so I'll send that later, if I figure it out. --- <details> <summary>Tier 3 policy "form"</summary> > A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.) That would be me, I suppose. I agree. > Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target. I'm using the standard Rust conventions. > Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users. > - The target must not introduce license incompatibilities. > - Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0). I am not aware of any legal issues. HelenOS itself is open-source under BSD license. All code contributed in this PR (and later for libstd) is either fully my own or an adaptation of existing code from this repo (some PAL pieces). > - The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements. I am not adding any new dependencies. > - Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3. The HelenOS build tools consist of open-source patches to GCC and binutils, so I suppose we're fine. > Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions. Understood. > Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions. The libstd PR will fully support core+alloc, and enough of std to run interesting programs (stdio, argv and fs) - so we can run tools like [imagecli](https://github.com/theotherphil/imagecli). But yes, major parts of std are missing - pipe, process and net are currently forwarded to `unsupported()`. Some barebones `net` should be possible, but e.g. cloning of the descriptor is unheard of in HelenOS, so it won't be as straightforward as the rest. Also, some places of the `fs` and `thread` module are also quite stubby (but part of it is just because HelenOS has no file permissions, for example). HelenOS is a small, experimental OS, so its own libc is stubbed out as well in some places. I hope this state is acceptable? > The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary. I hope the guide in doc is sufficient. > Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages. Understood. > Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target. Understood. > Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.) Umm, I think this is satisfied? Code generation works with the default LLVM backend, even though it has no idea about HelenOS. And our GCC patch is then used only for linking. </details>
…joboet smart pointer (try_)map Tracking issue: rust-lang#144419
…s, r=wesleywiser Stabilize -Zno-jump-tables into -Cjump-tables=bool I propose stabilizing the -Zno-jump-tables option into -Cjump-tables=<bool>. # `-Zno-jump-tables` stabilization report ## What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized? No RFC was created for this option. This was a narrowly scoped option introduced in rust-lang#105812 to support code generation requirements of the x86-64 linux kernel, and eventually other targets as Rust For Linux grows. The tracking is rust-lang#116592. ## What behavior are we committing to that has been controversial? Summarize the major arguments pro/con. The behavior of this flag is well defined, and mimics the existing `-fno-jump-tables` option currently available with LLVM and GCC with some caveats: * Unlike clang or gcc, this option may be ignored by the code generation backend. Rust can support multiple code-generation backends. For stabilization, only the LLVM backend honors this option. * The usage of this option will not guarantee a library or binary is free of jump tables. To ensure a jump-table free binary, all crates in the build graph must be compiled with this option. This includes implicitly linked crates such as std or core. * This option only enforces the crate being compiled is free of jump tables. * No verification is done to ensure other crates are compiled with this option. Enforcing code generation options are applied across the crate graph is out of scope for this option. What should the flag name be? * As introduced, this option was named `-Zno-jump-tables`. However, other major toolchains allow both positive and negative variants of this option to toggle this feature. Renaming the option to `-Cjump-tables=<bool>` makes this option consistent, and if for some reason, expandable to other arguments in the future. Notably, many LLVM targets have a configurable and different thresholds for when to lower into a jump table. ## Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those. No. This option is used exclusively to gate a very specific class of optimization. ## Summarize the major parts of the implementation and provide links into the code (or to PRs) * The original PR rust-lang#105812 by `@ojeda` * The stabilized CLI option is parsed as a bool: https://github.com/pmur/rust/blob/68bfda9025ccb2778e2606e12e8021b9918f40d3/compiler/rustc_session/src/options.rs#L2025-L2026 * This options adds an attribute to each llvm function via: https://github.com/pmur/rust/blob/68bfda9025ccb2778e2606e12e8021b9918f40d3/compiler/rustc_codegen_llvm/src/attributes.rs#L210-L215 * Finally, the rustc book is updated with the new option: https://github.com/pmur/rust/blob/68bfda9025ccb2778e2606e12e8021b9918f40d3/src/doc/rustc/src/codegen-options/index.md?plain=1#L212-L223 ## Has a call-for-testing period been conducted? If so, what feedback was received? No. The option has originally created is being used by Rust For Linux to build the x86-64 kernel without issue. ## What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking? There are no outstanding issues. ## Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization * `@ojeda` implemented this feature in rust-lang#105815 as `-Zno-jump-tables`. * `@tgross35` created and maintained the tracking issue rust-lang#116592, and provided feedback about the naming of the cli option. ## What FIXMEs are still in the code for that feature and why is it ok to leave them there? There are none. ## What static checks are done that are needed to prevent undefined behavior? This option cannot cause undefined behavior. It is a boolean option with well defined behavior in both cases. ## In what way does this feature interact with the reference/specification, and are those edits prepared? This adds a new cli option to `rustc`. The documentation is updated, and the unstable documentation cleaned up in this PR. ## Does this feature introduce new expressions and can they produce temporaries? What are the lifetimes of those temporaries? No. ## What other unstable features may be exposed by this feature? None. ## What is tooling support like for this feature, w.r.t rustdoc, clippy, rust-analzyer, rustfmt, etc.? No support is required from other rust tooling. ## Open Items - [x] Are there objections renaming `-Zno-jump-tables` to `-Cjump-tables=<bool>`? The consensus is no. - [x] Is it desirable to keep `-Zno-jump-tables` for a period of time? The consensus is no. --- Closes rust-lang#116592
…thin, r=joboet implement VecDeque extend_from_within and prepend_from_within Tracking issue: rust-lang#146975
…oboet Implement VecDeque::extract_if This refers to rust-lang#147750.
…ocs, r=Amanieu docs: Fix argument names for `carrying_mul_add` Fixes rust-lang#148312
…ChrisDenton Enable file locking support in illumos rust-lang#132977 introduced an allow-list of targets supporting file locking, but forgot to add illumos to it (which introduced support for it in ~2015). `File::lock` and friends are now stable, and the ecosystem is slowly replacing custom libc calls with the standard library. Crucially, in 1.91 both Cargo and bootstrap switched to `File::lock`, both breaking build directory locking. This PR enables file locking on illumos. Fixes rust-lang#146312.
|
@bors r+ rollup=never p=5 |
bors
added a commit
that referenced
this pull request
Oct 31, 2025
Rollup of 7 pull requests Successful merges: - #139310 (add first HelenOS compilation targets) - #144420 (smart pointer (try_)map) - #145974 (Stabilize -Zno-jump-tables into -Cjump-tables=bool) - #147161 (implement VecDeque extend_from_within and prepend_from_within) - #147780 (Implement VecDeque::extract_if) - #148319 (docs: Fix argument names for `carrying_mul_add`) - #148322 (Enable file locking support in illumos) r? `@ghost` `@rustbot` modify labels: rollup
|
The job Click to see the possible cause of the failure (guessed by this bot)For more information how to resolve CI failures of this job, visit this link. |
|
💔 Test failed - checks-actions |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
rollup
A PR which is a rollup
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
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.
Successful merges:
carrying_mul_add#148319 (docs: Fix argument names forcarrying_mul_add)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup