Skip to content

Commit 6eaf227

Browse files
committed
Update wasm data layout
1 parent 335f003 commit 6eaf227

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ pub unsafe fn create_module(
132132
if llvm_util::get_version() < (12, 0, 0) && sess.target.arch == "powerpc64" {
133133
target_data_layout = strip_powerpc64_vectors(target_data_layout);
134134
}
135+
if llvm_util::get_version() < (13, 0, 0) {
136+
if sess.target.arch == "wasm32" {
137+
target_data_layout = "e-m:e-p:32:32-i64:64-n32:64-S128".to_string();
138+
}
139+
if sess.target.arch == "wasm64" {
140+
target_data_layout = "e-m:e-p:64:64-i64:64-n32:64-S128".to_string();
141+
}
142+
}
135143

136144
// Ensure the data-layout values hardcoded remain the defaults.
137145
if sess.target.is_builtin {

compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn target() -> Target {
4343
Target {
4444
llvm_target: "wasm32-unknown-emscripten".to_string(),
4545
pointer_width: 32,
46-
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(),
46+
data_layout: "e-m:e-p:32:32-i64:64-f128:64-n32:64-S128-ni:1:10:20".to_string(),
4747
arch: "wasm32".to_string(),
4848
options: opts,
4949
}

compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub fn target() -> Target {
5454
Target {
5555
llvm_target: "wasm32-unknown-unknown".to_string(),
5656
pointer_width: 32,
57-
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(),
57+
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20".to_string(),
5858
arch: "wasm32".to_string(),
5959
options,
6060
}

compiler/rustc_target/src/spec/wasm32_wasi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub fn target() -> Target {
109109
Target {
110110
llvm_target: "wasm32-wasi".to_string(),
111111
pointer_width: 32,
112-
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(),
112+
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20".to_string(),
113113
arch: "wasm32".to_string(),
114114
options,
115115
}

compiler/rustc_target/src/spec/wasm64_unknown_unknown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn target() -> Target {
3232
Target {
3333
llvm_target: "wasm64-unknown-unknown".to_string(),
3434
pointer_width: 64,
35-
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128".to_string(),
35+
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128-ni:1:10:20".to_string(),
3636
arch: "wasm64".to_string(),
3737
options,
3838
}

0 commit comments

Comments
 (0)