mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-29 20:20:59 +03:00
Rollup merge of #104066 - TimNN:riscv-layout, r=nikic
LLVM 16: Update RISCV data layout The RISCV data layout was changed in https://github.com/llvm/llvm-project/commit/974e2e690b4024c2677dde26cc76ec31e0047c1d. This updates all `riscv64*` targets, though I don't really know what the difference between the `gc` and `imac` ones is. Passes `x test codegen` at LLVM head and with the currently bundled LLVM version. Without this patch, some tests fail with: > error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:192:13: data-layout for target `riscv64gc-unknown-none-elf`, `e-m:e-p:64:64-i64:64-i128:128-n64-S128`, differs from LLVM target's `riscv64` default layout, `e-m:e-p:64:64-i64:64-i128:128-n32:64-S128
This commit is contained in:
@@ -158,6 +158,10 @@ pub unsafe fn create_module<'ll>(
|
||||
if sess.target.arch == "s390x" {
|
||||
target_data_layout = target_data_layout.replace("-v128:64", "");
|
||||
}
|
||||
|
||||
if sess.target.arch == "riscv64" {
|
||||
target_data_layout = target_data_layout.replace("-n32:64-", "-n64-");
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the data-layout values hardcoded remain the defaults.
|
||||
|
||||
@@ -4,7 +4,7 @@ pub fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "riscv64-unknown-freebsd".into(),
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
|
||||
arch: "riscv64".into(),
|
||||
options: TargetOptions {
|
||||
code_model: Some(CodeModel::Medium),
|
||||
|
||||
@@ -4,7 +4,7 @@ pub fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "riscv64-unknown-linux-gnu".into(),
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
|
||||
arch: "riscv64".into(),
|
||||
options: TargetOptions {
|
||||
code_model: Some(CodeModel::Medium),
|
||||
|
||||
@@ -4,7 +4,7 @@ pub fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "riscv64-unknown-linux-musl".into(),
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
|
||||
arch: "riscv64".into(),
|
||||
options: TargetOptions {
|
||||
code_model: Some(CodeModel::Medium),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
|
||||
llvm_target: "riscv64".into(),
|
||||
pointer_width: 64,
|
||||
arch: "riscv64".into(),
|
||||
|
||||
@@ -4,7 +4,7 @@ pub fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "riscv64-unknown-openbsd".into(),
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
|
||||
arch: "riscv64".into(),
|
||||
options: TargetOptions {
|
||||
code_model: Some(CodeModel::Medium),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
|
||||
llvm_target: "riscv64".into(),
|
||||
pointer_width: 64,
|
||||
arch: "riscv64".into(),
|
||||
|
||||
Reference in New Issue
Block a user