pub struct TargetOptions {
pub linker: String,
pub pre_link_args: Vec<String>,
pub post_link_args: Vec<String>,
pub cpu: String,
pub features: String,
pub dynamic_linking: bool,
pub executables: bool,
pub morestack: bool,
pub relocation_model: String,
pub code_model: String,
pub disable_redzone: bool,
pub eliminate_frame_pointer: bool,
pub function_sections: bool,
pub dll_prefix: String,
pub dll_suffix: String,
pub exe_suffix: String,
pub staticlib_prefix: String,
pub staticlib_suffix: String,
pub is_like_osx: bool,
pub is_like_windows: bool,
pub is_like_android: bool,
pub linker_is_gnu: bool,
pub has_rpath: bool,
pub no_compiler_rt: bool,
pub position_independent_executables: bool,
}
Optional aspects of a target specification.
This has an implementation of Default
, see each field for what the default is. In general,
these try to take "minimal defaults" that don't assume anything about the runtime they run in.
Fields
linker | Linker to invoke. Defaults to "cc".
|
pre_link_args | Linker arguments that are unconditionally passed before any user-defined libraries.
|
post_link_args | Linker arguments that are unconditionally passed after any user-defined libraries.
|
cpu | Default CPU to pass to LLVM. Corresponds to llc -mcpu=$cpu . Defaults to "default".
|
features | Default target features to pass to LLVM. These features will always be passed, and cannot
be disabled even via -C . Corresponds to llc -mattr=$features .
|
dynamic_linking | Whether dynamic linking is available on this target. Defaults to false.
|
executables | Whether executables are available on this target. iOS, for example, only allows static
libraries. Defaults to false.
|
morestack | Whether LLVM's segmented stack prelude is supported by whatever runtime is available.
Will emit stack checks and calls to __morestack. Defaults to false.
|
relocation_model | Relocation model to use in object file. Corresponds to llc
-relocation-model=$relocation_model . Defaults to "pic".
|
code_model | Code model to use. Corresponds to llc -code-model=$code_model . Defaults to "default".
|
disable_redzone | Do not emit code that uses the "red zone", if the ABI has one. Defaults to false.
|
eliminate_frame_pointer | Eliminate frame pointers from stack frames if possible. Defaults to true.
|
function_sections | Emit each function in its own section. Defaults to true.
|
dll_prefix | String to prepend to the name of every dynamic library. Defaults to "lib".
|
dll_suffix | String to append to the name of every dynamic library. Defaults to ".so".
|
exe_suffix | String to append to the name of every executable.
|
staticlib_prefix | String to prepend to the name of every static library. Defaults to "lib".
|
staticlib_suffix | String to append to the name of every static library. Defaults to ".a".
|
is_like_osx | Whether the target toolchain is like OSX's. Only useful for compiling against iOS/OS X, in
particular running dsymutil and some other stuff like -dead_strip . Defaults to false.
|
is_like_windows | Whether the target toolchain is like Windows'. Only useful for compiling against Windows,
only realy used for figuring out how to find libraries, since Windows uses its own
library naming convention. Defaults to false.
|
is_like_android | Whether the target toolchain is like Android's. Only useful for compiling against Android.
Defaults to false.
|
linker_is_gnu | Whether the linker support GNU-like arguments such as -O. Defaults to false.
|
has_rpath | Whether the linker support rpaths or not. Defaults to false.
|
no_compiler_rt | Whether to disable linking to compiler-rt. Defaults to false, as LLVM will emit references
to the functions that compiler-rt provides.
|
position_independent_executables | Dynamically linked executables can be compiled as position independent if the default
relocation model of position independent code is not changed. This is a requirement to take
advantage of ASLR, as otherwise the functions in the executable are not randomized and can
be used during an exploit of a vulnerability in any code.
|
Trait Implementations
Create a set of "sane defaults" for any target. This is still incomplete, and if used for
compilation, will certainly not work.
Derived Implementations