about summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec/base
AgeCommit message (Collapse)AuthorLines
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.
2023-12-12Set the `StackProbeType` in `apple::opts`Josh Stone-2/+11
2023-12-07Add emulated TLS supportquininer-4/+6
Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false. This commit has some changes to allow users to enable emutls: 1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key. 2. when using emutls, decorate symbol names to find thread local symbol correctly. 3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls.
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/+1792
Signed-off-by: David Wood <david@davidtw.co>