Repository navigation
Add Vega OS target (Tier 3) - #165525
Add Vega OS target (Tier 3)#165525aliiupeng wants to merge 1 commit into
Conversation
|
This PR modifies If appropriate, please update These commits modify compiler targets. |
|
Error: Failed to set assignee to
Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip. |
|
r? compiler_leads |
95d7439 to
5c2020c
Compare
There was a problem hiding this comment.
FWIW, I've helped review this a bit, and so has @Mark-Simulacrum, but clearly I am not on compiler team, and we have conflict of interest.
5c2020c to
90052b5
Compare
Adds 3 Vega OS targets: aarch64-vega-linux-gnu, armv7-vega-linux-gnueabihf and x86_64-vega-linux-gnu. They are essentially the *-unknown-linux-gnu* targets with target_vendor = vega, the in-tree LLVM libunwind by default (Vega OS has no libgcc_s), and a Cortex-A7/NEON baseline on armv7. Vega OS is Linux-based OS developed by Amazon.
90052b5 to
3324a7b
Compare
|
☔ The latest upstream changes (presumably #165844) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
Adds 3 Vega OS targets: aarch64-vega-linux-gnu, armv7-vega-linux-gnueabihf and x86_64-vega-linux-gnu. They are essentially the -unknown-linux-gnu targets with target_vendor = vega, the in-tree LLVM libunwind by default (Vega OS has no libgcc_s), and a Cortex-A7/NEON baseline on armv7.
Vega OS is Linux-based OS developed by Amazon which is used on Fire TV, Echo and other Amazon devices.
https://developer.amazon.com/docs/vega/vega
Thousands of 3rd party vega developers build Vega apps with the public Vega SDK, and the SDK will ship Rust support built on these targets.
How they differ from
*-unknown-linux-gnu*target_osandtarget_envunchanged as"linux"and"gnu". But we changed thetarget_vendorto"vega".libgcc_sfor apps,stdlinks LLVM libunwind statically instead. bootstrap defaultsllvm-libunwindto in-tree for these targes, like Fuchsia and Hexagon Linux. When std is build without itsllvm-libunwind(for example with-Zbuild-std),library/unwindlinks the Vega sysroot'slibunwind.astatically, similar to Hexagon and OHOS. It is static on purpose becausesystem-llvm-libunwindwould link the shared library, which apps can't use.Why separate targets
cfg(target_vendor = "vega")in any buildstdlinks is fixed whenstdis compiled, by target. The*-unknown-linux-gnustdlinkslibgcc_s.so.1, which Vega doesn't provide to apps: the SDK sysroot has nolibgcc_s, and the OS doesn't export it to apps. So the upstream*-unknown-linux-gnustdcan't be used for Vega apps. Today the Vega SDK has to rebuildstditself withllvm-libunwind, plus emptylibgcclink stubs. With a Vega target,stdpicks LLVM libunwind automatically (bootstrap,-Zbuild-std, and a future rustup-shippedstd), with no unstable flags. Otherwise it needs nightly-only-Zbuild-std-features=llvm-libunwindor a customstd. Precedent: OHOS and Hexagon Linux also differ from their base in which unwinderstdlinks.x86_64-unknown-linux-gnuis both the host and the target, so Cargo applies the Vega link setttings to build scripts and proc marcros too. A different name avoids this.*-oe-linux-gnutargets default to the OpenEmbedded GCC driver andlibgcc_s, so they don't fit. Also it keeps unknowntarget_vendorand use the generic armv7 baseline.Testing
./x build --stage 1 librarysucceeds for all three targets, using clang 19 and a Vega sysroot.Dropintocatch_unwindand spawns a threadruns correctly on x86_64 through the sysroot's loader, and on aarch64 and armv7 under
qemu-user with the Vega sysroot. It depends only on
libc.so.6and the dynamic loader.cccrate builds on all three targets.LLM disclosure
I wrote the doc and proposal, and used LLM to validate and reviewed them for accuracy. The LLM write the commit message but I rewrote it later. The code is drafted by LLM and I reviewed and validated the changes.
r? compiler
Tier 3 target policy
@aliiupeng and @altrieu-amazon, both on the Vega SDK team at Amazon. Our manager has
approved maintaining these targets as an ongoing team responsibility: answering issues,
fixing build breaks and upstreaming fixes. If either of us moves on, the team will name a
replacement and update the list.
The names follow
<arch>-<vendor>-linux-<env>. Each one keeps the arch and env of thematching upstream target (
aarch64-unknown-linux-gnu,armv7-unknown-linux-gnueabihf,x86_64-unknown-linux-gnu) and changes only the vendor, likex86_64-unikraft-linux-musland
mips64-openwrt-linux-musl.The names use only letters, digits, dashes and underscores.
Everything added is under
MIT OR Apache-2.0, and the PR adds no dependencies.Building and linking for these targets needs only FOSS components: clang and lld, glibc,
and the LLVM runtimes (libunwind, libc++, compiler-rt). The Vega SDK is a free download and
a convenient way to get a matching clang and sysroot, but it is not required.
Understood. None of the maintainers is a member of an approving Rust team.
stdis fully supported. These are glibc Linux targets (target_os = "linux",target_env = "gnu"), so they use the samestdcode paths as*-unknown-linux-gnu*. The onlystd-side difference is the unwinder link inlibrary/unwind.src/doc/rustc/src/platform-support/vega-linux-gnu.mdcovers building the targets (with bootstrap orbuild-std), linking, running binaries (natively on x86_64 Linux, under qemu-user for aarch64 and armv7, on the Vega Virtual Device, or on Fire TV devices), and building C code.Understood.
The target specs are new files. Shared code changes in two places, and both apply only to Vega:
llvm-libunwinddefault, which matches only-vega-linux-target names;library/unwind/src/lib.rs, gated ontarget_vendor = "vega". The existinggcc_sandsystem-llvm-libunwindrules exclude Vega, so other Linux targets link exactly as before.target_vendor = "vega"adds a new value but changes no existing cfg: no std, core, compiler, bootstrap or libc code checkstarget_vendor = "unknown". The check-cfg UI test expectations are updated for the new vendor value.They use the upstream LLVM AArch64, ARM and X86 backends. The
targets-elfassembly test covers all three.This PR is drafted with help of LLM. I reviewed and validated it.