about summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec
AgeCommit message (Collapse)AuthorLines
2021-10-06add platform support details file for armv7-unknown-linux-uclibcJonah Petri-0/+1
2021-10-06Add new target armv7-unknown-linux-uclibceabihfYannick Koehler-0/+25
Co-authored-by: Jonah Petri <jonah@petri.us>
2021-10-01Rollup merge of #88820 - hlopko:add_pie_relocation_model, r=petrochenkovManish Goregaokar-0/+3
Add `pie` as another `relocation-model` value MCP: https://github.com/rust-lang/compiler-team/issues/461
2021-10-01Add `pie` as another `relocation-model` valueMarcel Hlopko-0/+3
2021-09-28Add SOLID targetsTomoaki Kawada-0/+74
SOLID[1] is an embedded development platform provided by Kyoto Microcomputer Co., Ltd. This commit introduces a basic Tier 3 support for SOLID. # New Targets The following targets are added: - `aarch64-kmc-solid_asp3` - `armv7a-kmc-solid_asp3-eabi` - `armv7a-kmc-solid_asp3-eabihf` SOLID's target software system can be divided into two parts: an RTOS kernel, which is responsible for threading and synchronization, and Core Services, which provides filesystems, networking, and other things. The RTOS kernel is a μITRON4.0[2][3]-derived kernel based on the open-source TOPPERS RTOS kernels[4]. For uniprocessor systems (more precisely, systems where only one processor core is allocated for SOLID), this will be the TOPPERS/ASP3 kernel. As μITRON is traditionally only specified at the source-code level, the ABI is unique to each implementation, which is why `asp3` is included in the target names. More targets could be added later, as we support other base kernels (there are at least three at the point of writing) and are interested in supporting other processor architectures in the future. # C Compiler Although SOLID provides its own supported C/C++ build toolchain, GNU Arm Embedded Toolchain seems to work for the purpose of building Rust. # Unresolved Questions A μITRON4 kernel can support `Thread::unpark` natively, but it's not used by this commit's implementation because the underlying kernel feature is also used to implement `Condvar`, and it's unclear whether `std` should guarantee that parking tokens are not clobbered by other synchronization primitives. # Unsupported or Unimplemented Features Most features are implemented. The following features are not implemented due to the lack of native support: - `fs::File::{file_attr, truncate, duplicate, set_permissions}` - `fs::{symlink, link, canonicalize}` - Process creation - Command-line arguments Backtrace generation is not really a good fit for embedded targets, so it's intentionally left unimplemented. Unwinding is functional, however. ## Dynamic Linking Dynamic linking is not supported. The target platform supports dynamic linking, but enabling this in Rust causes several problems. - The linker invocation used to build the shared object of `std` is too long for the platform-provided linker to handle. - A linker script with specific requirements is required for the compiled shared object to be actually loadable. As such, we decided to disable dynamic linking for now. Regardless, the users can try to create shared objects by manually invoking the linker. ## Executable Building an executable is not supported as the notion of "executable files" isn't well-defined for these targets. [1] https://solid.kmckk.com/SOLID/ [2] http://ertl.jp/ITRON/SPEC/mitron4-e.html [3] https://en.wikipedia.org/wiki/ITRON_project [4] https://toppers.jp/
2021-09-22Disable the leak sanitizer on Macos aarch64 for now.Hans Kratz-1/+3
It is currently broken, see #88132.
2021-09-17compiler/rustc_target: Add support for m68k-linux-gnuJohn Paul Adrian Glaubitz-0/+16
2021-09-13Auto merge of #88529 - Meziu:master, r=nagisabors-0/+45
ARMv6K Nintendo 3DS Tier 3 target added Addition of the target specifications to build .elf files for Nintendo 3DS (ARMv6K, Horizon). Requires devkitARM 3DS toolkit for system libraries and arm-none-eabi-gcc linker.
2021-09-10ARMV6K 3DS: Removed useless parameters in target specMeziu-3/+1
2021-09-03Auto merge of #88454 - devnexen:sunos_asan, r=wesleywiserbors-2/+4
sunos systems add sanitizer supported.
2021-09-02Auto merge of #88516 - matthiaskrgr:clippy_perf_end_august, ↵bors-1/+1
r=jyn514,GuillaumeGomez some low hanging clippy::perf fixes
2021-09-02Auto merge of #87114 - cjgillot:abilint, r=estebankbors-0/+3
Lint missing Abi in ast validation instead of lowering.
2021-08-31Lint Abi in ast validation.Camille GILLOT-0/+3
2021-08-31some low hanging clippy::perf fixesMatthias Krüger-1/+1
2021-08-31ARMv6K Nintendo 3DS Tier 3 target addedMeziu-0/+47
2021-08-30sunos systems add sanitizer supported.David Carlier-2/+4
2021-08-30Disallow the aapcs CC on Aarch64Simonas Kazlauskas-1/+2
This never really worked and makes LLVM assert.
2021-08-29Auto merge of #88250 - rusticstuff:macos-lld, r=nagisabors-1/+2
Make `-Z gcc-ld=lld` work for Apple targets `-Z gcc-ld=lld` was introduced in #85961. It does not work on Macos because lld needs be either named `ld64` or passed `-flavor darwin` as the first two arguments in order to select the Mach-O flavor. Rust invokes cc (=clang) on Macos for linking which calls `ld` as linker binary and not `ld64`, so just creating an `ld64` binary and modifying the search path with `-B` does not work. In order to solve this patch does: * Set the `lld_flavor` for all Apple-derived targets to `LldFlavor::Ld64`. As far as I can see this actually works towards fixing `-Xlinker=rust-lld` as all those targets use the Mach-O object format. * Copy/hardlink rust-lld to the gcc-ld subdirectory as ld64 next to ld. * If `-Z gcc-ld=lld` is used and the target lld flavor is Ld64 add `-fuse-ld=/path/to/ld64` to the linker invocation. Fixes #86945.
2021-08-24allow specifying an ios version for the llvm targetPatrick Amrein-3/+9
2021-08-23Mach-O (Macos/ios/...) LLD flavor is always LD64.Hans Kratz-1/+2
2021-08-22Rollup merge of #88077 - kit-981:feature/fix-minimum-os-version-in-header, ↵Guillaume Gomez-1/+13
r=petrochenkov Generate an iOS LLVM target with a specific version This commit adds the `LC_VERSION_MIN_IPHONEOS` load command to the Mach-O header generated for `aarch64-apple-ios` binaries. The operating system will look for this load command to determine the minimum supported operating system version and will not allow the binary to run if it's absent. This logic already exists for the simulator toolchain. I've been using `otool` from a [cctools](https://github.com/tpoechtrager/cctools-port) toolchain to parse the header and validate that this change adds the required load command. This change appears to be enough to build Rust binaries that can run on a jailbroken iPhone.
2021-08-21Auto merge of #87570 - nikic:llvm-13, r=nagisabors-9/+9
Upgrade to LLVM 13 Work in progress update to LLVM 13. Main changes: * InlineAsm diagnostics reported using SrcMgr diagnostic kind are now handled. Previously these used a separate diag handler. * Codegen tests are updated for additional attributes. * Some data layouts have changed. * Switch `#[used]` attribute from `llvm.used` to `llvm.compiler.used` to avoid SHF_GNU_RETAIN flag introduced in https://reviews.llvm.org/D97448, which appears to trigger a bug in older versions of gold. * Set `LLVM_INCLUDE_TESTS=OFF` to avoid Python 3.6 requirement. Upstream issues: * ~~https://bugs.llvm.org/show_bug.cgi?id=51210 (InlineAsm diagnostic reporting for module asm)~~ Fixed by https://github.com/llvm/llvm-project/commit/1558bb80c01b695ce12642527cbfccf16cf54ece. * ~~https://bugs.llvm.org/show_bug.cgi?id=51476 (Miscompile on AArch64 due to incorrect comparison elimination)~~ Fixed by https://github.com/llvm/llvm-project/commit/81b106584f2baf33e09be2362c35c1bf2f6bfe94. * https://bugs.llvm.org/show_bug.cgi?id=51207 (Can't set custom section flags anymore). Problematic change reverted in our fork, https://reviews.llvm.org/D107216 posted for upstream revert. * https://bugs.llvm.org/show_bug.cgi?id=51211 (Regression in codegen for #83623). This is an optimization regression that we may likely have to eat for this release. The fix for #83623 was based on an incorrect premise, and this needs to be properly addressed in the MergeICmps pass. The [compile-time impact](https://perf.rust-lang.org/compare.html?start=ef9549b6c0efb7525c9b012148689c8d070f9bc0&end=0983094463497eec22d550dad25576a894687002) is mixed, but quite positive as LLVM upgrades go. The LLVM 13 final release is scheduled for Sep 21st. The current nightly is scheduled for stable release on Oct 21st. r? `@ghost`
2021-08-16Update powerpc64 data layoutNikita Popov-5/+5
2021-08-16Update wasm data layoutNikita Popov-4/+4
2021-08-16Generate an iOS LLVM target with a specific versionkit-1/+13
Without the specific version, the mach-o header will be missing the minimum supported operating system version. This is mandatory for running Rust binaries on iOS devices.
2021-08-14freebsd arm64 add supported sanitizers.DC-2/+8
2021-08-12Rollup merge of #87922 - Manishearth:c-enum-target-spec, r=nagisa,eddybManish Goregaokar-0/+28
Add c_enum_min_bits target spec field, use for arm-none and thumb-none targets Fixes https://github.com/rust-lang/rust/issues/87917 <s>Haven't tested this yet, still playing around.</s> This seems to fix the issue.
2021-08-12Apply c_enum_min_bits = 8 to (arm|thumb)-none- platformsManish Goregaokar-0/+14
2021-08-12Add c_enum_min_bits to target specManish Goregaokar-0/+14
2021-08-10STD support for the ESP-IDF frameworkivmarkov-0/+38
2021-08-09Auto merge of #85357 - Andy-Python-Programmer:aarch64_uefi_target, ↵bors-0/+28
r=petrochenkov Add `aarch64-unknown-uefi` target This pull request adds the `aarch64-unknown-uefi` target.
2021-08-09Add the aarch64-unknown-uefi targetunknown-0/+28
* This commit adds the aarch64-unknown-uefi target and also adds it into the supported targets list under the tier-3 target table. * Uses the small code model by default Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2021-08-01Auto merge of #87664 - devnexen:netbsd_sanitizers_support, r=nagisabors-1/+3
netbsd x86_64 arch enable supported sanitizers.
2021-08-01Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisabors-1/+1
more clippy::complexity fixes (also a couple of clippy::perf fixes)
2021-07-31netbsd x86_64 arch enable supported sanitizers.David Carlier-1/+3
2021-07-25freebsd remove compiler workaround.David Carlier-2/+1
related issue #43575
2021-07-25clippy::useless_formatMatthias Krüger-1/+1
2021-07-22Add support for powerpc-unknown-freebsdPiotr Kubaj-0/+28
2021-07-17Auto merge of #87124 - Andy-Python-Programmer:code_model_uefi_patch, ↵bors-6/+2
r=petrochenkov Use small code model for UEFI targets * Since the code model only applies to the code and not the data and the code model only applies to functions you call through using `call`, `jmp` and data with `lea`, etc… If you are calling functions using the function pointers from the UEFI structures the code model does not apply in that case. It’s just related to the address space size of your own binary. Since UEFI (uefi is all relocatable) uses relocatable PEs (relocatable code does not care about the code model) so, we use the small code model here. * Since applications don't usually take gigabytes of memory, setting the target to use the small code model should result in better codegen (comparable with majority of other targets). Large code models are also known for generating horrible code, for example 16 bytes of code to load a single 8-byte value. Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2021-07-17Auto merge of #86062 - nagisa:nagisa/what-a-lie, r=estebankbors-0/+4
Do not allow JSON targets to set is-builtin: true Note that this will affect (and make builds fail for) all of the projects out there that have target files invalid in this way. Crater, however, does not really cover these kinds of the codebases, so it is quite difficult to measure the impact. That said, the target files invalid in this way can start causing build failures each time LLVM is upgraded, anyway, so it is probably a good opportunity to disallow this property, entirely. Another approach considered was to simply not parse this field anymore, which would avoid making the builds explicitly fail, but it wasn't clear to me if `is-builtin` was always set unintentionally… In case this was the case, I'd expect people to file a feature request stating specifically for what purpose they were using `is-builtin`. Fixes #86017
2021-07-17Use small code model for UEFI targetsAndy-Python-Programmer-6/+2
* Since the code model only applies to the code and not the data and the code model only applies to functions you call through using `call`, `jmp` and data with `lea`, etc… If you are calling functions using the function pointers from the UEFI structures the code model does not apply in that case. It’s just related to the address space size of your own binary. Since UEFI (uefi is all relocatable) uses relocatable PEs (relocatable code does not care about the code model) so, we use the small code model here. * Since applications don't usually take gigabytes of memory, setting the target to use the small code model should result in better codegen (comparable with majority of other targets). Large code models are also known for generating horrible code, for example 16 bytes of code to load a single 8-byte value. * Use the LLVM default code model for the architecture for the x86_64-unknown-uefi targets. For reference small is the default code model on x86 in LLVM: <https://github.com/llvm/llvm-project/blob/7de2173c2a4c45711831cfee3ccf53690c76ff07/llvm/lib/Target/X86/X86TargetMachine.cpp#L204> * Remove the comments too as they are not UEFI-specific and applies to pretty much any target. I added them before as I was explicitily setting the code model to small. Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2021-07-08Do not allow JSON targets to set is-builtin: trueSimonas Kazlauskas-0/+4
2021-07-07Update targets to use target_abiJosh Triplett-7/+92
All eabi targets have target_abi = "eabi". All eabihf targets have target_abi = "eabihf". armv6_unknown_freebsd and armv7_unknown_freebsd have target_abi = "eabihf". All abi64 targets have target_abi = "abi64". All ilp32 targets have target_abi = "ilp32". All softfloat targets have target_abi = "softfloat". All *-uwp-windows-* targets have target_abi = "uwp". All spe targets have target_abi = "spe". All macabi targets have target_abi = "macabi". aarch64-apple-ios-sim has target_abi = "sim". x86_64-fortanix-unknown-sgx has target_abi = "fortanix". x86_64-unknown-linux-gnux32 has target_abi = "x32". Add FIXME entries for targets for which existing values need to change once cfg_target_abi becomes stable. (All of them are tier 3 targets.) Add a test for target_abi in `--print cfg`.
2021-07-07Implement cfg(target_abi) (RFC 2992)Josh Triplett-0/+6
Add an `abi` field to `TargetOptions`, defaulting to "". Support using `cfg(target_abi = "...")` for conditional compilation on that field. Gated by `feature(cfg_target_abi)`. Add a test for `target_abi`, and a test for the feature gate. Add `target_abi` to tidy as a platform-specific cfg. This does not add an abi to any existing target.
2021-07-06Replace per-target ABI denylist with an allowlistSimonas Kazlauskas-427/+202
It makes very little sense to maintain denylists of ABIs when, as far as non-generic ABIs are concerned, targets usually only support a small subset of the available ABIs. This has historically been a cause of bugs such as us allowing use of the platform-specific ABIs on x86 targets – these in turn would cause LLVM errors or assertions to fire. Fixes #57182 Sponsored by: standard.ai
2021-06-30Add support for leaf fn frame pointer eliminationSimonas Kazlauskas-33/+89
This PR adds ability for the target specifications to specify frame pointer emission type that's not just “always” or “whatever cg decides”. In particular there's a new mode that allows omission of the frame pointer for leaf functions (those that don't call any other functions). We then set this new mode for Aarch64-based Apple targets. Fixes #86196
2021-06-23Use HTTPS links where possibleSmitty-4/+4
2021-06-21Auto merge of #85775 - adamrk:warn-unused-target-fields, r=nagisabors-86/+151
Emit warnings for unused fields in custom targets. Add a warning which lists any fields in a custom target `json` file that aren't used. Currently unrecognized fields are ignored so, for example, a typo in the `json` will silently produce a target which isn't the one intended.
2021-06-17Emit warnings for unused fields in custom targets.Adam Bratschi-Kaye-86/+151
2021-06-17Auto merge of #83572 - pkubaj:patch-1, r=nagisabors-0/+17
Add support for powerpc64le-unknown-freebsd