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
36 changed files with 87 additions and 65 deletions
|
@ -14,8 +14,7 @@ pub fn target() -> Target {
|
|||
arch: "x86".into(),
|
||||
options: TargetOptions {
|
||||
max_atomic_width: Some(64),
|
||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||
stack_probes: StackProbeType::Call,
|
||||
stack_probes: StackProbeType::X86,
|
||||
..base
|
||||
},
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ pub fn target() -> Target {
|
|||
base.max_atomic_width = Some(64);
|
||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.frame_pointer = FramePointer::Always;
|
||||
|
||||
// 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
|
||||
base.cpu = "pentiumpro".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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "i686-linux-android".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "pentium4".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "i686-unknown-freebsd".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "pentium4".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "i686-unknown-haiku".into(),
|
||||
|
|
|
@ -6,8 +6,7 @@ pub fn target() -> Target {
|
|||
base.max_atomic_width = Some(64);
|
||||
base.supported_sanitizers = SanitizerSet::ADDRESS;
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "i686-unknown-linux-gnu".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "pentium4".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
|
||||
// implementation, apparently relies on frame pointers existing... somehow.
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "pentium4".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "i686-unknown-netbsdelf".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "pentium4".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "i686-unknown-openbsd".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "pentium4".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "i686-unknown-linux-gnu".into(),
|
||||
|
|
|
@ -6,8 +6,7 @@ pub fn opts() -> TargetOptions {
|
|||
env: "gnu".into(),
|
||||
disable_redzone: true,
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||
stack_probes: StackProbeType::Call,
|
||||
stack_probes: StackProbeType::X86,
|
||||
frame_pointer: FramePointer::Always,
|
||||
position_independent_executables: true,
|
||||
needs_plt: true,
|
||||
|
|
|
@ -635,6 +635,10 @@ pub enum 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> {
|
||||
let object = json.as_object().ok_or_else(|| "expected a JSON object")?;
|
||||
let kind = object
|
||||
|
|
|
@ -9,8 +9,7 @@ pub fn target() -> Target {
|
|||
base.frame_pointer = FramePointer::Always;
|
||||
base.add_pre_link_args(LinkerFlavor::Gcc, &["-m64"]);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.supported_sanitizers =
|
||||
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD;
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ pub fn target() -> Target {
|
|||
arch: "x86_64".into(),
|
||||
options: TargetOptions {
|
||||
max_atomic_width: Some(64),
|
||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||
stack_probes: StackProbeType::Call,
|
||||
stack_probes: StackProbeType::X86,
|
||||
..base
|
||||
},
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ pub fn target() -> Target {
|
|||
arch: "x86_64".into(),
|
||||
options: TargetOptions {
|
||||
max_atomic_width: Some(64),
|
||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||
stack_probes: StackProbeType::Call,
|
||||
stack_probes: StackProbeType::X86,
|
||||
..base
|
||||
},
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ pub fn target() -> Target {
|
|||
arch: "x86_64".into(),
|
||||
options: TargetOptions {
|
||||
max_atomic_width: Some(64),
|
||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||
stack_probes: StackProbeType::Call,
|
||||
stack_probes: StackProbeType::X86,
|
||||
..base
|
||||
},
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ pub fn target() -> Target {
|
|||
arch: "x86_64".into(),
|
||||
options: TargetOptions {
|
||||
max_atomic_width: Some(64),
|
||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||
stack_probes: StackProbeType::Call,
|
||||
stack_probes: StackProbeType::X86,
|
||||
forces_embed_bitcode: true,
|
||||
// Taken from a clang build on Xcode 11.4.1.
|
||||
// These arguments are not actually invoked - they just have
|
||||
|
|
|
@ -4,8 +4,7 @@ pub fn target() -> Target {
|
|||
let mut base = super::fuchsia_base::opts();
|
||||
base.cpu = "x86-64".into();
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
|
||||
|
||||
Target {
|
||||
|
|
|
@ -7,8 +7,7 @@ pub fn target() -> Target {
|
|||
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "x86_64-linux-android".into(),
|
||||
|
|
|
@ -6,8 +6,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.vendor = "pc".into();
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
|
||||
|
||||
Target {
|
||||
|
|
|
@ -6,8 +6,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.vendor = "sun".into();
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "x86_64-pc-solaris".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "x86_64-unknown-dragonfly".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.supported_sanitizers =
|
||||
SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::MEMORY | SanitizerSet::THREAD;
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
// This option is required to build executables on Haiku x86_64
|
||||
base.position_independent_executables = true;
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
base.features = "+rdrnd,+rdseed".into();
|
||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||
base.stack_probes = StackProbeType::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "x86_64-unknown-hermit".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.static_position_independent_executables = true;
|
||||
base.supported_sanitizers = SanitizerSet::ADDRESS
|
||||
| SanitizerSet::CFI
|
||||
|
|
|
@ -6,8 +6,7 @@ pub fn target() -> Target {
|
|||
base.abi = "x32".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.has_thread_local = false;
|
||||
// BUG(GabrielMajeri): disabling the PLT on x86_64 Linux with x32 ABI
|
||||
// breaks code gen. See LLVM bug 36743
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.static_position_independent_executables = true;
|
||||
base.supported_sanitizers = SanitizerSet::ADDRESS
|
||||
| SanitizerSet::CFI
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.supported_sanitizers = SanitizerSet::ADDRESS
|
||||
| SanitizerSet::CFI
|
||||
| SanitizerSet::LEAK
|
||||
|
|
|
@ -11,8 +11,7 @@ pub fn target() -> Target {
|
|||
let opts = TargetOptions {
|
||||
cpu: "x86-64".into(),
|
||||
max_atomic_width: Some(64),
|
||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||
stack_probes: StackProbeType::Call,
|
||||
stack_probes: StackProbeType::X86,
|
||||
position_independent_executables: true,
|
||||
static_position_independent_executables: true,
|
||||
relro_level: RelroLevel::Full,
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "x86_64-unknown-openbsd".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
|
||||
Target {
|
||||
llvm_target: "x86_64-unknown-redox".into(),
|
||||
|
|
|
@ -5,8 +5,7 @@ pub fn target() -> Target {
|
|||
base.cpu = "x86-64".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
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::Call;
|
||||
base.stack_probes = StackProbeType::X86;
|
||||
base.disable_redzone = true;
|
||||
|
||||
Target {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue