about summary refs log tree commit diff
path: root/compiler/rustc_target/src
AgeCommit message (Collapse)AuthorLines
2023-04-15Update max_atomic_width of armv7r and armv7_sony_vita targets to 64.Chris Copeland-5/+5
2023-04-13Auto merge of #109989 - ids1024:m68k-asm, r=Amanieubors-0/+105
Add inline assembly support for m68k I believe this should be correct, to the extent I understand the logic around inline assembly. M68k is fairly straightforward here, other than having separate address registers.
2023-04-12Add inline assembly support for m68kIan Douglas Scott-0/+105
2023-04-12Rollup merge of #110153 - DaniPopes:compiler-typos, r=NilstriebMatthias Krüger-2/+2
Fix typos in compiler I ran [`typos -w compiler`](https://github.com/crate-ci/typos) to fix typos in the `compiler` directory. Refs #110150
2023-04-11Rollup merge of #96971 - zhaixiaojuan:master, r=wesleywiserMichael Goulet-0/+18
Initial support for loongarch64-unknown-linux-gnu Hi, We hope to add a new port in rust for LoongArch. LoongArch intro LoongArch is a RISC style ISA which is independently designed by Loongson Technology in China. It is divided into two versions, the 32-bit version (LA32) and the 64-bit version (LA64). LA64 applications have application-level backward binary compatibility with LA32 applications. LoongArch is composed of a basic part (Loongson Base) and an expanded part. The expansion part includes Loongson Binary Translation (LBT), Loongson VirtualiZation (LVZ), Loongson SIMD EXtension (LSX) and Loongson Advanced SIMD EXtension(LASX). Currently the LA464 processor core supports LoongArch ISA and the Loongson 3A5000 processor integrates 4 64-bit LA464 cores. LA464 is a four-issue 64-bit high-performance processor core. It can be used as a single core for high-end embedded and desktop applications, or as a basic processor core to form an on-chip multi-core system for server and high-performance machine applications. Documentations: ISA: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html ABI: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html More docs can be found at: https://loongson.github.io/LoongArch-Documentation/README-EN.html Since last year, we have locally adapted two versions of rust, rust1.41 and rust1.57, and completed the test locally. I'm not sure if I'm submitting all the patches at once, so I split up the patches and here's one of the commits
2023-04-10Fix typos in compilerDaniPopes-2/+2
2023-04-09Simply Abi::fmtNilstrieb-3/+1
2023-04-09Auto merge of #109173 - flba-eb:add-i586-qnx70-target, r=compiler-errorsbors-1/+27
Add tier 3 no_std x86 support for QNX Neutrino RTOS, version 7.0 This PR adds the target `i586-pc-nto-qnx700`, which targets QNX Neutrino RTOS version 7.0 on x86 32-bit targets. cc: `@flba-eb` `@gh-tr` This target falls under the umbrella of Tier 3 QNX Neutrino RTOS support documented in `nto-qnx.md` and previously started with #102701.
2023-04-04Initial support for loongarch64-unknown-linux-gnuzhaixiaojuan-0/+18
2023-04-04Disable `has_thread_local` on OpenHarmonyAmanieu d'Antras-0/+2
OpenHarmony uses emulated TLS, which doesn't link properly when using thread-local variables across crate boundaries with `-C prefer-dynamic`. This PR makes thread_local! use pthreads directly instead.
2023-04-03Use apple-m1 as target CPU for aarch64-apple-darwin.daxpedda-1/+1
2023-04-01Auto merge of #109721 - QuinnPainter:armv4t-lld, r=petrochenkovbors-19/+3
Switch to LLD as default linker for {arm,thumb}v4t-none-eabi The LLVM 16 update brought ARMv4t support to LLD. We should use it by default so users don't need to install an external linker. cc `@Lokathor`
2023-03-29Add QNX 7.0 x86 targetSam Kearney-1/+27
2023-03-29Auto merge of #108996 - ↵bors-0/+8
pnkfelix:rollback-part-of-pr-104137-that-broke-wasm-linker-overriding, r=petrochenkov Rollback part of pr 104137 that broke wasm linker overriding This is a quick fix to address #108910
2023-03-29Auto merge of #108089 - Zoxc:windows-tls, r=bjorn3bors-0/+8
Support TLS access into dylibs on Windows This allows access to `#[thread_local]` in upstream dylibs on Windows by introducing a MIR shim to return the address of the thread local. Accesses that go into an upstream dylib will call the MIR shim to get the address of it. `convert_tls_rvalues` is introduced in `rustc_codegen_ssa` which rewrites MIR TLS accesses to dummy calls which are replaced with calls to the MIR shims when the dummy calls are lowered to backend calls. A new `dll_tls_export` target option enables this behavior with a `false` value which is set for Windows platforms. This fixes https://github.com/rust-lang/rust/issues/84933.
2023-03-29Switch to LLD as default linker for {arm,thumb}v4t-none-eabiQuinn Painter-19/+3
2023-03-29Support TLS access into dylibs on WindowsJohn Kåre Alsaker-0/+8
2023-03-28Add OpenHarmony targetsAmanieu d'Antras-0/+67
- `aarch64-unknown-linux-ohos` - `armv7-unknown-linux-ohos`
2023-03-23Rollup merge of #109231 - Zoxc:fs-non-canon, r=eholkMatthias Krüger-1/+2
Add `try_canonicalize` to `rustc_fs_util` and use it over `fs::canonicalize` This adds `try_canonicalize` which tries to call `fs::canonicalize`, but falls back to `std::path::absolute` if it fails. Existing `canonicalize` calls are replaced with it. `fs::canonicalize` is not guaranteed to work on Windows.
2023-03-16Add `try_canonicalize` to `rustc_fs_util` and use it over `fs::canonicalize`John Kåre Alsaker-1/+2
2023-03-15Fix riscv64 fuchsia LLVM target nameTaiki Endo-1/+1
2023-03-14Rollup merge of #108722 - petrhosek:fuchsia-riscv, r=petrochenkovMatthias Krüger-0/+20
Support for Fuchsia RISC-V target Fuchsia is in the process of implementing the RISC-V support. This change implements the minimal Rust compiler support. The support for building runtime libraries will be implemented in follow up changes once Fuchsia SDK has the RISC-V support.
2023-03-14the fixFelix S. Klock II-0/+8
(fixed build by adding missing import.)
2023-03-05Add support for the x86_64h-apple-darwin targetThom Chiovoloni-5/+61
2023-03-04Support for Fuchsia RISC-V targetPetr Hosek-0/+20
Fuchsia is in the process of implementing the RISC-V support. This change implements the minimal Rust compiler support. The support for building runtime libraries will be implemented in follow up changes once Fuchsia SDK has the RISC-V support.
2023-03-01Use FxIndexSet instead of FxHashSet for asm_target_features query.Michael Woerister-25/+26
2023-02-18Auto merge of #106476 - ↵bors-6/+15
keith:ks/add-sanitizer-support-for-modern-ios-platforms, r=badboy Add sanitizer support for modern iOS platforms asan and tsan generally support iOS, but that previously wasn't configured in rust. This only adds support for the simulator architectures, and arm64 device architecture, not the older 32 bit architectures.
2023-02-18Auto merge of #99679 - repnop:kernel-address-sanitizer, r=cuviperbors-3/+11
Add `kernel-address` sanitizer support for freestanding targets This PR adds support for KASan (kernel address sanitizer) instrumentation in freestanding targets. I included the minimal set of `x86_64-unknown-none`, `riscv64{imac, gc}-unknown-none-elf`, and `aarch64-unknown-none` but there's likely other targets it can be added to. (`linux_kernel_base.rs`?) KASan uses the address sanitizer attributes but has the `CompileKernel` parameter set to `true` in the pass creation.
2023-02-17Rollup merge of #107592 - workingjubilee:use-16-bit-enum-on-16-bit-targets, ↵Matthias Krüger-24/+26
r=WaffleLapkin Default `repr(C)` enums to `c_int` size This is what ISO C strongly implies this is correct, and many processor-specific ABIs imply or mandate this size, so "everyone" (LLVM, gcc...) defaults to emitting enums this way. However, this is by no means guaranteed by ISO C, and the bare-metal Arm targets show it can be overridden, which rustc supports via `c-enum-min-bits` in a target.json. The override is a flag named `-fshort-enums` in clang and gcc, but introducing a CLI flag is probably unnecessary for rustc. This flag can be used by non-Arm microcontroller targets, like AVR and MSP430, but it is not enabled for them by default. Rust programmers who know the size of a target's enums can use explicit reprs, which also lets them match C23 code. This change is most relevant to 16-bit targets: AVR and MSP430. Most of rustc's targets use 32-bit ints, but ILP64 does exist. Regardless, rustc should now correctly handle enums for both very small and very large targets. Thanks to William for confirming MSP430 behavior, and to Waffle for better style and no-core `size_of` asserts. Fixes rust-lang/rust#107361 Fixes rust-lang/rust#77806
2023-02-16Default repr(C) enums to c_int sizeJubilee Young-24/+26
This is what ISO C strongly implies this is correct, and many processor-specific ABIs imply or mandate this size, so "everyone" (LLVM, gcc...) defaults to emitting enums this way. However, this is by no means guaranteed by ISO C, and the bare-metal Arm targets show it can be overridden, which rustc supports via `c-enum-min-bits` in a target.json. The override is a flag named `-fshort-enums` in clang and gcc, but introducing a CLI flag is probably unnecessary for rustc. This flag can be used by non-Arm microcontroller targets, like AVR and MSP430, but it is not enabled for them by default. Rust programmers who know the size of a target's enums can use explicit reprs, which also lets them match C23 code. This change is most relevant to 16-bit targets: AVR and MSP430. Most of rustc's targets use 32-bit ints, but ILP64 does exist. Regardless, rustc should now correctly handle enums for both very small and very large targets. Thanks to William for confirming MSP430 behavior, and to Waffle for better style and no-core size_of asserts. Co-authored-by: William D. Jones <thor0505@comcast.net> Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2023-02-15Rollup merge of #107968 - ian-h-chamberlain:feature/3ds-enable-thread-local, ↵Dylan DPC-2/+1
r=Nilstrieb Enable `#[thread_local]` on armv6k-nintendo-3ds Since [libctru 2.1.2](https://github.com/devkitPro/libctru/releases/tag/v2.1.2) was released we should now be able to use real `#[thread_local]` without corruption issues on the 3DS target. CC `@Meziu` `@AzureMarker` `@Techie-Pi` https://github.com/rust3ds/ctru-rs/issues/91#issuecomment-1426821450
2023-02-15Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8KiDylan DPC-46/+2
Remove some superfluous type parameters from layout.rs. Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2023-02-14Add `kernel-address` sanitizer support for freestanding targetsWesley Norris-3/+11
2023-02-12Add sanitizer support for modern iOS platformsKeith Smiley-6/+15
asan and tsan generally support iOS, but that previously wasn't configured in rust. This only adds support for the simulator architectures, and arm64 device architecture, not the older 32 bit architectures.
2023-02-12Enable #[thread_local] on armv6k-nintendo-3dsIan Chamberlain-2/+1
Since libctru 2.1.2 was released (https://github.com/devkitPro/libctru/releases/tag/v2.1.2) we should be able to use real #[thread_local] without corruption issues on the 3DS target.
2023-02-10Update the minimum external LLVM to 14Josh Stone-14/+31
2023-02-09XRay support flag in TargetOptionsOleksii Lozovskyi-0/+15
Specify where XRay is supported. I only test ARM64 and x86_64, but hey those others should work too, right? LLVM documentation says that MIPS and PPC are also supported, but I don't have the hardware, so I won't pretend. Naturally, more targets can be added later with more testing.
2023-02-02Auto merge of #106925 - ↵bors-3/+3
imWildCat:imWildCat/remove-hardcoded-ios-macbi-target-version, r=wesleywiser Remove hardcoded iOS version of clang target for Mac Catalyst ## Background From `clang` 13.x, `-target x86_64-apple-ios13.0-macabi` fails while linking: ``` = note: clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi' ``` <details> <summary>Verbose output</summary> ``` error: linking with `cc` failed: exit status: 1 | = note: LC_ALL="C" PATH="[removed]" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-Wl,-exported_symbols_list,/var/folders/p8/qpmzbsdn07g5gxykwfxxw7y40000gn/T/rustci8tkvp/list" "-target" "x86_64-apple-ios13.0-macabi" "/var/folders/p8/qpmzbsdn07g5gxykwfxxw7y40000gn/T/rustci8tkvp/symbols.o" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/deps/[user].[user].a2ccc648-cgu.0.rcgu.o" "-L" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/deps" "-L" "/path/to/my/[project]/[user]/target/release/deps" "-L" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/build/blake3-74e6ba91506ce712/out" "-L" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/build/blake3-74e6ba91506ce712/out" "-L" "/Users/[user]/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-apple-ios-macabi/lib" "/var/folders/p8/qpmzbsdn07g5gxykwfxxw7y40000gn/T/rustci8tkvp/libblake3-343c1616c8f62c66.rlib" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/deps/libcompiler_builtins-15d4f20b641cf9ef.rlib" "-framework" "Security" "-framework" "CoreFoundation" "-framework" "Security" "-liconv" "-lSystem" "-lobjc" "-framework" "Security" "-framework" "Foundation" "-lc" "-lm" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk" "-Wl,-syslibroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk" "-L" "/Users/[user]/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-apple-ios-macabi/lib" "-o" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/deps/lib[user].dylib" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs" = note: clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi' warning: `[user]` (lib) generated 6 warnings error: could not compile `[user]` due to previous error; 6 warnings emitted ``` </details> ### Minimal example C code: ```c #include <stdio.h> void main() { int a = 1; int b = 2; int c = a + b; printf("%d", c); } ``` `clang` command sample: ``` ➜ 202301 clang -target x86_64-apple-ios13.0-macabi main.c clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi' ➜ 202301 clang -target x86_64-apple-ios14.0-macabi main.c main.c:2:1: warning: return type of 'main' is not 'int' [-Wmain-return-type] void main() { ^ main.c:2:1: note: change return type to 'int' void main() { ^~~~ int 1 warning generated. ➜ 202301 clang -target x86_64-apple-ios15.0-macabi main.c main.c:2:1: warning: return type of 'main' is not 'int' [-Wmain-return-type] void main() { ^ main.c:2:1: note: change return type to 'int' void main() { ^~~~ int 1 warning generated. ➜ 202301 clang -target x86_64-apple-ios-macabi main.c main.c:2:1: warning: return type of 'main' is not 'int' [-Wmain-return-type] void main() { ^ main.c:2:1: note: change return type to 'int' void main() { ^~~~ int 1 warning generated. ➜ 202301 clang --version Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin ``` This PR is a simplified version of #96392, inspired by https://github.com/rust-lang/cc-rs/pull/727
2023-01-26Remove hardcoded clang target: ios13 or ios14 for Mac Catalyst [fixed]imWildCat-3/+3
2023-01-26Rollup merge of #107248 - erikdesjardins:addrspace, r=oli-obkMatthias Krüger-8/+8
abi: add AddressSpace field to Primitive::Pointer ...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string (and various other changes), which will be done in a followup. (That is, if it's actually worth it to support multiple different pointer sizes. There is a lot of code that would be affected by that.) Fixes #106367 r? ``@oli-obk`` cc ``@Patryk27``
2023-01-23Rollup merge of #106796 - vadorovsky:revert-105708-enable-atomic-cas-bpf, ↵Yuki Okushi-1/+1
r=bjorn3 BPF: Disable atomic CAS Enabling CAS for BPF targets (https://github.com/rust-lang/rust/pull/105708) breaks the build of core library. The failure occurs both when building rustc for BPF targets and when building crates for BPF targets with the current nightly. The LLVM BPF backend does not correctly lower all `atomicrmw` operations and crashes for unsupported ones. Before we can enable CAS for BPF in Rust, we need to fix the LLVM BPF backend first. Fixes #106795 Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-5/+5
...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string, which will be done in a followup.
2023-01-22rustc_abi: remove Primitive::{is_float,is_int}Erik Desjardins-3/+3
there were fixmes for this already i am about to remove is_ptr (since callers need to properly distinguish between pointers in different address spaces), so might as well do this at the same time
2023-01-21Remove some superfluous type parameters from layout.rs.Michael Benfield-46/+2
Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2023-01-20Enable sanitizers for s390x-linuxUlrich Weigand-2/+6
Include sanitizers supported by LLVM on s390x (asan, lsan, msan, tsan) in the target definition, as well as in the compiletest supported list. Build sanitizer runtime for the target. Enable sanitizers in the CI.
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-11/+11
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-11/+11
2023-01-14Fix some missed double spaces.André Vennberg-1/+1
2023-01-14BPF: Disable atomic CASMichal Rostecki-1/+1
Enabling CAS for BPF targets (#105708) breaks the build of core library. The failure occurs both when building rustc for BPF targets and when building crates for BPF targets with the current nightly. The LLVM BPF backend does not correctly lower all `atomicrmw` operations and crashes for unsupported ones. Before we can enable CAS for BPF in Rust, we need to fix the LLVM BPF backend first. Fixes #106795 Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2023-01-11Stabilize `abi_efiapi` featureNicholas Bishop-5/+1
Tracking issue: https://github.com/rust-lang/rust/issues/65815