diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-08-13 18:43:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-13 18:43:02 +0200 |
| commit | a6146fddcf87653df30cb3b8a99ce2784b4de055 (patch) | |
| tree | 9663079c730dce26206ead59efd62af004292b23 | |
| parent | bd6fb635965cbbc8c70f5e011b5c19711e52a5fe (diff) | |
| parent | 2563e4a7ffe47e93c69283c14e6d660b08834cf1 (diff) | |
| download | rust-a6146fddcf87653df30cb3b8a99ce2784b4de055.tar.gz rust-a6146fddcf87653df30cb3b8a99ce2784b4de055.zip | |
Rollup merge of #145241 - tomtor:avr-layout, r=nikic
[AVR] Changed data_layout This change is required when https://github.com/llvm/llvm-project/commit/97f0ff0c80407adee693436b44e55ededfcd5435 gets included in the Rust llvm tree, because it changes the AVR data-layout
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_target/src/spec/targets/avr_none.rs | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index ee77774c688..27ae729a531 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -213,6 +213,12 @@ pub(crate) unsafe fn create_module<'ll>( target_data_layout = target_data_layout.replace("p8:128:128:128:48", "p8:128:128") } } + if llvm_version < (22, 0, 0) { + if sess.target.arch == "avr" { + // LLVM 22.0 updated the default layout on avr: https://github.com/llvm/llvm-project/pull/153010 + target_data_layout = target_data_layout.replace("n8:16", "n8") + } + } // Ensure the data-layout values hardcoded remain the defaults. { diff --git a/compiler/rustc_target/src/spec/targets/avr_none.rs b/compiler/rustc_target/src/spec/targets/avr_none.rs index 07ed2a37803..ad056d02326 100644 --- a/compiler/rustc_target/src/spec/targets/avr_none.rs +++ b/compiler/rustc_target/src/spec/targets/avr_none.rs @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { host_tools: None, std: None, }, - data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".into(), + data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8:16-a:8".into(), llvm_target: "avr-unknown-unknown".into(), pointer_width: 16, options: TargetOptions { |
