about summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec
AgeCommit message (Collapse)AuthorLines
2022-06-20Rollup merge of #98225 - bjorn3:stable_target_json_hash, r=nagisaYuki Okushi-25/+99
Make debug_triple depend on target json file content rather than file path This ensures that changes to target json files will force a recompilation. And more importantly that moving the files doesn't force a recompilation. This should fix https://github.com/Rust-for-Linux/linux/issues/792 (cc ``@ojeda)``
2022-06-19Preserve the path of the target spec json file for usage by rustdocbjorn3-8/+76
2022-06-18ENH Move --memory-init-file flag from EmLinker to asmjs target specHood Chatham-5/+5
2022-06-18Make debug_triple depend on target json file content rather than file pathbjorn3-22/+28
This ensures that changes to target json files will force a recompilation. And more importantly that moving the files doesn't force a recompilation.
2022-06-18rustc_target: Remove some redundant target propertiesVadim Petrochenkov-14/+5
2022-06-13Disable `has_thread_local` due to weird issues in some programsMark Drobnak-1/+2
For example, in the following issue the `thread_info` thread-local is not correctly initialized in debug builds: https://github.com/Meziu/ctru-rs/issues/60
2022-06-13Add Apple WatchOS compile targetsVladimir Michael Eatwell-2/+149
2022-06-10Rollup merge of #97928 - hoodmane:emscripten-no-assertions, r=tlivelyMatthias Krüger-9/+1
Removes debug settings from wasm32_unknown_emscripten default link args This is a debug setting. We should only make debug builds if user requests a debug build. Currently this is inserted in release builds. Furthermore, it would be better to insert these settings in --pre-link-args because then it would be possible to override them if appropriate. Because these are inserted at the end, it is necessary to patch emscripten to remove them. ``@sbc100``
2022-06-09Clean upHood Chatham-5/+1
2022-06-09Remove ERROR_ON_UNDEFINED_SYMBOLS according to sbc100's commentsHood Chatham-2/+0
2022-06-09Remove -sASSERTIONS=1 from wasm32_unknown_emscripten default link argsHood Chatham-2/+0
This is a debug setting. We should only make debug builds if user requests a debug build. Currently this is inserted in release builds. Furthermore, it would be better to insert these settings in --pre-link-args because then it would be possible to override them if appropriate. Because these are inserted at the end, it is necessary to patch emscripten to remove them.
2022-06-09Rollup merge of #97843 - overdrivenpotato:psp-lto, r=michaelwoeristerYuki Okushi-6/+18
Relax mipsel-sony-psp's linker script Previously, the linker script forcefully kept all `.lib.stub` sections, unnecessarily bloating the binary. Now, the script is LTO and `--gc-sections` friendly. `--nmagic` was also added to the linker, because page alignment is not required on the PSP. This further reduces binary size. Accompanying changes for the `psp` crate are found in: https://github.com/overdrivenpotato/rust-psp/pull/118
2022-06-07Formatting fixMarko Mijalkovic-4/+2
2022-06-07Relax mipsel-sony-psp's linker scriptMarko Mijalkovic-6/+20
Previously, the linker script forcefully kept all `.lib.stub` sections, unnecessarily bloating the binary. Now, the script is LTO and `--gc-sections` friendly. `--nmagic` was also added to the linker, because page alignment is not required on the PSP. This further reduces binary size. Accompanying changes for the PSP crate are found in: https://github.com/overdrivenpotato/rust-psp/pull/118
2022-06-07Auto merge of #97512 - scottmcm:add-coldcc, r=nagisa,lcnrbors-1/+5
Add support for emitting functions with `coldcc` to LLVM The eventual goal is to try using this for things like the internal panicking stuff, to see whether it helps.
2022-06-05Auto merge of #97577 - betrusted-io:add-xous-target, r=nagisabors-0/+25
riscv32imac-unknown-xous-elf: add target This PR starts the process of upstreaming support for our operating system, thanks to a suggestion from `@yaahc` [on Twitter](https://twitter.com/yaahc_/status/1530558574706839567?s=20&t=Mgkn1LEYvGU6FEi5SpZRsA). We have maintained a fork of Rust and have made changes to improve support for our platform since Rust 1.51. Now we would like to upstream these changes. Xous is a microkernel operating system designed to run on small systems. The kernel contains a wide range of userspace processes that provide common services such as console output, networking, and time access. The kernel and its services are completely written in Rust using a custom build of libstd. This adds support for this target to upstream Rust so that we can drop support for our out-of-tree `target.json` file. This first patch adds a Tier 3 target for Xous running on RISC-V. Future patches will add libstd support, but those patches require changes to `dlmalloc` and `compiler_builtins`. > Tier 3 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 will be the target maintainer for this target on matters that pertain to the `xous` part of the triple. For matters pertaining to the `riscv32imac` part of the triple, there should be no difference from all other `riscv` targets. If there are issues, I will address issues regarding the target. > 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. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target. This is a new OS, so I have taken the `riscv32imac-unknown-none-elf` target and changed the `os` section of the triple. This follows convention on targets such as `riscv32gc-unknown-linux-gnu` and `mipsel-unknown-linux-uclibc`. An argument could be made for omitting the `-elf` section of the triple, such as `riscv32imc-esp-espidf`, however I'm not certain what benefit that has. > Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it. I feel that the target name does not introduce any ambiguity. > 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. The only unusual requirement for building the `compiler-builtins` crate is a standard RISC-V C compiler supported by `cc-rs`, and using this target does not require any additional software beyond what is shipped by `rustup`. > The target must not introduce license incompatibilities. All of the additional code will use Apache-2.0. > Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0). Agreed, and there is no problem here. > 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. The only new dependency will be the `xous` crate, which is licensed `MIT OR Apache-2.0` > 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. Linking is performed by `rust-lld` > "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 terms. Xous is completely open. It runs on open hardware. We even provide the source to the CPU. > 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 paragraph makes sense, but I don't think it's directed at me. > 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. This paragraph also does not appear to be directed at 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. So far we have: * Thread * Mutexex * Condvar * TcpStream * TcpListener * UdpSocket * DateTime * alloc These will be merged as part of libstd in a future patch once I submit support for Xous in `dlmalloc` and `compiler-builtins`. > 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. Testing is currently done on real hardware or in a Renode emulator. I can add documentation on how to do this in a future patch, and I would need instructions on where to add said documentation. > 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. Alright. > 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. Sounds good. > 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. This shouldn't affect any other targets, so this is understood. > 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. This shouldn't come up right away. `xous` is a new operating system, and most features are keyed off of `target(os = "xous")` rather than a given architecture.
2022-06-04riscv32imac-unknown-xous-elf: add targetSean Cross-0/+25
Xous is a microkernel operating system designed to run on small systems. The kernel contains a wide range of userspace processes that provide common services such as console output, networking, and time access. The kernel and its services are completely written in Rust using a custom build of libstd. This adds support for this target to upstream Rust so that we can drop support for our out-of-tree `target.json` file. Add a Tier 3 target for Xous running on RISC-V. Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-03Use serde_json for target spec jsonbjorn3-55/+60
2022-06-03Remove a couple of unused Encodable and Decodable derivesbjorn3-2/+2
2022-05-30Add support for emitting functions with `coldcc` in LLVMScott McMurray-1/+5
The eventual goal is to try using this for things like the internal panicking stuff, to see whether it helps.
2022-05-25Simplify implementation of `-Z gcc-ld`Vadim Petrochenkov-7/+10
- The logic is now unified for all targets (wasm targets should also be supported now) - Additional "symlink" files like `ld64` are eliminated - lld-wrapper is used for propagating the correct lld flavor - Cleanup "unwrap or exit" logic in lld-wrapper
2022-05-13Add LLVM based mingw-w64 targetsMateusz Mikuła-0/+91
2022-04-27Update data layout string for wasm64-unknown-unknownAlex Crichton-1/+1
Looks like this changed in a recent LLVM update but wasm64 isn't built on CI so it wasn't caught until now. Closes #96463
2022-04-18Remove unused macro rulesest31-4/+0
2022-04-03Cleanup after some refactoring in rustc_targetLoïc BRANSTETT-104/+65
2022-04-03Replace LinkArgs with Cow<'static, str>Loïc BRANSTETT-6/+6
2022-04-03Replace every Vec in Target(Options) with it's Cow equivalentLoïc BRANSTETT-50/+105
2022-04-03Replace every `String` in Target(Options) with `Cow<'static, str>`Loïc BRANSTETT-1216/+1216
2022-04-02Rollup merge of #95430 - ChrisDenton:disable-tls-i686-msvc, r=nagisaDylan DPC-0/+2
Disable #[thread_local] support on i686-pc-windows-msvc Fixes #95429
2022-03-30a few mode feedback fixes per @bjorn3Yuri Astrakhan-1/+1
2022-03-30Spellchecking compiler commentsYuri Astrakhan-6/+6
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-29Disable #[thread_local] support on i686-pc-windows-msvcChris Denton-0/+2
2022-03-27Rollup merge of #95341 - Meziu:armv6k-3ds-target, r=nagisaDylan DPC-0/+1
ARMv6K Horizon OS has_thread_local support cc. ```@ian-h-chamberlain``` cc. ```@AzureMarker``` Being an ARM target, it has always had built-in support for `#[thread_local]`. This PR comes in just now because we were testing `std::thread` support with `thread_local_dtor`s. This will hopefully be the last PR for the target specification, unless anymore features will be needed as time goes on.
2022-03-26Merge pull request #16 from ian-h-chamberlain/feature/target-thread-localMeziu-0/+1
Enable #[thread_local] on armv6k-nintendo-3ds
2022-03-26Enable #[thread_local] on armv6k-nintendo-3dsIan Chamberlain-0/+1
2022-03-25Remove hermitkernel targetsMartin Kröning-62/+0
RustyHermit now maintains custom json targets, which are distributed with the kernel. [1] [1]: https://github.com/hermitcore/libhermit-rs/pull/395
2022-03-09Add support for targeting riscv32im-unknown-none-elfridwanabdillahi-0/+27
Update riscv32im-unknown-none-elf to Tier2 support. Downgrade to Tier 3 platform support.
2022-03-05Auto merge of #94601 - csmoe:android-asan, r=nagisabors-7/+10
add address sanitizer fo android We have been being using asan to debug the rust/cpp/c mixed android application in production for months: recompile the rust library with a patched rustc, everything just works fine. The patch is really small thanks to `@nagisa` 's refactoring in https://github.com/rust-lang/rust/pull/81866 r? `@nagisa`
2022-03-04add address sanitizer fo androidcsmoe-7/+10
2022-03-04Add well known values to --check-cfg implementationLoïc BRANSTETT-2/+18
2022-02-23riscv32imc_esp_espidf: set max_atomic_width to 64Scott Mabin-2/+2
2022-02-18Rollup merge of #93814 - Itus-Shield:mips64-openwrt, r=bjorn3Matthias Krüger-1/+1
mips64-openwrt-linux-musl: correct soft-foat MIPS64 targets under OpenWrt require soft-float fpu support. Rust-lang requires soft-float defined in tuple definition and isn't over-ridden by toolchain compile-time CFLAGS/LDFLAGS Set explicit soft-float for tuple. Signed-off-by: Donald Hoskins <grommish@gmail.com>
2022-02-18Rollup merge of #91675 - ivanloz:memtagsan, r=nagisaMatthias Krüger-1/+8
Add MemTagSanitizer Support Add support for the LLVM [MemTagSanitizer](https://llvm.org/docs/MemTagSanitizer.html). On hardware which supports it (see caveats below), the MemTagSanitizer can catch bugs similar to AddressSanitizer and HardwareAddressSanitizer, but with lower overhead. On a tag mismatch, a SIGSEGV is signaled with code SEGV_MTESERR / SEGV_MTEAERR. # Usage `-Zsanitizer=memtag -C target-feature="+mte"` # Comments/Caveats * MemTagSanitizer is only supported on AArch64 targets with hardware support * Requires `-C target-feature="+mte"` * LLVM MemTagSanitizer currently only performs stack tagging. # TODO * Tests * Example
2022-02-17Auto merge of #93577 - nikic:llvm-14, r=nagisabors-5/+6
Upgrade to LLVM 14 LLVM patch state: * [x] https://github.com/llvm/llvm-project/commit/a55727f334b39600bfc71144b11b42aae6b94e0b Backported. * [x] https://github.com/rust-lang/llvm-project/commit/c3c82dc12402dd41441180c0c6cf7aed7e330c53 Backported as https://github.com/llvm/llvm-project/commit/917c47b3bf0dfc45a2a5ba12c1397d647ecf4017. * [x] https://github.com/rust-lang/llvm-project/commit/6e8f9ab632d12271355d10d34c9835a7ba14e4b9 No plan to upstream. * [x] https://github.com/llvm/llvm-project/commit/319f4b2d52e31b000db75a0a2484b5f2ab90534a Backported. * [x] https://github.com/rust-lang/llvm-project/commit/8b2c25d321f877161f85218479e2d1317d770e18 No plan to upstream. * [x] https://github.com/rust-lang/llvm-project/commit/75fef2efd427362c8f16b2d09e6ebf44069e3919 No plan to upstream. * [ ] https://github.com/rust-lang/llvm-project/commit/adef757547de5a570d9f6a00d3e6ac16c666ab79 Upstreamed as https://github.com/llvm/llvm-project/commit/2d2ef384b2f6e723edb793d08f52e7f4dc94ba3a. Needs backport. * [x] https://github.com/rust-lang/llvm-project/commit/4b7c1b4910e9fa9e04f23f06be078e168ef4c0ee No plan to upstream. * [x] https://github.com/rust-lang/llvm-project/commit/3f5ab0c061adb723f25b94243828b6b5407720c8 No plan to upstream. * [x] https://github.com/rust-lang/llvm-project/commit/514d05500e0e15e358f05f5c4cec78a805858f8e No plan to upstream. * [ ] https://github.com/rust-lang/llvm-project/commit/54c586958564582b3341d1838a5de86541e5fecf Under review at https://reviews.llvm.org/D119695 and https://reviews.llvm.org/D119856. Release timeline: * LLVM 14.0.0 final planned for Mar 15. * Rust 1.60.0 planned for Apr 7. Compile-time: * https://perf.rust-lang.org/compare.html?start=250384edc5d78533e993f38c60d64e42b21684b2&end=b87df8d2c7c5d9ac448c585de10927ab2ee1b864 * A slight improvement on average, though no big changes either way. * There are some larger max-rss improvements. r? `@ghost`
2022-02-16Update data layout for wasm32 targetsNikita Popov-3/+4
New address spaces were added in https://reviews.llvm.org/D111154.
2022-02-16Update data layout for 32-bit msvc targetsNikita Popov-2/+2
https://reviews.llvm.org/D115942 changed the alignment of f80.
2022-02-16MemTagSanitizer SupportIvan Lozano-1/+8
Adds support for the LLVM MemTagSanitizer.
2022-02-15Inline Target::derefTomasz Miąsko-0/+2
2022-02-13rustc_target: Remove compiler-rt linking hack on AndroidVadim Petrochenkov-7/+1
2022-02-09mips64-openwrt-linux-musl: correct soft-foatDonald Hoskins-1/+1
MIPS64 targets under OpenWrt require soft-float fpu support. Rust-lang requires soft-float defined in tuple definition and isn't over-ridden by toolchain compile-time CFLAGS/LDFLAGS Set explicit soft-float for tuple. Signed-off-by: Donald Hoskins <grommish@gmail.com>