Skip to content

Commit eefefbe

Browse files
authored
Rollup merge of #134165 - durin42:wasm-target-string, r=jieyouxu
wasm(32|64): update alignment string See llvm/llvm-project@c5ab70c `@rustbot` label: +llvm-main
2 parents 13c13ee + 48b8832 commit eefefbe

File tree

8 files changed

+13
-7
lines changed

8 files changed

+13
-7
lines changed

Diff for: compiler/rustc_codegen_llvm/src/context.rs

+5
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ pub(crate) unsafe fn create_module<'ll>(
164164
// See https://github.com/llvm/llvm-project/pull/118004
165165
target_data_layout = target_data_layout.replace("-i128:128", "");
166166
}
167+
if sess.target.arch.starts_with("wasm32") || sess.target.arch.starts_with("wasm64") {
168+
// LLVM 20 updates the wasm(32|64) layout to correctly align 128 bit integers to 128 bit.
169+
// See https://github.com/llvm/llvm-project/pull/119204
170+
target_data_layout = target_data_layout.replace("-i128:128", "");
171+
}
167172
}
168173

169174
// Ensure the data-layout values hardcoded remain the defaults.

Diff for: compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ pub(crate) fn target() -> Target {
3232
std: Some(true),
3333
},
3434
pointer_width: 32,
35-
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20".into(),
35+
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-f128:64-n32:64-S128-ni:1:10:20"
36+
.into(),
3637
arch: "wasm32".into(),
3738
options: opts,
3839
}

Diff for: compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub(crate) fn target() -> Target {
3737
std: Some(true),
3838
},
3939
pointer_width: 32,
40-
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20".into(),
40+
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20".into(),
4141
arch: "wasm32".into(),
4242
options,
4343
}

Diff for: compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(crate) fn target() -> Target {
5555
std: Some(true),
5656
},
5757
pointer_width: 32,
58-
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20".into(),
58+
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20".into(),
5959
arch: "wasm32".into(),
6060
options,
6161
}

Diff for: compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub(crate) fn target() -> Target {
6666
std: Some(true),
6767
},
6868
pointer_width: 32,
69-
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20".into(),
69+
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20".into(),
7070
arch: "wasm32".into(),
7171
options,
7272
}

Diff for: compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub(crate) fn target() -> Target {
6666
std: Some(true),
6767
},
6868
pointer_width: 32,
69-
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20".into(),
69+
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20".into(),
7070
arch: "wasm32".into(),
7171
options,
7272
}

Diff for: compiler/rustc_target/src/spec/targets/wasm32v1_none.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub(crate) fn target() -> Target {
4444
std: Some(false),
4545
},
4646
pointer_width: 32,
47-
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20".into(),
47+
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20".into(),
4848
arch: "wasm32".into(),
4949
options,
5050
}

Diff for: compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(crate) fn target() -> Target {
4040
std: None, // ?
4141
},
4242
pointer_width: 64,
43-
data_layout: "e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20".into(),
43+
data_layout: "e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20".into(),
4444
arch: "wasm64".into(),
4545
options,
4646
}

0 commit comments

Comments
 (0)