about summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec/base/apple
AgeCommit message (Collapse)AuthorLines
2025-09-13Improve the documentation around ZERO_AR_DATEMads Marquart-3/+13
2025-08-11Pass Apple SDK root to compiler driver via SDKROOT env varMads Marquart-22/+2
This is more in-line with what Apple's tooling expects, and allows us to better support custom compiler drivers (such as certain Homebrew and Nixpkgs compilers) that prefer their own `-isysroot` flag. Effectively, we now invoke the compiler driver as-if it was invoked as `xcrun -sdk $sdk_name $tool`.
2025-08-08Add target_env = "macabi" and target_env = "sim"Mads Marquart-20/+29
2025-06-06compiler: set Apple frame pointers by architectureJubilee Young-1/+7
Apple targets can now overriding this configuration and instead use the default based on their architecture, which means aarch64 targets now have less frame pointers in leaf functions.
2025-04-04refactor: Move env parsing of deployment target to rustc_sessionMads Marquart-0/+12
2025-04-04refactor: Move Apple OSVersion (back) to rustc_targetMads Marquart-1/+105
Also convert OSVersion into a proper struct for better type-safety.
2025-03-25Rename `is_like_osx` to `is_like_darwin`Mads Marquart-1/+1
2025-02-17Adds binary_format to rustc target specsPyrode-2/+3
2025-02-14add x86-sse2 (32bit) ABI that requires SSE2 target featureRalf Jung-3/+7
2025-02-08Rustfmtbjorn3-5/+8
2024-12-30explicitly set float ABI for all ARM targetsRalf Jung-2/+3
2024-11-01Move Mach-O platform information to rustc_codegen_ssa::back::appleMads Marquart-18/+1
To align with the general decision to have this sort of information there instead. Also use the visionOS values added in newer `object` release.
2024-11-01Move versioned LLVM target creation to rustc_codegen_ssaMads Marquart-123/+9
The OS version depends on the deployment target environment variables, the access of which we want to move to later in the compilation pipeline that has access to more information, for example `env_depinfo`.
2024-09-29Do not specify an SDK version in object filesMads Marquart-17/+0
This is unnecessary, since it ends up being overwritten when linking anyhow, and it feels wrong to embed some arbitrary SDK version in here.
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-15/+11
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-03Add `warn(unreachable_pub)` to `rustc_target`.Nicholas Nethercote-15/+15
2024-07-29Reformat `use` declarations.Nicholas Nethercote-4/+6
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
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-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-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-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-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
2023-12-12Set the `StackProbeType` in `apple::opts`Josh Stone-2/+11
2023-11-15Add arm64e-apple-ios targetArtyom Tetyukhin-15/+29
2023-11-08targets: move target specs to spec/targetsDavid Wood-1/+1
Signed-off-by: David Wood <david@davidtw.co>
2023-11-08target: move base specs to spec/baseDavid Wood-0/+394
Signed-off-by: David Wood <david@davidtw.co>