mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
llvm: Match new LLVM 128-bit integer alignment on sparc
LLVM continues to align more 128-bit integers to 128-bits in the data layout rather than relying on the high level language to do it. Update SPARC target files to match and add a backcompat replacement for current LLVMs. See llvm/llvm-project#106951 for details
This commit is contained in:
parent
a0d98ff0e5
commit
9caced7bad
@ -148,6 +148,11 @@ pub(crate) unsafe fn create_module<'ll>(
|
|||||||
target_data_layout =
|
target_data_layout =
|
||||||
target_data_layout.replace("-p270:32:32-p271:32:32-p272:64:64", "");
|
target_data_layout.replace("-p270:32:32-p271:32:32-p272:64:64", "");
|
||||||
}
|
}
|
||||||
|
if sess.target.arch.starts_with("sparc") {
|
||||||
|
// LLVM 20 updates the sparc layout to correctly align 128 bit integers to 128 bit.
|
||||||
|
// See https://github.com/llvm/llvm-project/pull/106951
|
||||||
|
target_data_layout = target_data_layout.replace("-i128:128", "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the data-layout values hardcoded remain the defaults.
|
// Ensure the data-layout values hardcoded remain the defaults.
|
||||||
|
@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
|
|||||||
std: Some(true),
|
std: Some(true),
|
||||||
},
|
},
|
||||||
pointer_width: 64,
|
pointer_width: 64,
|
||||||
data_layout: "E-m:e-i64:64-n32:64-S128".into(),
|
data_layout: "E-m:e-i64:64-i128:128-n32:64-S128".into(),
|
||||||
arch: "sparc64".into(),
|
arch: "sparc64".into(),
|
||||||
options: base,
|
options: base,
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
|
|||||||
std: Some(true),
|
std: Some(true),
|
||||||
},
|
},
|
||||||
pointer_width: 64,
|
pointer_width: 64,
|
||||||
data_layout: "E-m:e-i64:64-n32:64-S128".into(),
|
data_layout: "E-m:e-i64:64-i128:128-n32:64-S128".into(),
|
||||||
arch: "sparc64".into(),
|
arch: "sparc64".into(),
|
||||||
options: TargetOptions { endian: Endian::Big, mcount: "__mcount".into(), ..base },
|
options: TargetOptions { endian: Endian::Big, mcount: "__mcount".into(), ..base },
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
|
|||||||
std: Some(true),
|
std: Some(true),
|
||||||
},
|
},
|
||||||
pointer_width: 64,
|
pointer_width: 64,
|
||||||
data_layout: "E-m:e-i64:64-n32:64-S128".into(),
|
data_layout: "E-m:e-i64:64-i128:128-n32:64-S128".into(),
|
||||||
arch: "sparc64".into(),
|
arch: "sparc64".into(),
|
||||||
options: base,
|
options: base,
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ pub(crate) fn target() -> Target {
|
|||||||
std: Some(true),
|
std: Some(true),
|
||||||
},
|
},
|
||||||
pointer_width: 32,
|
pointer_width: 32,
|
||||||
data_layout: "E-m:e-p:32:32-i64:64-f128:64-n32-S64".into(),
|
data_layout: "E-m:e-p:32:32-i64:64-i128:128-f128:64-n32-S64".into(),
|
||||||
arch: "sparc".into(),
|
arch: "sparc".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
cpu: "v9".into(),
|
cpu: "v9".into(),
|
||||||
|
@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
Target {
|
Target {
|
||||||
data_layout: "E-m:e-p:32:32-i64:64-f128:64-n32-S64".into(),
|
data_layout: "E-m:e-p:32:32-i64:64-i128:128-f128:64-n32-S64".into(),
|
||||||
llvm_target: "sparc-unknown-none-elf".into(),
|
llvm_target: "sparc-unknown-none-elf".into(),
|
||||||
metadata: crate::spec::TargetMetadata {
|
metadata: crate::spec::TargetMetadata {
|
||||||
description: Some("Bare 32-bit SPARC V7+".into()),
|
description: Some("Bare 32-bit SPARC V7+".into()),
|
||||||
|
@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
|
|||||||
std: Some(true),
|
std: Some(true),
|
||||||
},
|
},
|
||||||
pointer_width: 64,
|
pointer_width: 64,
|
||||||
data_layout: "E-m:e-i64:64-n32:64-S128".into(),
|
data_layout: "E-m:e-i64:64-i128:128-n32:64-S128".into(),
|
||||||
// Use "sparc64" instead of "sparcv9" here, since the former is already
|
// Use "sparc64" instead of "sparcv9" here, since the former is already
|
||||||
// used widely in the source base. If we ever needed ABI
|
// used widely in the source base. If we ever needed ABI
|
||||||
// differentiation from the sparc64, we could, but that would probably
|
// differentiation from the sparc64, we could, but that would probably
|
||||||
|
Loading…
Reference in New Issue
Block a user