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

Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd. #113356

Merged
merged 1 commit into from
Jul 5, 2023

Conversation

he32
Copy link
Contributor

@he32 he32 commented Jul 5, 2023

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Jul 5, 2023

r? @oli-obk

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. labels Jul 5, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jul 5, 2023

These commits modify compiler targets.
(See the Target Tier Policy.)

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

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

src/doc/rustc/src/platform-support.md Outdated Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

@he32
Copy link
Contributor Author

he32 commented Jul 5, 2023

As for the tier 3 target policy:

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.)

I beleive that is clear as submitted in the platform-support/netbsd.md file.

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.

I beleive this is the case in this instance; the naming is consistent with other uses.

    Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility.

I can't see that these changes introduce confusion or ambiguity.

    If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo.

Check.

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.

I don't think this is an issue here, only open source tools are used to build the target.

    The target must not introduce license incompatibilities.

I beleive the changes do not introduce any such incompatibilities.

    Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

Understood.

    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.

There are no new dependencies introduced here.

    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.

As stated above, the build only depends on open-source tools.

    "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

There are no such terms present.

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.

This does not apply to me as a submitter if I understand correctly.

    This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

I don't think this applies to me...

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 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.

The general NetBSD rust information contains information about how to cross-build for this target.

At present testing has been minimal, but sufficient to complete the build of the cbindgen program, using the cross-compiled toolchain as a rust-bin package.
I have not yet attempted to run the rust self-tests for this target.

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.

    Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

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.

I do not think this breaks any other targets.

    In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

I do not think this change introduces any such problems.

src/bootstrap/llvm.rs Outdated Show resolved Hide resolved
@oli-obk
Copy link
Contributor

oli-obk commented Jul 5, 2023

Thank you. This looks ready, after running rustfmt, please squash your commits into the first one

@he32
Copy link
Contributor Author

he32 commented Jul 5, 2023

Thank you. This looks ready, after running rustfmt, please squash your commits into the first one

I'm sorry, my newbie-ness comes through here... I think I managed to squash the commits on the branch in my checked-out copy, but getting that pushed to github looks difficult; it just says "Everything up-to-date". Don't you have the ability to squash&merge at your end?

And ... rustfmt spits out two complaints that "unstable features are only available in nightly channel", and appears to refuse to do anything, referring to "can't set version = Two" and "can't set ignore = IgnoreList { ... }", although both of them appear to only be warnings(?) Sorry, I'm confused.

@oli-obk
Copy link
Contributor

oli-obk commented Jul 5, 2023

The way we run rustfmt is via the x.py script. So you'll need to run ./x.py fmt, not cargo fmt.

I'm not sure what your local state is, but you can use git rebase -i upstream/master (replace upstream with whatever git remove -v returns as the name for the rust-lang/rust repo, not your own repo). This will open an editor with a list of commits and a bunch of semi-useful instructions. You can replace all the pick (except your first commit's) with fixup and close the editor. Then you can push your branch with git push --force-with-lease

@he32 he32 force-pushed the netbsd-riscv64 branch from ae57f88 to 6cc37bb Compare July 5, 2023 13:49
@he32
Copy link
Contributor Author

he32 commented Jul 5, 2023

The way we run rustfmt is via the x.py script. So you'll need to run ./x.py fmt, not cargo fmt.

I'm not sure what your local state is, but you can use git rebase -i upstream/master (replace upstream with whatever git remove -v returns as the name for the rust-lang/rust repo, not your own repo). This will open an editor with a list of commits and a bunch of semi-useful instructions. You can replace all the pick (except your first commit's) with fixup and close the editor. Then you can push your branch with git push --force-with-lease

I think I managed to figure out the steps to do to push the squash of the 4 commits, the key was "git push --force", instead of first doing "git pull -r" which the message from "git push" mislead me to think should be done.

@oli-obk
Copy link
Contributor

oli-obk commented Jul 5, 2023

Great!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 5, 2023

📌 Commit 6cc37bb has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 5, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 5, 2023
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#113010 (rust-installer & rls: remove exclusion from rustfmt & tidy )
 - rust-lang#113317 ( -Ztrait-solver=next: stop depending on old solver)
 - rust-lang#113319 (`TypeParameterDefinition` always require a `DefId`)
 - rust-lang#113320 (Add some extra information to opaque type cycle errors)
 - rust-lang#113321 (Move `ty::ConstKind` to `rustc_type_ir`)
 - rust-lang#113337 (Winnow specialized impls during selection in new solver)
 - rust-lang#113355 (Move most coverage code out of `rustc_codegen_ssa`)
 - rust-lang#113356 (Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 560136f into rust-lang:master Jul 5, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants