mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
Auto merge of #102503 - cuviper:x86-stack-probes, r=nagisa
Enable inline stack probes on X86 with LLVM 16 The known problems with x86 inline-asm stack probes have been solved on LLVM main (16), so this flips the switch. Anyone using bleeding-edge LLVM with rustc can start testing this, as I have done locally. We'll get more direct rust-ci when LLVM 16 branches and we start our upgrade, and we can always patch or disable it then if we find new problems. The previous attempt was #77885, reverted in #84708.
This commit is contained in:
commit
607b8296e0
@ -14,8 +14,7 @@ pub fn target() -> Target {
|
|||||||
arch: "x86".into(),
|
arch: "x86".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
stack_probes: StackProbeType::X86,
|
||||||
stack_probes: StackProbeType::Call,
|
|
||||||
..base
|
..base
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,7 @@ pub fn target() -> Target {
|
|||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
||||||
base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
|
base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.frame_pointer = FramePointer::Always;
|
base.frame_pointer = FramePointer::Always;
|
||||||
|
|
||||||
// Clang automatically chooses a more specific target based on
|
// Clang automatically chooses a more specific target based on
|
||||||
|
@ -11,8 +11,7 @@ pub fn target() -> Target {
|
|||||||
// https://developer.android.com/ndk/guides/abis.html#x86
|
// https://developer.android.com/ndk/guides/abis.html#x86
|
||||||
base.cpu = "pentiumpro".into();
|
base.cpu = "pentiumpro".into();
|
||||||
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".into();
|
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".into();
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "i686-linux-android".into(),
|
llvm_target: "i686-linux-android".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "pentium4".into();
|
base.cpu = "pentium4".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32", "-Wl,-znotext"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32", "-Wl,-znotext"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "i686-unknown-freebsd".into(),
|
llvm_target: "i686-unknown-freebsd".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "pentium4".into();
|
base.cpu = "pentium4".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "i686-unknown-haiku".into(),
|
llvm_target: "i686-unknown-haiku".into(),
|
||||||
|
@ -6,8 +6,7 @@ pub fn target() -> Target {
|
|||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.supported_sanitizers = SanitizerSet::ADDRESS;
|
base.supported_sanitizers = SanitizerSet::ADDRESS;
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "i686-unknown-linux-gnu".into(),
|
llvm_target: "i686-unknown-linux-gnu".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "pentium4".into();
|
base.cpu = "pentium4".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32", "-Wl,-melf_i386"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32", "-Wl,-melf_i386"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
|
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
|
||||||
// implementation, apparently relies on frame pointers existing... somehow.
|
// implementation, apparently relies on frame pointers existing... somehow.
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "pentium4".into();
|
base.cpu = "pentium4".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "i686-unknown-netbsdelf".into(),
|
llvm_target: "i686-unknown-netbsdelf".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "pentium4".into();
|
base.cpu = "pentium4".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32", "-fuse-ld=lld"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32", "-fuse-ld=lld"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "i686-unknown-openbsd".into(),
|
llvm_target: "i686-unknown-openbsd".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "pentium4".into();
|
base.cpu = "pentium4".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "i686-unknown-linux-gnu".into(),
|
llvm_target: "i686-unknown-linux-gnu".into(),
|
||||||
|
@ -6,8 +6,7 @@ pub fn opts() -> TargetOptions {
|
|||||||
env: "gnu".into(),
|
env: "gnu".into(),
|
||||||
disable_redzone: true,
|
disable_redzone: true,
|
||||||
panic_strategy: PanicStrategy::Abort,
|
panic_strategy: PanicStrategy::Abort,
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
stack_probes: StackProbeType::X86,
|
||||||
stack_probes: StackProbeType::Call,
|
|
||||||
frame_pointer: FramePointer::Always,
|
frame_pointer: FramePointer::Always,
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
needs_plt: true,
|
needs_plt: true,
|
||||||
|
@ -635,6 +635,10 @@ pub enum StackProbeType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl StackProbeType {
|
impl StackProbeType {
|
||||||
|
// LLVM X86 targets (ix86 and x86_64) can use inline-asm stack probes starting with LLVM 16.
|
||||||
|
// Notable past issues were rust#83139 (fixed in 14) and rust#84667 (fixed in 16).
|
||||||
|
const X86: Self = Self::InlineOrCall { min_llvm_version_for_inline: (16, 0, 0) };
|
||||||
|
|
||||||
fn from_json(json: &Json) -> Result<Self, String> {
|
fn from_json(json: &Json) -> Result<Self, String> {
|
||||||
let object = json.as_object().ok_or_else(|| "expected a JSON object")?;
|
let object = json.as_object().ok_or_else(|| "expected a JSON object")?;
|
||||||
let kind = object
|
let kind = object
|
||||||
|
@ -9,8 +9,7 @@ pub fn target() -> Target {
|
|||||||
base.frame_pointer = FramePointer::Always;
|
base.frame_pointer = FramePointer::Always;
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
|
base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.supported_sanitizers =
|
base.supported_sanitizers =
|
||||||
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD;
|
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD;
|
||||||
|
|
||||||
|
@ -13,8 +13,7 @@ pub fn target() -> Target {
|
|||||||
arch: "x86_64".into(),
|
arch: "x86_64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
stack_probes: StackProbeType::X86,
|
||||||
stack_probes: StackProbeType::Call,
|
|
||||||
..base
|
..base
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,7 @@ pub fn target() -> Target {
|
|||||||
arch: "x86_64".into(),
|
arch: "x86_64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
stack_probes: StackProbeType::X86,
|
||||||
stack_probes: StackProbeType::Call,
|
|
||||||
..base
|
..base
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,7 @@ pub fn target() -> Target {
|
|||||||
arch: "x86_64".into(),
|
arch: "x86_64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
stack_probes: StackProbeType::X86,
|
||||||
stack_probes: StackProbeType::Call,
|
|
||||||
..base
|
..base
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,7 @@ pub fn target() -> Target {
|
|||||||
arch: "x86_64".into(),
|
arch: "x86_64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
stack_probes: StackProbeType::X86,
|
||||||
stack_probes: StackProbeType::Call,
|
|
||||||
forces_embed_bitcode: true,
|
forces_embed_bitcode: true,
|
||||||
// Taken from a clang build on Xcode 11.4.1.
|
// Taken from a clang build on Xcode 11.4.1.
|
||||||
// These arguments are not actually invoked - they just have
|
// These arguments are not actually invoked - they just have
|
||||||
|
@ -4,8 +4,7 @@ pub fn target() -> Target {
|
|||||||
let mut base = super::fuchsia_base::opts();
|
let mut base = super::fuchsia_base::opts();
|
||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
|
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
|
@ -7,8 +7,7 @@ pub fn target() -> Target {
|
|||||||
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt".into();
|
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "x86_64-linux-android".into(),
|
llvm_target: "x86_64-linux-android".into(),
|
||||||
|
@ -6,8 +6,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.vendor = "pc".into();
|
base.vendor = "pc".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
|
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
|
@ -6,8 +6,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.vendor = "sun".into();
|
base.vendor = "sun".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "x86_64-pc-solaris".into(),
|
llvm_target: "x86_64-pc-solaris".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "x86_64-unknown-dragonfly".into(),
|
llvm_target: "x86_64-unknown-dragonfly".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.supported_sanitizers =
|
base.supported_sanitizers =
|
||||||
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::MEMORY | SanitizerSet::THREAD;
|
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::MEMORY | SanitizerSet::THREAD;
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
// This option is required to build executables on Haiku x86_64
|
// This option is required to build executables on Haiku x86_64
|
||||||
base.position_independent_executables = true;
|
base.position_independent_executables = true;
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.features = "+rdrnd,+rdseed".into();
|
base.features = "+rdrnd,+rdseed".into();
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "x86_64-unknown-hermit".into(),
|
llvm_target: "x86_64-unknown-hermit".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.static_position_independent_executables = true;
|
base.static_position_independent_executables = true;
|
||||||
base.supported_sanitizers = SanitizerSet::ADDRESS
|
base.supported_sanitizers = SanitizerSet::ADDRESS
|
||||||
| SanitizerSet::CFI
|
| SanitizerSet::CFI
|
||||||
|
@ -6,8 +6,7 @@ pub fn target() -> Target {
|
|||||||
base.abi = "x32".into();
|
base.abi = "x32".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-mx32"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-mx32"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.has_thread_local = false;
|
base.has_thread_local = false;
|
||||||
// BUG(GabrielMajeri): disabling the PLT on x86_64 Linux with x32 ABI
|
// BUG(GabrielMajeri): disabling the PLT on x86_64 Linux with x32 ABI
|
||||||
// breaks code gen. See LLVM bug 36743
|
// breaks code gen. See LLVM bug 36743
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.static_position_independent_executables = true;
|
base.static_position_independent_executables = true;
|
||||||
base.supported_sanitizers = SanitizerSet::ADDRESS
|
base.supported_sanitizers = SanitizerSet::ADDRESS
|
||||||
| SanitizerSet::CFI
|
| SanitizerSet::CFI
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.supported_sanitizers = SanitizerSet::ADDRESS
|
base.supported_sanitizers = SanitizerSet::ADDRESS
|
||||||
| SanitizerSet::CFI
|
| SanitizerSet::CFI
|
||||||
| SanitizerSet::LEAK
|
| SanitizerSet::LEAK
|
||||||
|
@ -11,8 +11,7 @@ pub fn target() -> Target {
|
|||||||
let opts = TargetOptions {
|
let opts = TargetOptions {
|
||||||
cpu: "x86-64".into(),
|
cpu: "x86-64".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
stack_probes: StackProbeType::X86,
|
||||||
stack_probes: StackProbeType::Call,
|
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
static_position_independent_executables: true,
|
static_position_independent_executables: true,
|
||||||
relro_level: RelroLevel::Full,
|
relro_level: RelroLevel::Full,
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "x86_64-unknown-openbsd".into(),
|
llvm_target: "x86_64-unknown-openbsd".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
llvm_target: "x86_64-unknown-redox".into(),
|
llvm_target: "x86_64-unknown-redox".into(),
|
||||||
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||||||
base.cpu = "x86-64".into();
|
base.cpu = "x86-64".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
base.stack_probes = StackProbeType::X86;
|
||||||
base.stack_probes = StackProbeType::Call;
|
|
||||||
base.disable_redzone = true;
|
base.disable_redzone = true;
|
||||||
|
|
||||||
Target {
|
Target {
|
||||||
|
42
src/test/assembly/x86-stack-probes.rs
Normal file
42
src/test/assembly/x86-stack-probes.rs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// min-llvm-version: 16
|
||||||
|
// revisions: x86_64 i686
|
||||||
|
// assembly-output: emit-asm
|
||||||
|
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
|
||||||
|
//[x86_64] needs-llvm-components: x86
|
||||||
|
//[i686] compile-flags: --target i686-unknown-linux-gnu
|
||||||
|
//[i686] needs-llvm-components: x86
|
||||||
|
// compile-flags: -C llvm-args=-x86-asm-syntax=intel
|
||||||
|
|
||||||
|
#![feature(no_core, lang_items)]
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
#![no_core]
|
||||||
|
|
||||||
|
#[lang = "sized"]
|
||||||
|
trait Sized {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
|
impl Copy for u8 {}
|
||||||
|
|
||||||
|
// Check that inline-asm stack probes are generated correctly.
|
||||||
|
// To avoid making this test fragile to slight asm changes,
|
||||||
|
// we only check that the stack pointer is decremented by a page at a time,
|
||||||
|
// instead of matching the whole probe sequence.
|
||||||
|
|
||||||
|
// CHECK-LABEL: small_stack_probe:
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn small_stack_probe(x: u8, f: fn(&mut [u8; 8192])) {
|
||||||
|
// CHECK-NOT: __rust_probestack
|
||||||
|
// x86_64: sub rsp, 4096
|
||||||
|
// i686: sub esp, 4096
|
||||||
|
f(&mut [x; 8192]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK-LABEL: big_stack_probe:
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn big_stack_probe(x: u8, f: fn(&[u8; 65536])) {
|
||||||
|
// CHECK-NOT: __rust_probestack
|
||||||
|
// x86_64: sub rsp, 4096
|
||||||
|
// i686: sub esp, 4096
|
||||||
|
f(&mut [x; 65536]);
|
||||||
|
}
|
@ -5,8 +5,10 @@
|
|||||||
// revisions: i686 x86_64
|
// revisions: i686 x86_64
|
||||||
//[i686] compile-flags: --target i686-unknown-linux-gnu
|
//[i686] compile-flags: --target i686-unknown-linux-gnu
|
||||||
//[i686] needs-llvm-components: x86
|
//[i686] needs-llvm-components: x86
|
||||||
|
//[i686] ignore-llvm-version: 16 - 99
|
||||||
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
|
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
|
||||||
//[x86_64] needs-llvm-components: x86
|
//[x86_64] needs-llvm-components: x86
|
||||||
|
//[x86_64] ignore-llvm-version: 16 - 99
|
||||||
|
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
#![feature(no_core, lang_items)]
|
#![feature(no_core, lang_items)]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// or `StackProbeType::InlineOrCall` when running on newer LLVM.
|
// or `StackProbeType::InlineOrCall` when running on newer LLVM.
|
||||||
|
|
||||||
// compile-flags: -C no-prepopulate-passes
|
// compile-flags: -C no-prepopulate-passes
|
||||||
// revisions: powerpc powerpc64 powerpc64le s390x
|
// revisions: powerpc powerpc64 powerpc64le s390x i686 x86_64
|
||||||
//[powerpc] compile-flags: --target powerpc-unknown-linux-gnu
|
//[powerpc] compile-flags: --target powerpc-unknown-linux-gnu
|
||||||
//[powerpc] needs-llvm-components: powerpc
|
//[powerpc] needs-llvm-components: powerpc
|
||||||
//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu
|
//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu
|
||||||
@ -11,6 +11,12 @@
|
|||||||
//[powerpc64le] needs-llvm-components: powerpc
|
//[powerpc64le] needs-llvm-components: powerpc
|
||||||
//[s390x] compile-flags: --target s390x-unknown-linux-gnu
|
//[s390x] compile-flags: --target s390x-unknown-linux-gnu
|
||||||
//[s390x] needs-llvm-components: systemz
|
//[s390x] needs-llvm-components: systemz
|
||||||
|
//[i686] compile-flags: --target i686-unknown-linux-gnu
|
||||||
|
//[i686] needs-llvm-components: x86
|
||||||
|
//[i686] min-llvm-version: 16
|
||||||
|
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
|
||||||
|
//[x86_64] needs-llvm-components: x86
|
||||||
|
//[x86_64] min-llvm-version: 16
|
||||||
|
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
#![feature(no_core, lang_items)]
|
#![feature(no_core, lang_items)]
|
||||||
|
Loading…
Reference in New Issue
Block a user