about summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec/base
AgeCommit message (Collapse)AuthorLines
2024-09-26Move Apple linker args from `rustc_target` to `rustc_codegen_ssa`Mads Marquart-120/+2
They are dependent on the deployment target and SDK version, but having these in `rustc_target` makes it hard to introduce that dependency.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-136/+118
2024-09-12Rollup merge of #129367 - madsmtm:fix-apple-aarch64-deployment-targets, ↵Stuart Cook-2/+8
r=jieyouxu Fix default/minimum deployment target for Aarch64 simulator targets The minimum that `rustc` encoded did not match [the version in Clang](https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L1900-L1932), and that meant that that when linking, Clang ended up bumping the version. See https://github.com/rust-lang/rust/issues/129432 for more motivation behind this change. Specifically, this PR sets the correct deployment target of the following targets: - `aarch64-apple-ios-sim` from 10.0 to 14.0 - `aarch64-apple-tvos-sim` from 10.0 to 14.0 - `aarch64-apple-watchos-sim` from 5.0 to 7.0 - `aarch64-apple-ios-macabi` from 13.1 to 14.0 I have chosen not to document the `-sim` changes in the platform support docs, as it is fundamentally uninteresting; the normal targets (e.g. `aarch64-apple-ios`) still have the same deployment target, and that's what developers should actually target. r? compiler CC `@BlackHoleFox`
2024-09-09Pass deployment target when linking with cc on Apple targetsMads Marquart-1/+29
When linking macOS targets with cc, pass the `-mmacosx-version-min=.` option to specify the desired deployment target. Also, no longer pass `-m32`/`-m64`, these are redundant since we already pass `-arch`. When linking with cc on other Apple targets, always pass `-target`. (We assume for these targets that cc => clang).
2024-09-09Fix default/minimum deployment target for Aarch64 simulator targetsMads Marquart-2/+8
The minimum that `rustc` encoded did not match the version in Clang, and that meant that that when linking, we ended up bumping the version. Specifically, this sets the correct deployment target of the following simulator and Mac Catalyst targets: - `aarch64-apple-ios-sim` from 10.0 to 14.0 - `aarch64-apple-tvos-sim` from 10.0 to 14.0 - `aarch64-apple-watchos-sim` from 5.0 to 7.0 - `aarch64-apple-ios-macabi` from 13.1 to 14.0 I have chosen to not document the simulator target versions in the platform support docs, as it is fundamentally uninteresting; the normal targets (e.g. `aarch64-apple-ios`, `aarch64-apple-tvos`) still have the same deployment target as before, and that's what developers should actually target.
2024-09-05Apple: Add comments for `-platform_version` linker argumentMads Marquart-12/+35
2024-09-05Apple: Refactor deployment target version parsingMads Marquart-137/+134
- Merge minimum OS version list into one function (makes it easier to see the logic in it). - Parse patch deployment target versions. - Consistently specify deployment target in LLVM target (previously omitted on `aarch64-apple-watchos`).
2024-09-05Apple: Improve comments for `-arch` linker argumentMads Marquart-6/+34
2024-09-03Auto merge of #129777 - nnethercote:unreachable_pub-4, r=Urgaubors-52/+52
Add `unreachable_pub`, round 4 A follow-up to #129732. r? `@Urgau`
2024-09-03Add `warn(unreachable_pub)` to `rustc_target`.Nicholas Nethercote-52/+52
2024-09-02chore: Fix typos in 'compiler' (batch 3)Alexander Cyon-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-13/+20
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-16Several fixes to the redox target specsJeremy Soller-1/+3
* Allow crt-static for dylibs * Pass -lgcc to the linker
2024-05-29Add no_std Xtensa targets supportSergio Gasquez-0/+18
2024-05-21Rollup merge of #124772 - madsmtm:apple-platform-support-docs, r=oli-obkMatthias Krüger-0/+5
Refactor documentation for Apple targets Refactor the documentation for Apple targets in `rustc`'s platform support page to make it clear what the supported OS version is and which environment variables are being read (`*_DEPLOYMENT_TARGET` and `SDKROOT`). This fixes https://github.com/rust-lang/rust/issues/124215. Note that I've expanded the `aarch64-apple-ios-sim` maintainers `@badboy` and `@deg4uss3r` to include being maintainer of all `*-apple-ios-*` targets. If you do not wish to be so, please state that, then I'll explicitly note that in the docs. Additionally, I've added myself as co-maintainer of most of these targets. r? `@thomcc` I think the documentation you've previously written on tvOS is great, have mostly modified it to have a more consistent formatting with the rest of the Apple target. I recognize that there's quite a few changes here, feel free to ask about any of them! --- CC `@simlay` `@Nilstrieb` `@rustbot` label O-apple
2024-05-11Auto merge of #124762 - madsmtm:refactor-apple-target-abi, r=lcnr,BlackHoleFoxbors-41/+42
Refactor Apple `target_abi` This was bundled together with `Arch`, which complicated a few code paths and meant we had to do more string matching than necessary. CC `@BlackHoleFox` as you've worked on the Apple target spec before Related: Is there a reason why `Target`/`TargetOptions` use `StaticCow` for so many things, instead of an enum with defined values (and perhaps a catch-all case for custom target json files)? Tagging `@Nilstrieb,` as you might know?
2024-05-11Rollup merge of #124233 - mati865:fix-support-for-upcoming-mingw-w64, ↵许杰友 Jieyou Xu (Joe)-0/+3
r=petrochenkov Add `-lmingwex` second time in `mingw_libs` Upcoming mingw-w64 releases will contain small math functions refactor which moved implementation around. As a result functions like `lgamma` now depend on libraries in this order: `libmingwex.a` -> `libmsvcrt.a` -> `libmingwex.a`. Fixes #124221
2024-05-05Document all Apple targets in rustc's platform supportMads Marquart-0/+5
- Fixed std support in top-level docs. - Added `*-apple-darwin` docs. - Added `i686-apple-darwin` docs. - Moved `aarch64-apple-ios-sim` to `*-apple-ios` and document all the iOS targets there. - Added `*-apple-ios-macabi` docs. - Add myself (madsmtm) as co-maintainer of most of these targets.
2024-05-05Refactor Apple `target_abi`Mads Marquart-41/+42
This was bundled together with `Arch`, which complicated a few code paths and meant we had to do more string matching than necessary.
2024-05-03Set non-leaf frame pointers on Fuchsia targetsDavid Koloski-1/+4
2024-04-21Add `-lmingwex` second time in `mingw_libs`Mateusz Mikuła-0/+3
Upcoming mingw-w64 releases will contain small math functions refactor which moved implementation around. As a result functions like `lgamma` now depend on libraries in this order: `libmingwex.a` -> `libmsvcrt.a` -> `libmingwex.a`. Fixes #124221
2024-04-16Remove `default_hidden_visibility: false` from wasm targetsAlex Crichton-3/+0
To the best of my ability I believe that this is no longer necessary. I don't fully recall why this was first added but I believe it had to do with symbols all being exported by default and this was required to undo that. Regardless nowadays the default output of rustc seems suitable so it seems best to keep wasm in line with other targets.
2024-04-10Allow specifying SDKROOT as containing XRSimulator.platformMads Marquart-0/+1
Checking this was missing from the `link_env_remove` function, so compilation might fail if set when compiling for macOS
2024-04-07Rollup merge of #123446 - crazytonyli:fix-watchos-llvm-target, r=estebankMatthias Krüger-0/+5
Fix incorrect 'llvm_target' value used on watchOS target ## Issue `xcodebuild -create-xcframework` command doesn't recognize static libraries that are built on "arm64_32-apple-watchos" target. Here are steps to reproduce the issue on a Mac: 1. Install nightly toolchain `nightly-2024-03-27`. Needs this specific version, because newer nightly versions are broken on watchos target. 1. Create an empty library: `mkdir watchos-lib && cd watchos-lib && cargo init --lib`. 1. Add configuration `lib.crate-type=["staticlib"]` to Cargo.toml. 1. Build the library: `cargo +nightly-2024-03-27 build --release -Zbuild-std --target arm64_32-apple-watchos` 1. Run `xcodebuild -create-xcframework` to put the static library into a xcframework, which results in an error: ``` $ xcodebuild -create-xcframework -library target/arm64_32-apple-watchos/release/libwatchos_lib.a -output test.xcframework error: unable to determine the platform for the given binary '.../watchos-lib/target/arm64_32-apple-watchos/release/libwatchos_lib.a'; check your deployment version settings ``` ## Fix The root cause of this error is `xcodebuild` couldn't read `LC_BUILD_VERSION` from the static library to determine the library's target platform. And the reason it's missing is that an incorrect `llvm_target` value is used in `arm64_32-apple-watchos` target. The expected value is `<arch>-apple-watchos<major>.<minor>.0`, i.e. "arm64_32-apple-watchos8.0.0". The [.../apple/mod.rs](https://github.com/rust-lang/rust/blob/43f4f2a3b1a3d3fb3dbbbe4fde33fb97c780ee98/compiler/rustc_target/src/spec/base/apple/mod.rs#L321) file contains functions that construct such string. There is an existing function `watchos_sim_llvm_target` which returns llvm target value for watchOS simulator. But there is none for watchOS device. This PR adds that missing function to align watchOS with other Apple platform targets. To verify the fix, you can simply build a toolchain on this PR branch and repeat the steps above using the built local toolchain to verify the `xcodebuild -create-xcframework` command can create a xcframework successfully. Furthermore, you can verify `LC_BUILD_VERSION` contains correct info by using the simple shell script below to print `LC_BUILD_VERSION` of the static library that's built on watchos target: ```shell bin=target/arm64_32-apple-watchos/release/libwatchos_lib.a file=$(ar -t "$bin" | grep -E '\.o$' | head -n 1) ar -x "$bin" "$file" vtool -show-build-version "$file" ``` Here is an example output from my machine: ``` watchos_rust-495d6aaf3bccc08d.watchos_rust.35ba42bf9255ca9d-cgu.0.rcgu.o: Load command 1 cmd LC_BUILD_VERSION cmdsize 24 platform WATCHOS minos 8.0 sdk n/a ntools 0 ```
2024-04-06Rollup merge of #123467 - dpaoliello:archcoff, r=wesleywiserMatthias Krüger-0/+1
MSVC targets should use COFF as their archive format While adding support for Arm64EC I ran into an issue where the standard library's rlib was missing the "EC Symbol Table" which is required for the MSVC linker to find import library symbols (generated by Rust's `raw-dylib` feature) when building for EC. The root cause of the issue is that LLVM only generated symbol tables (including the EC Symbol Table) if the `ArchiveKind` is `COFF`, but the MSVC targets didn't set their archive format, so it was defaulting to GNU.
2024-04-04MSVC targets should use COFF as their archive formatDaniel Paoliello-0/+1
2024-04-04Fix incorrect 'llvm_target' value used on watchOS targetTony Li-0/+5
The expected value is "<arch>-apple-watchos<major>.<minor>.0", i.e. "arm64_32-apple-watchos8.0.0". compiler/rustc_target/src/spec/base/apple/mod.rs contains functions that construct such string. There is an existing function `watchos_sim_llvm_target` which returns llvm target value for watchOS simulator. But there is none for watchOS device. This commit adds that missing function to align watchOS with other Apple platform targets.
2024-04-02Updated commentsAdam Gastineau-2/+2
2024-03-23Fixed builds with modified libcAdam Gastineau-4/+4
2024-03-19Fix test formattingAdam Gastineau-1/+5
2024-03-19Fixed VISIONOS_DEPLOYMENT_TARGET envar testAdam Gastineau-3/+3
2024-03-18Support for visionOSAdam Gastineau-2/+28
2024-03-11Update /NODEFAUTLIB comment for msvcChris Denton-8/+12
2024-03-10Add metadata to targetsNilstrieb-1/+6
This adds four pieces of metadata to every target: - description - tier - host tools - std This information is currently scattered across target docs and both - not machine readable, making validation harder - sometimes subtly encoding by the table it's in, causing mistakes and making it harder to review changes to the properties By putting it in the compiler, we improve this. Later, we will use this canonical information to generate target documentation from it.
2024-03-05Add a `description` field to target definitionsNilstrieb-0/+1
This is the short description (`64-bit MinGW (Windows 7+)`) including the platform requirements. The reason for doing it like this is that this PR will be quite prone to conflicts whenever targets get added, so it should be as simple as possible to get it merged. Future PRs which migrate targets are scoped to groups of targets, so they will not conflict as they can just touch these. This moves some of the information from the rustc book into the compiler. It cannot be queried yet, that is future work. It is also future work to fill out all the descriptions, which will coincide with the work of moving over existing target docs to the new format.
2024-02-24compiler/rustc_target/src/spec/base/apple/tests.rs: Avoid unnecessary large moveMartin Nordholts-1/+1
Fixes: $ MAGIC_EXTRA_RUSTFLAGS=-Zmove-size-limit=4096 ./x test compiler/rustc_target error: moving 6216 bytes --> compiler/rustc_target/src/spec/base/apple/tests.rs:17:19 | 17 | for target in all_sim_targets { | ^^^^^^^^^^^^^^^ value moved from here | = note: The current maximum size is 4096, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` = note: `-D large-assignments` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(large_assignments)]`
2024-02-19Lower default Mac Catalyst deployment target to 13.1Mads Marquart-1/+2
Same default as Clang: https://github.com/llvm/llvm-project/blob/d022f32c73c57b59a9121eba909f5034e89c628e/clang/lib/Driver/ToolChains/Darwin.cpp#L2038
2024-02-19Merge deployment target variable loading on iOS and Mac CatalystMads Marquart-26/+21
2024-02-19Fix ld platform_version argument on Mac CatalystMads Marquart-29/+13
2024-02-19Make LLVM target contain correct deployment target info on Mac CatalystMads Marquart-4/+17
2024-02-19Remove MACOSX_DEPLOYMENT_TARGET env var when linking Mac CatalystMads Marquart-10/+4
Mac Catalyst uses IPHONEOS_DEPLOYMENT_TARGET to specify the deployment target, so it makes no sense to remove that variable.
2024-02-17Fix commentMads Marquart-2/+0
2024-02-17Fix `cfg(target_abi = "sim")` on i386-apple-iosMads Marquart-7/+8
i386-apple-ios is also a simulator target
2024-01-25Rollup merge of #120278 - djkoloski:remove_fatal_warnings_wasm, r=oli-obkMatthias Krüger-3/+0
Remove --fatal-warnings on wasm targets These were added with good intentions, but a recent change in LLVM 18 emits a warning while examining .rmeta sections in .rlib files. Since this flag is a nice-to-have and users can update their LLVM linker independently of rustc's LLVM version, we can just omit the flag. See [this comment on wasm targets' uses of `--fatal-warnings`](https://github.com/llvm/llvm-project/pull/78658#issuecomment-1906651390).
2024-01-23Remove --fatal-warnings on wasm targetsDavid Koloski-3/+0
These were added with good intentions, but a recent change in LLVM 18 emits a warning while examining .rmeta sections in .rlib files. Since this flag is a nice-to-have and users can update their LLVM linker independently of rustc's LLVM version, we can just omit the flag.
2024-01-22compiler: update freebsd and netbsd base specs.David Carlier-0/+3
both support thread local.
2024-01-17Rollup merge of #119855 - rellerreller:freebsd-static, r=wesleywiserMatthias Krüger-0/+1
Enable Static Builds for FreeBSD Enable crt-static for FreeBSD to enable statically compiled binaries.
2024-01-12update paths in commentsjoboet-1/+1
2024-01-11Enable Static Builds for FreeBSDNathan Reller-0/+1
Enable crt-static for FreeBSD to enable statically compiled binaries.
2023-12-14Auto merge of #118491 - cuviper:aarch64-stack-probes, r=wesleywiserbors-2/+11
Enable stack probes on aarch64 for LLVM 18 I tested this on `aarch64-unknown-linux-gnu` with LLVM main (~18). cc #77071, to be closed once we upgrade our LLVM submodule.