8000 Move architecture checks from build script into lib.rs (#91) · rust-osdev/bootloader@068833e · GitHub
[go: up one dir, main page]

Skip to content
  • Commit 068833e

    Browse files
    authored
    Move architecture checks from build script into lib.rs (#91)
    The build script always gets compiled for the host platform, so it only checked that the _host_ was `x86_64`. With the check in lib.rs, we correctly verify that the target is `x86_64`.
    1 parent 90f5b89 commit 068833e

    File tree

    2 files changed

    +10
    -10
    lines changed

    2 files changed

    +10
    -10
    lines changed

    build.rs

    Lines changed: 1 addition & 10 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,14 +1,5 @@
    11
    #[cfg(not(feature = "binary"))]
    2-
    fn main() {
    3-
    #[cfg(target_arch = "x86")]
    4-
    compile_error!(
    5-
    "This crate currently does not support 32-bit protected mode. \
    6-
    See https://github.com/rust-osdev/bootloader/issues/70 for more information."
    7-
    );
    8-
    9-
    #[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
    10-
    compile_error!("This crate only supports the x86_64 architecture.");
    11-
    }
    2+
    fn main() {}
    123

    134
    #[cfg(feature = "binary")]
    145
    #[derive(Default)]

    src/lib.rs

    Lines changed: 9 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -12,6 +12,15 @@ pub use crate::bootinfo::BootInfo;
    1212

    1313
    pub mod bootinfo;
    1414

    15+
    #[cfg(target_arch = "x86")]
    16+
    compile_error!(
    17+
    "This crate currently does not support 32-bit protected mode. \
    18+
    See https://github.com/rust-osdev/bootloader/issues/70 for more information."
    19+
    );
    20+
    21+
    #[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
    22+
    compile_error!("This crate only supports the x86_64 architecture.");
    23+
    1524
    /// Defines the entry point function.
    1625
    ///
    1726
    /// The function must have the signature `fn(&'static BootInfo) -> !`.

    0 commit comments

    Comments
     (0)
    0