[][src]Module rustc_target::spec

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Flexible target specification.

Rust targets a wide variety of usecases, and in the interest of flexibility, allows new target triples to be defined in configuration files. Most users will not need to care about these, but this is invaluable when porting Rust to a new platform, and allows for an unprecedented level of control over how the compiler works.

Using custom targets

A target triple, as passed via rustc --target=TRIPLE, will first be compared against the list of built-in targets. This is to ease distributing rustc (no need for configuration files) and also to hold these built-in targets as immutable and sacred. If TRIPLE is not one of the built-in targets, rustc will check if a file named TRIPLE exists. If it does, it will be loaded as the target configuration. If the file does not exist, rustc will search each directory in the environment variable RUST_TARGET_PATH for a file named TRIPLE.json. The first one found will be loaded. If no file is found in any of those directories, a fatal error will be given.

Projects defining their own targets should use --target=path/to/my-awesome-platform.json instead of adding to RUST_TARGET_PATH.

Defining a new target

Targets are defined using JSON. The Target struct in this module defines the format the JSON file should take, though each underscore in the field names should be replaced with a hyphen (-) in the JSON file. Some fields are required in every target specification, such as llvm-target, target-endian, target-pointer-width, data-layout, arch, and os. In general, options passed to rustc with -C override the target's settings, though target-feature and link-args will add to the list specified by the target, rather than replace.

Modules

aarch64_unknown_linux_gnuInternal
aarch64_unknown_linux_muslInternal
aarch64_linux_androidInternal
aarch64_unknown_freebsdInternal
aarch64_unknown_openbsdInternal
aarch64_unknown_netbsdInternal
aarch64_fuchsiaInternal
aarch64_unknown_redoxInternal
aarch64_apple_iosInternal
aarch64_apple_tvosInternal
aarch64_pc_windows_msvcInternal
aarch64_uwp_windows_msvcInternal
aarch64_unknown_cloudabiInternal
aarch64_unknown_hermitInternal
aarch64_unknown_noneInternal
aarch64_unknown_none_softfloatInternal
aarch64_wrs_vxworksInternal
abiInternal
android_baseInternal
apple_baseInternal
apple_sdk_baseInternal
arm_baseInternal
arm_linux_androideabiInternal
arm_unknown_linux_gnueabiInternal
arm_unknown_linux_gnueabihfInternal
arm_unknown_linux_musleabiInternal
arm_unknown_linux_musleabihfInternal
armebv7r_none_eabiInternal
armebv7r_none_eabihfInternal
armv4t_unknown_linux_gnueabiInternal
armv5te_unknown_linux_gnueabiInternal
armv5te_unknown_linux_musleabiInternal
armv6_unknown_freebsdInternal
armv6_unknown_netbsd_eabihfInternal
armv7_unknown_linux_gnueabiInternal
armv7_unknown_linux_gnueabihfInternal
armv7_unknown_linux_musleabiInternal
armv7_unknown_linux_musleabihfInternal
armv7_linux_androideabiInternal
armv7_unknown_freebsdInternal
armv7_unknown_netbsd_eabihfInternal
armv7_apple_iosInternal
armv7s_apple_iosInternal
armv7r_none_eabiInternal
armv7r_none_eabihfInternal
armv7a_none_eabiInternal
armv7a_none_eabihfInternal
armv7_unknown_cloudabi_eabihfInternal
armv7_wrs_vxworks_eabihfInternal
asmjs_unknown_emscriptenInternal
cloudabi_baseInternal
crt_objectsInternal

Object files providing support for basic runtime facilities and added to the produced binaries at the start and at the end of linking.

dragonfly_baseInternal
freebsd_baseInternal
fuchsia_baseInternal
haiku_baseInternal
hermit_baseInternal
hermit_kernel_baseInternal
hexagon_unknown_linux_muslInternal
i386_apple_iosInternal
i586_unknown_linux_gnuInternal
i586_unknown_linux_muslInternal
i586_pc_windows_msvcInternal
i686_unknown_linux_gnuInternal
i686_unknown_linux_muslInternal
i686_linux_androidInternal
i686_unknown_freebsdInternal
i686_unknown_openbsdInternal
i686_unknown_netbsdInternal
i686_unknown_haikuInternal
i686_apple_darwinInternal
i686_pc_windows_gnuInternal
i686_uwp_windows_gnuInternal
i686_pc_windows_msvcInternal
i686_uwp_windows_msvcInternal
i686_unknown_cloudabiInternal
i686_unknown_uefiInternal
i686_wrs_vxworksInternal
illumos_baseInternal
l4re_baseInternal
linux_baseInternal
linux_kernel_baseInternal
linux_musl_baseInternal
mips64_unknown_linux_gnuabi64Internal
mips64_unknown_linux_muslabi64Internal
mips64el_unknown_linux_gnuabi64Internal
mips64el_unknown_linux_muslabi64Internal
mips_unknown_linux_gnuInternal
mips_unknown_linux_muslInternal
mips_unknown_linux_uclibcInternal
mipsel_sony_pspInternal
mipsel_unknown_linux_gnuInternal
mipsel_unknown_linux_muslInternal
mipsel_unknown_linux_uclibcInternal
mipsisa32r6_unknown_linux_gnuInternal
mipsisa32r6el_unknown_linux_gnuInternal
mipsisa64r6_unknown_linux_gnuabi64Internal
mipsisa64r6el_unknown_linux_gnuabi64Internal
msp430_none_elfInternal
msvc_baseInternal
netbsd_baseInternal
nvptx64_nvidia_cudaInternal
openbsd_baseInternal
powerpc64_unknown_linux_gnuInternal
powerpc64_unknown_linux_muslInternal
powerpc64le_unknown_linux_gnuInternal
powerpc64le_unknown_linux_muslInternal
powerpc64_unknown_freebsdInternal
powerpc64_wrs_vxworksInternal
powerpc_unknown_linux_gnuInternal
powerpc_unknown_linux_gnuspeInternal
powerpc_unknown_linux_muslInternal
powerpc_unknown_netbsdInternal
powerpc_wrs_vxworksInternal
powerpc_wrs_vxworks_speInternal
redox_baseInternal
riscv32i_unknown_none_elfInternal
riscv32imc_unknown_none_elfInternal
riscv32imac_unknown_none_elfInternal
riscv64imac_unknown_none_elfInternal
riscv64gc_unknown_none_elfInternal
riscv64gc_unknown_linux_gnuInternal
riscv_baseInternal
s390x_unknown_linux_gnuInternal
solaris_baseInternal
sparc64_unknown_linux_gnuInternal
sparc64_unknown_openbsdInternal
sparc64_unknown_netbsdInternal
sparc_unknown_linux_gnuInternal
sparcv9_sun_solarisInternal
thumb_baseInternal
thumbv6m_none_eabiInternal
thumbv7neon_unknown_linux_gnueabihfInternal
thumbv7neon_unknown_linux_musleabihfInternal
thumbv7neon_linux_androideabiInternal
thumbv7a_pc_windows_msvcInternal
thumbv7a_uwp_windows_msvcInternal
thumbv7m_none_eabiInternal
thumbv7em_none_eabiInternal
thumbv7em_none_eabihfInternal
thumbv8m_base_none_eabiInternal
thumbv8m_main_none_eabiInternal
thumbv8m_main_none_eabihfInternal
uefi_msvc_baseInternal
vxworks_baseInternal
wasm32_baseInternal
wasm32_unknown_emscriptenInternal
wasm32_unknown_unknownInternal

A "bare wasm" target representing a WebAssembly output that makes zero assumptions about its environment.

wasm32_wasiInternal

The wasm32-wasi target is a new and still (as of April 2019) an experimental target. The definition in this file is likely to be tweaked over time and shouldn't be relied on too much.

windows_gnu_baseInternal
windows_msvc_baseInternal
windows_uwp_gnu_baseInternal
windows_uwp_msvc_baseInternal
x86_64_unknown_linux_gnuInternal
x86_64_unknown_linux_muslInternal
x86_64_linux_androidInternal
x86_64_linux_kernelInternal
x86_64_unknown_freebsdInternal
x86_64_unknown_dragonflyInternal
x86_64_unknown_openbsdInternal
x86_64_unknown_netbsdInternal
x86_64_rumprun_netbsdInternal
x86_64_unknown_haikuInternal
x86_64_apple_darwinInternal
x86_64_fuchsiaInternal
x86_64_unknown_redoxInternal
x86_64_apple_iosInternal
x86_64_apple_ios_macabiInternal
x86_64_apple_tvosInternal
x86_64_sun_solarisInternal
x86_64_unknown_illumosInternal
x86_64_pc_windows_gnuInternal
x86_64_uwp_windows_gnuInternal
x86_64_pc_windows_msvcInternal
x86_64_uwp_windows_msvcInternal
x86_64_unknown_cloudabiInternal
x86_64_unknown_hermitInternal
x86_64_unknown_hermit_kernelInternal
x86_64_fortanix_unknown_sgxInternal
x86_64_unknown_uefiInternal
x86_64_wrs_vxworksInternal
x86_64_unknown_l4re_uclibcInternal
x86_64_unknown_linux_gnux32Internal

Structs

TargetInternal

Everything rustc knows about how to compile for a specific target.

TargetOptionsInternal

Optional aspects of a target specification.

Enums

CodeModelInternal
LinkOutputKindInternal

Everything is flattened to a single enum to make the json encoding/decoding less annoying.

LinkerFlavorInternal
LldFlavorInternal
LoadTargetErrorInternal
MergeFunctionsInternal
PanicStrategyInternal
RelocModelInternal
RelroLevelInternal
TargetTripleInternal

Either a target triple string or a path to a JSON file.

TlsModelInternal

Constants

TARGETSInternal

List of supported targets

Traits

HasTargetSpecInternal

Functions

get_targetsInternal
load_specificInternal

Type Definitions

LinkArgsInternal
TargetResultInternal