Add vendor to Fuchsia's target triple

Historically, Rust's Fuchsia targets have been labeled x86_64-fuchsia
and aarch64-fuchsia. However, they should technically contain vendor
information. This CL changes Fuchsia's target triples to include the
"unknown" vendor since Clang now does normalization and handles all
triple spellings.

This was previously attempted in #90510, which was closed due to
inactivity.
This commit is contained in:
David Koloski 2023-01-03 15:59:21 -05:00
parent e94fab69d0
commit f6ef039775
14 changed files with 89 additions and 89 deletions

View File

@ -2,7 +2,7 @@
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-fuchsia".into(), llvm_target: "aarch64-unknown-fuchsia".into(),
pointer_width: 64, pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),

View File

@ -1109,8 +1109,8 @@ fn $module() {
("x86_64-apple-darwin", x86_64_apple_darwin), ("x86_64-apple-darwin", x86_64_apple_darwin),
("i686-apple-darwin", i686_apple_darwin), ("i686-apple-darwin", i686_apple_darwin),
("aarch64-fuchsia", aarch64_fuchsia), ("aarch64-unknown-fuchsia", aarch64_unknown_fuchsia),
("x86_64-fuchsia", x86_64_fuchsia), ("x86_64-unknown-fuchsia", x86_64_unknown_fuchsia),
("avr-unknown-gnu-atmega328", avr_unknown_gnu_atmega328), ("avr-unknown-gnu-atmega328", avr_unknown_gnu_atmega328),

View File

@ -8,7 +8,7 @@ pub fn target() -> Target {
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI; base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
Target { Target {
llvm_target: "x86_64-fuchsia".into(), llvm_target: "x86_64-unknown-fuchsia".into(),
pointer_width: 64, pointer_width: 64,
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
.into(), .into(),

View File

@ -1085,12 +1085,12 @@ fn supported_sanitizers(
match &*target.triple { match &*target.triple {
"aarch64-apple-darwin" => darwin_libs("osx", &["asan", "lsan", "tsan"]), "aarch64-apple-darwin" => darwin_libs("osx", &["asan", "lsan", "tsan"]),
"aarch64-fuchsia" => common_libs("fuchsia", "aarch64", &["asan"]), "aarch64-unknown-fuchsia" => common_libs("fuchsia", "aarch64", &["asan"]),
"aarch64-unknown-linux-gnu" => { "aarch64-unknown-linux-gnu" => {
common_libs("linux", "aarch64", &["asan", "lsan", "msan", "tsan", "hwasan"]) common_libs("linux", "aarch64", &["asan", "lsan", "msan", "tsan", "hwasan"])
} }
"x86_64-apple-darwin" => darwin_libs("osx", &["asan", "lsan", "tsan"]), "x86_64-apple-darwin" => darwin_libs("osx", &["asan", "lsan", "tsan"]),
"x86_64-fuchsia" => common_libs("fuchsia", "x86_64", &["asan"]), "x86_64-unknown-fuchsia" => common_libs("fuchsia", "x86_64", &["asan"]),
"x86_64-unknown-freebsd" => common_libs("freebsd", "x86_64", &["asan", "msan", "tsan"]), "x86_64-unknown-freebsd" => common_libs("freebsd", "x86_64", &["asan", "msan", "tsan"]),
"x86_64-unknown-netbsd" => { "x86_64-unknown-netbsd" => {
common_libs("netbsd", "x86_64", &["asan", "lsan", "msan", "tsan"]) common_libs("netbsd", "x86_64", &["asan", "lsan", "msan", "tsan"])

View File

@ -30,18 +30,18 @@ RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7
RUN add-apt-repository -y 'deb https://apt.dilos.org/dilos dilos2 main' RUN add-apt-repository -y 'deb https://apt.dilos.org/dilos dilos2 main'
ENV \ ENV \
AR_x86_64_fuchsia=x86_64-fuchsia-ar \ AR_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-ar \
CC_x86_64_fuchsia=x86_64-fuchsia-clang \ CC_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang \
CFLAGS_x86_64_fuchsia="--target=x86_64-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \ CFLAGS_x86_64_unknown_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \
CXX_x86_64_fuchsia=x86_64-fuchsia-clang++ \ CXX_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang++ \
CXXFLAGS_x86_64_fuchsia="--target=x86_64-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \ CXXFLAGS_x86_64_unknown_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \
LDFLAGS_x86_64_fuchsia="--target=x86_64-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -L/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/lib" \ LDFLAGS_x86_64_unknown_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -L/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/lib" \
AR_aarch64_fuchsia=aarch64-fuchsia-ar \ AR_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-ar \
CC_aarch64_fuchsia=aarch64-fuchsia-clang \ CC_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang \
CFLAGS_aarch64_fuchsia="--target=aarch64-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \ CFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \
CXX_aarch64_fuchsia=aarch64-fuchsia-clang++ \ CXX_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang++ \
CXXFLAGS_aarch64_fuchsia="--target=aarch64-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \ CXXFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \
LDFLAGS_aarch64_fuchsia="--target=aarch64-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -L/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/lib" \ LDFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -L/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/lib" \
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \ AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \ CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \ CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
@ -99,19 +99,19 @@ RUN /tmp/freebsd-toolchain.sh i686
COPY scripts/sccache.sh /scripts/ COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh RUN sh /scripts/sccache.sh
ENV CARGO_TARGET_X86_64_FUCHSIA_AR /usr/local/bin/llvm-ar ENV CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_AR /usr/local/bin/llvm-ar
ENV CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS \ ENV CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_RUSTFLAGS \
-C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot \ -C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot \
-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot/lib \ -Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot/lib \
-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/lib -Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/lib
ENV CARGO_TARGET_AARCH64_FUCHSIA_AR /usr/local/bin/llvm-ar ENV CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_AR /usr/local/bin/llvm-ar
ENV CARGO_TARGET_AARCH64_FUCHSIA_RUSTFLAGS \ ENV CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_RUSTFLAGS \
-C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot \ -C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot \
-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot/lib \ -Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot/lib \
-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/lib -Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/lib
ENV TARGETS=x86_64-fuchsia ENV TARGETS=x86_64-unknown-fuchsia
ENV TARGETS=$TARGETS,aarch64-fuchsia ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
ENV TARGETS=$TARGETS,wasm32-unknown-unknown ENV TARGETS=$TARGETS,wasm32-unknown-unknown
ENV TARGETS=$TARGETS,wasm32-wasi ENV TARGETS=$TARGETS,wasm32-wasi
ENV TARGETS=$TARGETS,sparcv9-sun-solaris ENV TARGETS=$TARGETS,sparcv9-sun-solaris

View File

@ -29,9 +29,9 @@ install_clang() {
# CFLAGS and CXXFLAGS env variables in main Dockerfile handle sysroot linking # CFLAGS and CXXFLAGS env variables in main Dockerfile handle sysroot linking
for arch in x86_64 aarch64; do for arch in x86_64 aarch64; do
for tool in clang clang++; do for tool in clang clang++; do
ln -s /usr/local/bin/${tool} /usr/local/bin/${arch}-fuchsia-${tool} ln -s /usr/local/bin/${tool} /usr/local/bin/${arch}-unknown-fuchsia-${tool}
done done
ln -s /usr/local/bin/llvm-ar /usr/local/bin/${arch}-fuchsia-ar ln -s /usr/local/bin/llvm-ar /usr/local/bin/${arch}-unknown-fuchsia-ar
done done
popd > /dev/null popd > /dev/null

View File

@ -4,7 +4,7 @@
The Rust toolchain test runner for Fuchsia. The Rust toolchain test runner for Fuchsia.
For instructions on running the compiler test suite, see For instructions on running the compiler test suite, see
https://doc.rust-lang.org/stable/rustc/platform-support/fuchsia.html#aarch64-fuchsia-and-x86_64-fuchsia https://doc.rust-lang.org/stable/rustc/platform-support/fuchsia.html#aarch64-unknown-fuchsia-and-x86_64-unknown-fuchsia
""" """
import argparse import argparse
@ -110,9 +110,9 @@ class TestEnvironment:
def rustlib_dir(self): def rustlib_dir(self):
if self.target_arch == "x64": if self.target_arch == "x64":
return "x86_64-fuchsia" return "x86_64-unknown-fuchsia"
if self.target_arch == "arm64": if self.target_arch == "arm64":
return "aarch64-fuchsia" return "aarch64-unknown-fuchsia"
raise Exception(f"Unrecognized target architecture {self.target_arch}") raise Exception(f"Unrecognized target architecture {self.target_arch}")
def libs_dir(self): def libs_dir(self):

View File

@ -26,7 +26,7 @@
- [armv7-unknown-linux-uclibceabi](platform-support/armv7-unknown-linux-uclibceabi.md) - [armv7-unknown-linux-uclibceabi](platform-support/armv7-unknown-linux-uclibceabi.md)
- [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md) - [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md)
- [\*-android and \*-androideabi](platform-support/android.md) - [\*-android and \*-androideabi](platform-support/android.md)
- [\*-fuchsia](platform-support/fuchsia.md) - [\*-unknown-fuchsia](platform-support/fuchsia.md)
- [\*-kmc-solid_\*](platform-support/kmc-solid.md) - [\*-kmc-solid_\*](platform-support/kmc-solid.md)
- [m68k-unknown-linux-gnu](platform-support/m68k-unknown-linux-gnu.md) - [m68k-unknown-linux-gnu](platform-support/m68k-unknown-linux-gnu.md)
- [mips64-openwrt-linux-musl](platform-support/mips64-openwrt-linux-musl.md) - [mips64-openwrt-linux-musl](platform-support/mips64-openwrt-linux-musl.md)

View File

@ -124,7 +124,7 @@ target | std | notes
-------|:---:|------- -------|:---:|-------
`aarch64-apple-ios` | ✓ | ARM64 iOS `aarch64-apple-ios` | ✓ | ARM64 iOS
[`aarch64-apple-ios-sim`](platform-support/aarch64-apple-ios-sim.md) | ✓ | Apple iOS Simulator on ARM64 [`aarch64-apple-ios-sim`](platform-support/aarch64-apple-ios-sim.md) | ✓ | Apple iOS Simulator on ARM64
`aarch64-fuchsia` | ✓ | ARM64 Fuchsia `aarch64-unknown-fuchsia` | ✓ | ARM64 Fuchsia
[`aarch64-linux-android`](platform-support/android.md) | ✓ | ARM64 Android [`aarch64-linux-android`](platform-support/android.md) | ✓ | ARM64 Android
`aarch64-unknown-none-softfloat` | * | Bare ARM64, softfloat `aarch64-unknown-none-softfloat` | * | Bare ARM64, softfloat
`aarch64-unknown-none` | * | Bare ARM64, hardfloat `aarch64-unknown-none` | * | Bare ARM64, hardfloat
@ -177,7 +177,7 @@ target | std | notes
`wasm32-wasi` | ✓ | WebAssembly with WASI `wasm32-wasi` | ✓ | WebAssembly with WASI
`x86_64-apple-ios` | ✓ | 64-bit x86 iOS `x86_64-apple-ios` | ✓ | 64-bit x86 iOS
[`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX [`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX
`x86_64-fuchsia` | ✓ | 64-bit Fuchsia `x86_64-unknown-fuchsia` | ✓ | 64-bit Fuchsia
[`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android [`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android
`x86_64-pc-solaris` | ✓ | 64-bit Solaris 10/11, illumos `x86_64-pc-solaris` | ✓ | 64-bit Solaris 10/11, illumos
`x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27) `x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)

View File

@ -1,4 +1,4 @@
# `aarch64-fuchsia` and `x86_64-fuchsia` # `aarch64-unknown-fuchsia` and `x86_64-unknown-fuchsia`
**Tier: 2** **Tier: 2**
@ -67,7 +67,7 @@ This walkthrough will cover:
1. Building a Fuchsia package. 1. Building a Fuchsia package.
1. Publishing and running a Fuchsia package to a Fuchsia emulator. 1. Publishing and running a Fuchsia package to a Fuchsia emulator.
For the purposes of this walkthrough, we will only target `x86_64-fuchsia`. For the purposes of this walkthrough, we will only target `x86_64-unknown-fuchsia`.
## Compiling a Rust binary targeting Fuchsia ## Compiling a Rust binary targeting Fuchsia
@ -83,8 +83,8 @@ to handle the installation of Fuchsia targets for you. This can be done by issui
the following commands: the following commands:
```sh ```sh
rustup target add x86_64-fuchsia rustup target add x86_64-unknown-fuchsia
rustup target add aarch64-fuchsia rustup target add aarch64-unknown-fuchsia
``` ```
After installing our Fuchsia targets, we can now compile a Rust binary that targets After installing our Fuchsia targets, we can now compile a Rust binary that targets
@ -127,7 +127,7 @@ during compilation:
**`.cargo/config.toml`** **`.cargo/config.toml`**
```txt ```txt
[target.x86_64-fuchsia] [target.x86_64-unknown-fuchsia]
rustflags = [ rustflags = [
"-Lnative=<SDK_PATH>/arch/x64/lib", "-Lnative=<SDK_PATH>/arch/x64/lib",
@ -159,10 +159,10 @@ hello_fuchsia/
Finally, we can build our rust binary as: Finally, we can build our rust binary as:
```sh ```sh
cargo build --target x86_64-fuchsia cargo build --target x86_64-unknown-fuchsia
``` ```
Now we have a Rust binary at `target/x86_64-fuchsia/debug/hello_fuchsia`, Now we have a Rust binary at `target/x86_64-unknown-fuchsia/debug/hello_fuchsia`,
targeting our desired Fuchsia target. targeting our desired Fuchsia target.
**Current directory structure** **Current directory structure**
@ -171,7 +171,7 @@ hello_fuchsia/
┣━ src/ ┣━ src/
┃ ┗━ main.rs ┃ ┗━ main.rs
┣━ target/ ┣━ target/
┃ ┗━ x86_64-fuchsia/ ┃ ┗━ x86_64-unknown-fuchsia/
┃ ┗━ debug/ ┃ ┗━ debug/
┃ ┗━ hello_fuchsia ┃ ┗━ hello_fuchsia
┣━ Cargo.toml ┣━ Cargo.toml
@ -193,7 +193,7 @@ configuration in `config.toml`:
```toml ```toml
[build] [build]
target = ["<host_platform>", "aarch64-fuchsia", "x86_64-fuchsia"] target = ["<host_platform>", "aarch64-unknown-fuchsia", "x86_64-unknown-fuchsia"]
[rust] [rust]
lld = true lld = true
@ -201,11 +201,11 @@ lld = true
[llvm] [llvm]
download-ci-llvm = false download-ci-llvm = false
[target.x86_64-fuchsia] [target.x86_64-unknown-fuchsia]
cc = "clang" cc = "clang"
cxx = "clang++" cxx = "clang++"
[target.aarch64-fuchsia] [target.aarch64-unknown-fuchsia]
cc = "clang" cc = "clang"
cxx = "clang++" cxx = "clang++"
``` ```
@ -236,14 +236,14 @@ a script we name `config-env.sh`:
# Configure this environment variable to be the path to the downloaded SDK # Configure this environment variable to be the path to the downloaded SDK
export SDK_PATH="<SDK path goes here>" export SDK_PATH="<SDK path goes here>"
export CFLAGS_aarch64_fuchsia="--target=aarch64-fuchsia --sysroot=${SDK_PATH}/arch/arm64/sysroot -I${SDK_PATH}/pkg/fdio/include" export CFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=${SDK_PATH}/arch/arm64/sysroot -I${SDK_PATH}/pkg/fdio/include"
export CXXFLAGS_aarch64_fuchsia="--target=aarch64-fuchsia --sysroot=${SDK_PATH}/arch/arm64/sysroot -I${SDK_PATH}/pkg/fdio/include" export CXXFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=${SDK_PATH}/arch/arm64/sysroot -I${SDK_PATH}/pkg/fdio/include"
export LDFLAGS_aarch64_fuchsia="--target=aarch64-fuchsia --sysroot=${SDK_PATH}/arch/arm64/sysroot -L${SDK_PATH}/arch/arm64/lib" export LDFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=${SDK_PATH}/arch/arm64/sysroot -L${SDK_PATH}/arch/arm64/lib"
export CARGO_TARGET_AARCH64_FUCHSIA_RUSTFLAGS="-C link-arg=--sysroot=${SDK_PATH}/arch/arm64/sysroot -Lnative=${SDK_PATH}/arch/arm64/sysroot/lib -Lnative=${SDK_PATH}/arch/arm64/lib" export CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_RUSTFLAGS="-C link-arg=--sysroot=${SDK_PATH}/arch/arm64/sysroot -Lnative=${SDK_PATH}/arch/arm64/sysroot/lib -Lnative=${SDK_PATH}/arch/arm64/lib"
export CFLAGS_x86_64_fuchsia="--target=x86_64-fuchsia --sysroot=${SDK_PATH}/arch/x64/sysroot -I${SDK_PATH}/pkg/fdio/include" export CFLAGS_x86_64_unknown_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=${SDK_PATH}/arch/x64/sysroot -I${SDK_PATH}/pkg/fdio/include"
export CXXFLAGS_x86_64_fuchsia="--target=x86_64-fuchsia --sysroot=${SDK_PATH}/arch/x64/sysroot -I${SDK_PATH}/pkg/fdio/include" export CXXFLAGS_x86_64_unknown_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=${SDK_PATH}/arch/x64/sysroot -I${SDK_PATH}/pkg/fdio/include"
export LDFLAGS_x86_64_fuchsia="--target=x86_64-fuchsia --sysroot=${SDK_PATH}/arch/x64/sysroot -L${SDK_PATH}/arch/x64/lib" export LDFLAGS_x86_64_unknown_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=${SDK_PATH}/arch/x64/sysroot -L${SDK_PATH}/arch/x64/lib"
export CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS="-C link-arg=--sysroot=${SDK_PATH}/arch/x64/sysroot -Lnative=${SDK_PATH}/arch/x64/sysroot/lib -Lnative=${SDK_PATH}/arch/x64/lib" export CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_RUSTFLAGS="-C link-arg=--sysroot=${SDK_PATH}/arch/x64/sysroot -Lnative=${SDK_PATH}/arch/x64/sysroot/lib -Lnative=${SDK_PATH}/arch/x64/lib"
``` ```
Finally, the Rust compiler can be built and installed: Finally, the Rust compiler can be built and installed:
@ -288,7 +288,7 @@ hello_fuchsia/
Using your freshly installed `rustc`, you can compile a binary for Fuchsia using Using your freshly installed `rustc`, you can compile a binary for Fuchsia using
the following options: the following options:
* `--target x86_64-fuchsia`/`--target aarch64-fuchsia`: Targets the Fuchsia * `--target x86_64-unknown-fuchsia`/`--target aarch64-unknown-fuchsia`: Targets the Fuchsia
platform of your choice platform of your choice
* `-Lnative ${SDK_PATH}/arch/${ARCH}/lib`: Link against Fuchsia libraries from * `-Lnative ${SDK_PATH}/arch/${ARCH}/lib`: Link against Fuchsia libraries from
the SDK the SDK
@ -299,7 +299,7 @@ Putting it all together:
```sh ```sh
# Configure these for the Fuchsia target of your choice # Configure these for the Fuchsia target of your choice
TARGET_ARCH="<x86_64-fuchsia|aarch64-fuchsia>" TARGET_ARCH="<x86_64-unknown-fuchsia|aarch64-unknown-fuchsia>"
ARCH="<x64|aarch64>" ARCH="<x64|aarch64>"
rustc \ rustc \
@ -325,16 +325,16 @@ Before moving on, double check your directory structure:
**Current directory structure** **Current directory structure**
```txt ```txt
hello_fuchsia/ hello_fuchsia/
┣━ src/ (if using rustc) ┣━ src/ (if using rustc)
┃ ┗━ hello_fuchsia.rs ... ┃ ┗━ hello_fuchsia.rs ...
┣━ bin/ ... ┣━ bin/ ...
┃ ┗━ hello_fuchsia ... ┃ ┗━ hello_fuchsia ...
┣━ src/ (if using cargo) ┣━ src/ (if using cargo)
┃ ┗━ main.rs ... ┃ ┗━ main.rs ...
┗━ target/ ... ┗━ target/ ...
┗━ x86_64-fuchsia/ ... ┗━ x86_64-unknown-fuchsia/ ...
┗━ debug/ ... ┗━ debug/ ...
┗━ hello_fuchsia ... ┗━ hello_fuchsia ...
``` ```
With our Rust binary built, we can move to creating a Fuchsia package. With our Rust binary built, we can move to creating a Fuchsia package.
@ -371,7 +371,7 @@ package must contain one.
**`pkg/hello_fuchsia.manifest` if using cargo** **`pkg/hello_fuchsia.manifest` if using cargo**
```txt ```txt
bin/hello_fuchsia=target/x86_64-fuchsia/debug/hello_fuchsia bin/hello_fuchsia=target/x86_64-unknown-fuchsia/debug/hello_fuchsia
lib/ld.so.1=<SDK_PATH>/arch/x64/sysroot/dist/lib/ld.so.1 lib/ld.so.1=<SDK_PATH>/arch/x64/sysroot/dist/lib/ld.so.1
lib/libfdio.so=<SDK_PATH>/arch/x64/dist/libfdio.so lib/libfdio.so=<SDK_PATH>/arch/x64/dist/libfdio.so
meta/package=pkg/meta/package meta/package=pkg/meta/package
@ -546,16 +546,16 @@ structure will look like:
**Final directory structure** **Final directory structure**
```txt ```txt
hello_fuchsia/ hello_fuchsia/
┣━ src/ (if using rustc) ┣━ src/ (if using rustc)
┃ ┗━ hello_fuchsia.rs ... ┃ ┗━ hello_fuchsia.rs ...
┣━ bin/ ... ┣━ bin/ ...
┃ ┗━ hello_fuchsia ... ┃ ┗━ hello_fuchsia ...
┣━ src/ (if using cargo) ┣━ src/ (if using cargo)
┃ ┗━ main.rs ... ┃ ┗━ main.rs ...
┣━ target/ ... ┣━ target/ ...
┃ ┗━ x86_64-fuchsia/ ... ┃ ┗━ x86_64-unknown-fuchsia/ ...
┃ ┗━ debug/ ... ┃ ┗━ debug/ ...
┃ ┗━ hello_fuchsia ... ┃ ┗━ hello_fuchsia ...
┗━ pkg/ ┗━ pkg/
┣━ meta/ ┣━ meta/
┃ ┣━ package ┃ ┣━ package
@ -644,8 +644,8 @@ Tests can be run in the same way as a regular binary.
* If using `cargo`, you can simply pass `test --no-run` * If using `cargo`, you can simply pass `test --no-run`
to the `cargo` invocation and then repackage and rerun the Fuchsia package. From our previous example, to the `cargo` invocation and then repackage and rerun the Fuchsia package. From our previous example,
this would look like `cargo test --target x86_64-fuchsia --no-run`, and moving the executable this would look like `cargo test --target x86_64-unknown-fuchsia --no-run`, and moving the executable
binary path found from the line `Executable unittests src/main.rs (target/x86_64-fuchsia/debug/deps/hello_fuchsia-<HASH>)` binary path found from the line `Executable unittests src/main.rs (target/x86_64-unknown-fuchsia/debug/deps/hello_fuchsia-<HASH>)`
into `pkg/hello_fuchsia.manifest`. into `pkg/hello_fuchsia.manifest`.
* If using the compiled `rustc`, you can simply pass `--test` * If using the compiled `rustc`, you can simply pass `--test`
@ -714,7 +714,7 @@ run the full `src/test/ui` test suite:
--config config.toml \ --config config.toml \
--stage=2 \ --stage=2 \
test src/test/ui \ test src/test/ui \
--target x86_64-fuchsia \ --target x86_64-unknown-fuchsia \
--run=always --jobs 1 \ --run=always --jobs 1 \
--test-args --target-rustcflags \ --test-args --target-rustcflags \
--test-args -L \ --test-args -L \
@ -758,7 +758,7 @@ directory to launch `zxdb`:
**In separate terminal** **In separate terminal**
```sh ```sh
${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \ ${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \
--symbol-path target/x86_64-fuchsia/debug --symbol-path target/x86_64-unknown-fuchsia/debug
``` ```
* `--symbol-path` gets required symbol paths, which are * `--symbol-path` gets required symbol paths, which are
@ -854,7 +854,7 @@ source code:
```sh ```sh
${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \ ${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \
--symbol-path target/x86_64-fuchsia/debug \ --symbol-path target/x86_64-unknown-fuchsia/debug \
--build-dir ${RUST_SRC_PATH}/rust \ --build-dir ${RUST_SRC_PATH}/rust \
--build-dir ${FUCHSIA_SRC_PATH}/fuchsia/out/default --build-dir ${FUCHSIA_SRC_PATH}/fuchsia/out/default
``` ```

View File

@ -50,10 +50,10 @@ with runtime flag `ASAN_OPTIONS=detect_leaks=1` on macOS.
AddressSanitizer is supported on the following targets: AddressSanitizer is supported on the following targets:
* `aarch64-apple-darwin` * `aarch64-apple-darwin`
* `aarch64-fuchsia` * `aarch64-unknown-fuchsia`
* `aarch64-unknown-linux-gnu` * `aarch64-unknown-linux-gnu`
* `x86_64-apple-darwin` * `x86_64-apple-darwin`
* `x86_64-fuchsia` * `x86_64-unknown-fuchsia`
* `x86_64-unknown-freebsd` * `x86_64-unknown-freebsd`
* `x86_64-unknown-linux-gnu` * `x86_64-unknown-linux-gnu`

View File

@ -26,7 +26,7 @@
// [r9] needs-llvm-components: aarch64 // [r9] needs-llvm-components: aarch64
// [r10] compile-flags: --target aarch64-apple-ios // [r10] compile-flags: --target aarch64-apple-ios
// [r10] needs-llvm-components: aarch64 // [r10] needs-llvm-components: aarch64
// [r11] compile-flags: --target aarch64-fuchsia // [r11] compile-flags: --target aarch64-unknown-fuchsia
// [r11] needs-llvm-components: aarch64 // [r11] needs-llvm-components: aarch64
// [r12] compile-flags: --target aarch64-linux-android // [r12] compile-flags: --target aarch64-linux-android
// [r12] needs-llvm-components: aarch64 // [r12] needs-llvm-components: aarch64
@ -156,7 +156,7 @@
// [r74] needs-llvm-components: x86 // [r74] needs-llvm-components: x86
// [r75] compile-flags:--target x86_64-fortanix-unknown-sgx // [r75] compile-flags:--target x86_64-fortanix-unknown-sgx
// [r75] needs-llvm-components: x86 // [r75] needs-llvm-components: x86
// [r76] compile-flags:--target x86_64-fuchsia // [r76] compile-flags:--target x86_64-unknown-fuchsia
// [r76] needs-llvm-components: x86 // [r76] needs-llvm-components: x86
// [r77] compile-flags:--target x86_64-linux-android // [r77] compile-flags:--target x86_64-linux-android
// [r77] needs-llvm-components: x86 // [r77] needs-llvm-components: x86

View File

@ -51,7 +51,7 @@
"aarch64-apple-darwin", "aarch64-apple-darwin",
"aarch64-apple-ios", "aarch64-apple-ios",
"aarch64-apple-ios-sim", "aarch64-apple-ios-sim",
"aarch64-fuchsia", "aarch64-unknown-fuchsia",
"aarch64-linux-android", "aarch64-linux-android",
"aarch64-pc-windows-msvc", "aarch64-pc-windows-msvc",
"aarch64-unknown-hermit", "aarch64-unknown-hermit",
@ -138,7 +138,7 @@
"x86_64-apple-darwin", "x86_64-apple-darwin",
"x86_64-apple-ios", "x86_64-apple-ios",
"x86_64-fortanix-unknown-sgx", "x86_64-fortanix-unknown-sgx",
"x86_64-fuchsia", "x86_64-unknown-fuchsia",
"x86_64-linux-android", "x86_64-linux-android",
"x86_64-pc-windows-gnu", "x86_64-pc-windows-gnu",
"x86_64-pc-windows-msvc", "x86_64-pc-windows-msvc",

View File

@ -11,7 +11,7 @@
pub const ASAN_SUPPORTED_TARGETS: &[&str] = &[ pub const ASAN_SUPPORTED_TARGETS: &[&str] = &[
"aarch64-apple-darwin", "aarch64-apple-darwin",
"aarch64-fuchsia", "aarch64-unknown-fuchsia",
"aarch64-linux-android", "aarch64-linux-android",
"aarch64-unknown-linux-gnu", "aarch64-unknown-linux-gnu",
"arm-linux-androideabi", "arm-linux-androideabi",
@ -19,7 +19,7 @@
"i686-linux-android", "i686-linux-android",
"i686-unknown-linux-gnu", "i686-unknown-linux-gnu",
"x86_64-apple-darwin", "x86_64-apple-darwin",
"x86_64-fuchsia", "x86_64-unknown-fuchsia",
"x86_64-linux-android", "x86_64-linux-android",
"x86_64-unknown-freebsd", "x86_64-unknown-freebsd",
"x86_64-unknown-linux-gnu", "x86_64-unknown-linux-gnu",
@ -28,12 +28,12 @@
// FIXME(rcvalle): More targets are likely supported. // FIXME(rcvalle): More targets are likely supported.
pub const CFI_SUPPORTED_TARGETS: &[&str] = &[ pub const CFI_SUPPORTED_TARGETS: &[&str] = &[
"aarch64-apple-darwin", "aarch64-apple-darwin",
"aarch64-fuchsia", "aarch64-unknown-fuchsia",
"aarch64-linux-android", "aarch64-linux-android",
"aarch64-unknown-freebsd", "aarch64-unknown-freebsd",
"aarch64-unknown-linux-gnu", "aarch64-unknown-linux-gnu",
"x86_64-apple-darwin", "x86_64-apple-darwin",
"x86_64-fuchsia", "x86_64-unknown-fuchsia",
"x86_64-pc-solaris", "x86_64-pc-solaris",
"x86_64-unknown-freebsd", "x86_64-unknown-freebsd",
"x86_64-unknown-illumos", "x86_64-unknown-illumos",