about summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec
AgeCommit message (Collapse)AuthorLines
2025-03-14Rollup merge of #136892 - erickt:fuchsia-target, r=jieyouxuJacob Pratt-22/+45
Sync Fuchsia target spec with clang Fuchsia driver This updates the Fuchsia target spec with the [Clang Fuchsia driver], which picks up a few changes: * Adds `-z start-stop-visibility=hidden` and `-z rel` to the pre link arguments. * Adds `--execute-only` and `--fix-cortex-a53-843419` for `aarch64-unknown-fuchsia`. * Enables the equivalent cpu features for `x86-64-v2` for `x86_64-unknown-fuchsia`, which is our minimum supported x86_64 platform according to [RFC-0073]. try-job: x86_64-fuchsia [Clang Fuchsia driver]: https://github.com/llvm/llvm-project/blob/8374d421861cd3d47e21ae7889ba0b4c498e8d85/clang/lib/Driver/ToolChains/Fuchsia.cpp [RFC-0073]: https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0073_x86_64_platform_requirement
2025-03-12Fix uclibc LLVM target triplesMads Marquart-4/+4
`uclibc` is not an environment understood by LLVM, it is only a concept in Clang that can be selected with `-muclibc` (it affects which dynamic linker is passed to the static linker's `-dynamic-linker` flag). In fact, using `uclibcgnueabi`/`uclibc` is actively harmful, as it prevents LLVM from seeing that the target is gnu-like; we should use `gnueabi`/`gnu` directly instead.
2025-03-12Fix armv7-sony-vita-newlibeabihf LLVM target tripleMads Marquart-1/+1
It was previously normalized by LLVM to `thumbv7a-vita-unknown-eabihf`, which is probably wrong, as Vita is the OS.
2025-03-12Fix RISC-V VxWorks LLVM target triplesMads Marquart-2/+2
The targets used the plain `$ARCH` triple, which LLVM normalizes to `$ARCH-unknown-unknown`, which is inconsistent with the the other VxWorks targets which all use `$ARCH-unknown-linux-gnu$ABI`.
2025-03-10Target definition for `wasm32-wali-linux-musl` to support the Wasm LinuxArjun Ramesh-0/+190
Interface This commit does not patch libc, stdarch, or cc
2025-03-10Update metadata for cygwin target王宇逸-1/+1
2025-03-07Rollup merge of #137957 - Noratrieb:no, r=wesleywiserJacob Pratt-11/+9
Remove i586-pc-windows-msvc See [MCP 840](https://github.com/rust-lang/compiler-team/issues/840). I left a specialized error message that should help users that hit this in the wild (for example, because they use it in their CI). ``` error: Error loading target specification: the `i586-pc-windows-msvc` target has been removed. Use the `i686-pc-windows-msvc` target instead. Windows 10 (the minimum required OS version) requires a CPU baseline of at least i686 so you can safely switch. Run `rustc --print target-list` for a list of built-in targets ``` ``@workingjubilee`` ``@calebzulawski`` fyi portable-simd uses this target in CI, if you wanna remove it already before this happens
2025-03-05feat: Remove - from xtensa targets cpu namesSergio Gasquez-4/+4
Co-authored-by: MabezDev <scott@mabez.dev>
2025-03-04Auto merge of #135695 - Noratrieb:elf-raw-dylib, r=bjorn3bors-1/+54
Support raw-dylib link kind on ELF raw-dylib is a link kind that allows rustc to link against a library without having any library files present. This currently only exists on Windows. rustc will take all the symbols from raw-dylib link blocks and put them in an import library, where they can then be resolved by the linker. While import libraries don't exist on ELF, it would still be convenient to have this same functionality. Not having the libraries present at build-time can be convenient for several reasons, especially cross-compilation. With raw-dylib, code linking against a library can be cross-compiled without needing to have these libraries available on the build machine. If the libc crate makes use of this, it would allow cross-compilation without having any libc available on the build machine. This is not yet possible with this implementation, at least against libc's like glibc that use symbol versioning. The raw-dylib kind could be extended with support for symbol versioning in the future. This implementation is very experimental and I have not tested it very well. I have tested it for a toy example and the lz4-sys crate, where it was able to successfully link a binary despite not having a corresponding library at build-time. I was inspired by Björn's comments in https://internals.rust-lang.org/t/bundle-zig-cc-in-rustup-by-default/22096/27 Tracking issue: #135694 r? bjorn3 try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: test-various
2025-03-03Remove i586-pc-windows-msvcNoratrieb-11/+9
See MCP 840. I left a specialized error message that should help users that hit this in the wild (for example, because they use it in their CI).
2025-03-02rustc_target: Add msync target feature and enable it on powerpcspe targetsTaiki Endo-1/+2
2025-03-01Set target_vendor = "openwrt"Mads Marquart-0/+1
On mips64-openwrt-linux-musl target.
2025-02-26Support raw-dylib link kind on ELFNoratrieb-1/+54
raw-dylib is a link kind that allows rustc to link against a library without having any library files present. This currently only exists on Windows. rustc will take all the symbols from raw-dylib link blocks and put them in an import library, where they can then be resolved by the linker. While import libraries don't exist on ELF, it would still be convenient to have this same functionality. Not having the libraries present at build-time can be convenient for several reasons, especially cross-compilation. With raw-dylib, code linking against a library can be cross-compiled without needing to have these libraries available on the build machine. If the libc crate makes use of this, it would allow cross-compilation without having any libc available on the build machine. This is not yet possible with this implementation, at least against libc's like glibc that use symbol versioning. The raw-dylib kind could be extended with support for symbol versioning in the future. This implementation is very experimental and I have not tested it very well. I have tested it for a toy example and the lz4-sys crate, where it was able to successfully link a binary despite not having a corresponding library at build-time.
2025-02-25Rollup merge of #137370 - RalfJung:x86-abi-fallback, r=SparrowLiiLeón Orell Valerian Liehr-11/+26
adjust_abi: make fallback logic for ABIs a bit easier to read I feel like the match guards here make this unnecessarily harder to follow.
2025-02-23Rollup merge of #136637 - Pyr0de:binary-format, r=NoratriebTrevor Gross-10/+90
Add binary_format to rustc target specs Added binary format field to `TargetOptions` Fixes #135724 r? `@Noratrieb`
2025-02-21adjust_abi: make fallback logic for ABIs a bit easier to readRalf Jung-11/+26
2025-02-20Rollup merge of #137324 - flba-eb:rename_qnx_target_name_i586, r=workingjubileeJubilee-1/+1
Make x86 QNX target name consistent with other Rust targets Rename target to be consistent with other Rust targets: Use `i686` instead of `i586` See also - #136495 - #109173 CC: `@jonathanpallant` `@japaric` `@gh-tr` `@samkearney`
2025-02-20Rollup merge of #136473 - usamoi:infer_linker_hints, r=petrochenkovJubilee-8/+12
infer linker flavor by linker name if it's sufficiently specific Fix: `rustc` does not infer `llvm-bitcode-linker` uses `llbc` linker flavor if targeting `nvptx64-nvidia-cuda`.
2025-02-20Sync Fuchsia target spec with clang Fuchsia driverErick Tryzelaar-22/+45
This updates the Fuchsia target spec with the [Clang Fuchsia driver], which picks up a few changes: * Adds `-z start-stop-visibility=hidden` and `-z rel` to the pre link arguments. * Adds `--execute-only` and `--fix-cortex-a53-843419` for `aarch64-unknown-fuchsia`. * Enables the cpu features equivalent to x86-64-v2 for `x86_64-unknown-fuchsia`, which is our minimum supported x86_64. platform according to [RFC-0073]. * Enables the cpu features `+crc,+aes,+sha2,+neon` on aarch64. * Increases the max atomic width on 86_64 to 128. * Enables stack probes and xray on aarch64 and riscv64. [Clang Fuchsia driver]: https://github.com/llvm/llvm-project/blob/8374d421861cd3d47e21ae7889ba0b4c498e8d85/clang/lib/Driver/ToolChains/Fuchsia.cpp [RFC-0073]: https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0073_x86_64_platform_requirement
2025-02-20Make x86 QNX target name consistent with other Rust targetsFlorian Bartels-1/+1
2025-02-20infer linker flavor by linker name if it's sufficiently specificusamoi-8/+12
2025-02-19Create a generic AVR target: avr-nonePatryk Wychowaniec-49/+39
This commit removes the `avr-unknown-gnu-atmega328` target and replaces it with a more generic `avr-none` variant that must be specialized with the `-C target-cpu` flag (e.g. `-C target-cpu=atmega328p`).
2025-02-17Adds binary_format to rustc target specsPyrode-10/+90
2025-02-17Rollup merge of #137149 - Noratrieb:wtf-is-this-target, r=RalfJungMatthias Krüger-0/+1
Remove SSE ABI from i586-pc-windows-msvc As an i586 target, it should not have SSE. This caused the following warning to be emitted: ``` warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly | = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344> warning: 1 warning emitted ``` see #116344. r? RalfJung
2025-02-17Auto merge of #136953 - ken-matsui:import-target-metadata, r=workingjubileebors-568/+679
rustc_target: import TargetMetadata
2025-02-16rustc_target: import TargetMetadataKen Matsui-568/+679
2025-02-16Remove SSE ABI from i586-pc-windows-msvcNoratrieb-0/+1
As an i586 target, it should not have SSE. This caused the following warning to be emitted: ``` warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly | = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344> warning: 1 warning emitted ```
2025-02-16Rollup merge of #137072 - Urgau:check-cfg-load-builtins-at-once, r=NoratriebMatthias Krüger-0/+13
Load all builtin targets at once instead of one by one in check-cfg This PR adds a method on `rustc_target::Target` to load all the builtin targets at once, and then uses that method when constructing the `target_*` values in check-cfg instead of load loading each target one by one by their name, which requires a lookup and was more of a hack anyway. This may give us some performance improvements as we won't need to do the lookup for the _currently_ 287 targets we have.
2025-02-16Rollup merge of #136545 - durin42:nvptx64-align, r=nikicJacob Pratt-1/+1
nvptx64: update default alignment to match LLVM 21 This changed in llvm/llvm-project@91cb8f5d3202870602c6bef807bc4c7ae8a32790. The commit itself is mostly about some intrinsic instructions, but as an aside it also mentions something about addrspace for tensor memory, which I believe is what this string is telling us. `@rustbot` label: +llvm-main
2025-02-15Load all builtin targets at once instead of one by oneUrgau-0/+13
This should give us some performance improvements as we won't need to do the lookup for the _currently_ 287 targets we have.
2025-02-14add x86-sse2 (32bit) ABI that requires SSE2 target featureRalf Jung-19/+63
2025-02-13Rollup merge of #134999 - Berrysoft:dev/new-cygwin-target, ↵Jacob Pratt-2/+74
r=chenyukang,workingjubilee Add cygwin target. This PR simply adds cygwin target together with msys2 target, based on ````@ookiineko```` 's (the account has been deleted) [work](https://github.com/ookiineko-cygport/rust) on cygwin target. My full work is here: https://github.com/rust-lang/rust/compare/master...Berrysoft:rust:dev/cygwin I have succeeded in building a new rustc for cygwin target, and eventually distributed a new version of [fish-shell](https://github.com/Berrysoft/fish-shell/releases) (rewritten by Rust) for MSYS2. I will open a new PR to fix std if this PR is accepted.
2025-02-12Rollup merge of #136698 - jackpot51:i586-redox, r=RalfJungGuillaume Gomez-2/+2
Replace i686-unknown-redox target with i586-unknown-redox This change is related to https://github.com/rust-lang/rust/issues/136495
2025-02-11i686-linux-android: increase CPU baseline to Pentium 4 (without an actual ↵Ralf Jung-1/+1
change)
2025-02-11Rollup merge of #136603 - workingjubilee:move-abi-versioning-into-ast, ↵Matthias Krüger-7/+0
r=compiler-errors compiler: gate `extern "{abi}"` in ast_lowering I don't believe low-level crates like `rustc_abi` should have to know or care about higher-level concerns like whether the ABI string is stable for users. These implementation details can be made less open to public inspection. This way the code that governs stability is near the code that enforces stability, and compiled together. It also abstracts away certain error messages instead of constantly repeating them. A few error messages are simply deleted outright, instead of made uniform, because they are either too dated to be useful or redundant with other diagnostic improvements we could make. These can be pursued in followups: my first concern was making sure there wasn't unnecessary diagnostics-related code in `rustc_abi`, which is not well-positioned to understand what kind of errors are going to be generated based on how it is used. r? ``@ghost``
2025-02-10Change CPU target back to pentiumproJeremy Soller-1/+1
2025-02-10Rollup merge of #136791 - nicholasbishop:bishop-disable-dwarf, r=jieyouxuMatthias Krüger-1/+8
Disable DWARF in linker options for i686-unknown-uefi This fixes an lld warning: > warning: linker stderr: rust-lld: section name .debug_frame is longer than 8 characters and will use a non-standard string table See https://reviews.llvm.org/D69594 for details of where the warning was added. This warning only occurs with the i686 UEFI target, not x86_64 or aarch64. The x86_64 target uses an LLVM target of `x86_64-unknown-windows` and aarch64 uses `aarch64-unknown-windows`, but i686 uses `i686-unknown-windows-gnu` (note the `-gnu`). See comments in `i686_unknown_uefi.rs` for details of why. The `.debug_frame` section should not actually be needed; UEFI targets provide a separate PDB file for debugging. Disable DWARF (and by extension the `.debug_frame` section) by passing `/DEBUG:NODWARF` to lld. Tested with: ``` export RUSTC_LOG=rustc_codegen_ssa::back::link=info cargo +stage1 build --release --target i686-unknown-uefi ``` This issue was originally raised here: https://github.com/rust-lang/rust/pull/119286#issuecomment-2612746162. See also https://github.com/rust-lang/rust/issues/136096. It was suggested to file an LLVM bug, but I don't think LLVM is actually doing anything wrong as such. CC `@dvdhrm` `@jyn514` let me know if you have any feedback on this approach
2025-02-10Reformat files王宇逸-8/+9
2025-02-10Apply suggestions王宇逸-18/+4
2025-02-10Add cygwin target.王宇逸-2/+87
Co-authored-by: Ookiineko <chiisaineko@protonmail.com> Co-authored-by: nora <48135649+Noratrieb@users.noreply.github.com> Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-02-10Auto merge of #134740 - Flakebi:amdgpu-target, r=workingjubileebors-0/+53
Add amdgpu target Add amdgpu target to rustc and enable the LLVM target. Fix compiling `core` with the amdgpu: The amdgpu backend makes heavy use of different address spaces. This leads to situations, where a pointer in one addrspace needs to be casted to a pointer in a different addrspace. `bitcast` is invalid for this case, `addrspacecast` needs to be used. Fix compilation failures that created bitcasts for such cases by creating pointer casts (which creates an `addrspacecast` under the hood) instead. MCP: https://github.com/rust-lang/compiler-team/issues/823 Tracking issue: #135024 Kinda related to the original amdgpu tracking issue #51575 (though that one has been closed for a while).
2025-02-09compiler: remove rustc_target::spec::abi reexportsJubilee Young-4/+0
2025-02-09compiler: gate `extern "{abi}"` in ast_loweringJubilee Young-4/+1
By moving this stability check into AST lowering, we effectively make it impossible to accidentally miss, as it must happen to generate HIR. Also, we put the ABI-stability code next to code that actually uses it! This allows code that wants to reason about backend ABI implementations to stop worrying about high-level concerns like syntax stability, while still leaving it as the authority on what ABIs actually exist. It also makes it easy to refactor things to have more consistent errors. For now, we only apply this to generalize the existing messages a bit.
2025-02-09Disable DWARF in linker options for i686-unknown-uefiNicholas Bishop-1/+8
This fixes an lld warning: > warning: linker stderr: rust-lld: section name .debug_frame is longer > than 8 characters and will use a non-standard string table See https://reviews.llvm.org/D69594 for details of where the warning was added. This warning only occurs with the i686 UEFI target, not x86_64 or aarch64. The x86_64 target uses an LLVM target of `x86_64-unknown-windows` and aarch64 uses `aarch64-unknown-windows`, but i686 uses `i686-unknown-windows-gnu` (note the `-gnu`). See comments in `i686_unknown_uefi.rs` for details of why. The `.debug_frame` section should not actually be needed; UEFI targets provide a separate PDB file for debugging. Disable DWARF (and by extension the `.debug_frame` section) by passing `/DEBUG:NODWARF` to lld. Tested with: export RUSTC_LOG=rustc_codegen_ssa::back::link=info cargo +stage1 build --release --target i686-unknown-uefi
2025-02-09Auto merge of #136751 - bjorn3:update_rustfmt, r=Mark-Simulacrumbors-254/+293
Update bootstrap compiler and rustfmt The rustfmt version we previously used formats things differently from what the latest nightly rustfmt does. This causes issues for subtrees that get formatted both in-tree and in their own repo. Updating the rustfmt used in-tree solves those issues. Also bumped the bootstrap compiler as the stage0 update command always updates both at the same time.
2025-02-08Rollup merge of #136706 - workingjubilee:finish-up-rustc-abi-updates, ↵Jubilee-49/+96
r=compiler-errors compiler: mostly-finish `rustc_abi` updates This almost-finishes all the updates in the compiler to use `rustc_abi` and removes some of the reexports of `rustc_abi` items in `rustc_target` that were previously available. r? ```@compiler-errors```
2025-02-08Rustfmtbjorn3-254/+293
2025-02-07compiler: remove rustc_target::abi entirelyJubilee Young-49/+96
2025-02-07i686-unknown-hurd-gnu: bump baseline CPU to Pentium 4Ralf Jung-1/+1
2025-02-07Replace i686-unknown-redox target with i586-unknown-redoxJeremy Soller-3/+3