Skip to content

Commit 2563e4a

Browse files
committed
[AVR] Changed data_layout
1 parent 7f7b8ef commit 2563e4a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ pub(crate) unsafe fn create_module<'ll>(
213213
target_data_layout = target_data_layout.replace("p8:128:128:128:48", "p8:128:128")
214214
}
215215
}
216+
if llvm_version < (22, 0, 0) {
217+
if sess.target.arch == "avr" {
218+
// LLVM 22.0 updated the default layout on avr: https://github.com/llvm/llvm-project/pull/153010
219+
target_data_layout = target_data_layout.replace("n8:16", "n8")
220+
}
221+
}
216222

217223
// Ensure the data-layout values hardcoded remain the defaults.
218224
{

compiler/rustc_target/src/spec/targets/avr_none.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub(crate) fn target() -> Target {
99
host_tools: None,
1010
std: None,
1111
},
12-
data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".into(),
12+
data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8:16-a:8".into(),
1313
llvm_target: "avr-unknown-unknown".into(),
1414
pointer_width: 16,
1515
options: TargetOptions {

0 commit comments

Comments
 (0)