From 32edde868c1e7a37f9aa11e32c16cd3adce43c33 Mon Sep 17 00:00:00 2001 From: Tianhao Wang Date: Tue, 4 Jun 2024 22:33:00 +0200 Subject: toolchain: bump rust toolchain version 1. allow unexpected cfgs in lib.rs, in this case "no_global_oom_handling" is cause warnings [1] 2. for large code models the compiler (rust linkers) now put code and data in `.ltext`, `.ldata`, `.lbss`, `.lrodata` instead of the same `.text` , `.data` ... etc. We are adjusting accordingly in the linker script. 3. unsafe assertions identified undefined behaviours, in this case a repr(C) struct was not mared as repr(packed), therefore having an unexpected size. The unsafe assertions was not enabled by default in debug builds so the idt setup code with from_raw_parts_mut() has been working on UB. Glad we can catch this.... related: [1] https://github.com/rust-lang/rust/pull/123501 related: [2] https://blog.rust-lang.org/2024/05/02/Rust-1.78.0.html#asserting-unsafe-preconditions --- src/arch/x86_64/interrupt/mod.rs | 1 + src/lib.rs | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/arch/x86_64/interrupt/mod.rs b/src/arch/x86_64/interrupt/mod.rs index 6591bde..9273ef7 100644 --- a/src/arch/x86_64/interrupt/mod.rs +++ b/src/arch/x86_64/interrupt/mod.rs @@ -27,6 +27,7 @@ extern "C" { // [48:63] - addr[16:31] // [64:95] - addr[32:63] #[repr(C)] +#[repr(packed)] pub struct GateDescriptor64 { pub offset_1: u16, pub selector: u16, diff --git a/src/lib.rs b/src/lib.rs index 0d2fb02..f1499c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,6 @@ #![allow(dead_code)] #![allow(unused_imports)] +#![allow(unexpected_cfgs)] #![no_std] #![no_main] #![feature(const_option)] -- cgit v1.2.3-70-g09d2