Skip to content

Build failure with nightly-2025-11-23 #520

Description

@dzamlo

Starting with nightly-2025-11-23 bootloader fails to build. It works with the previous nightly.

I get the following error message:

  Compiling bootloader v0.11.12
error: failed to run custom build command for `bootloader v0.11.12`

Caused by:
  process didn't exit successfully: `/tmp/dzamlos/target/debug/build/bootloader-e377ee581c7317f0/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-env=UEFI_BOOTLOADER_PATH=/tmp/dzamlos/target/debug/build/bootloader-eae601fc55b62ccf/out/bin/bootloader-x86_64-uefi.efi

  --- stderr
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
       Ignored package `bootloader-x86_64-bios-stage-4 v0.11.12` is already installed, use --force to override
  warning: be sure to add `/tmp/dzamlos/target/debug/build/bootloader-eae601fc55b62ccf/out/bin` to your PATH to be able to run the installed binaries
       Ignored package `bootloader-x86_64-bios-boot-sector v0.11.12` is already installed, use --force to override
  warning: be sure to add `/tmp/dzamlos/target/debug/build/bootloader-eae601fc55b62ccf/out/bin` to your PATH to be able to run the installed binaries
       Ignored package `bootloader-x86_64-bios-stage-3 v0.11.12` is already installed, use --force to override
  warning: be sure to add `/tmp/dzamlos/target/debug/build/bootloader-eae601fc55b62ccf/out/bin` to your PATH to be able to run the installed binaries
      Updating crates.io index
      Blocking waiting for file lock on package cache
      Updating crates.io index
    Installing bootloader-x86_64-uefi v0.11.12
      Blocking waiting for file lock on package cache
      Updating crates.io index
    Installing bootloader-x86_64-bios-stage-2 v0.11.12
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Updating crates.io index
  warning: package `atomic-polyfill v0.1.11` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
  warning: package `critical-section v1.1.1` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
      Updating crates.io index
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Updating crates.io index
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
     Compiling compiler_builtins v0.1.160 (/home/dzamlo/.rustup/toolchains/nightly-2025-11-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/compiler-builtins/compiler-builtins)
     Compiling core v0.0.0 (/home/dzamlo/.rustup/toolchains/nightly-2025-11-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
     Compiling bootloader-x86_64-bios-stage-2 v0.11.12
     Compiling compiler_builtins v0.1.160 (/home/dzamlo/.rustup/toolchains/nightly-2025-11-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/compiler-builtins/compiler-builtins)
     Compiling core v0.0.0 (/home/dzamlo/.rustup/toolchains/nightly-2025-11-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
     Compiling proc-macro2 v1.0.63
     Compiling quote v1.0.29
     Compiling unicode-ident v1.0.10
     Compiling autocfg v1.1.0
     Compiling semver v1.0.17
     Compiling syn v1.0.109
     Compiling rustversion v1.0.13
     Compiling serde v1.0.166
     Compiling x86 v0.52.0
     Compiling bootloader_api v0.11.12
     Compiling lock_api v0.4.10
     Compiling rustc_version v0.4.0
     Compiling heapless v0.7.16
     Compiling syn v2.0.23
     Compiling serde_derive v1.0.166
     Compiling ptr_meta_derive v0.2.0
     Compiling uefi-macros v0.11.0
     Compiling byteorder v1.4.3
     Compiling bootloader-x86_64-bios-common v0.11.12
     Compiling mbr-nostd v0.1.0
     Compiling bit_field v0.10.2
     Compiling scopeguard v1.1.0
     Compiling bitflags v1.3.2
     Compiling bitflags v2.3.3
     Compiling byteorder v1.4.3
     Compiling rand_core v0.6.4
     Compiling stable_deref_trait v1.2.0
     Compiling conquer-util v0.3.0
     Compiling zero v0.1.3
     Compiling volatile v0.4.6
     Compiling log v0.4.19
     Compiling noto-sans-mono-bitmap v0.2.0
     Compiling ptr_meta v0.2.0
     Compiling usize_conversions v0.2.0
     Compiling ryu v1.0.14
     Compiling raw-cpuid v10.7.0
     Compiling conquer-once v0.3.2
     Compiling xmas-elf v0.8.0
     Compiling ucs2 v0.3.2
     Compiling hash32 v0.2.1
     Compiling x86_64 v0.15.2
     Compiling rand_hc v0.3.2
     Compiling rand v0.8.5
     Compiling uefi v0.20.0
     Compiling spin v0.9.8
     Compiling spinning_top v0.2.5
     Compiling bootloader-boot-config v0.11.12
     Compiling serde-json-core v0.5.0
  error: linking with `rust-lld` failed: exit status: 1
    |
    = note:  "rust-lld" "-flavor" "gnu" "/tmp/rustcBYTyv6/symbols.o" "<1 object files omitted>" "--as-needed" "-Bstatic" "/tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/{libmbr_nostd-a1b12f5c01619a7f,libbyteorder-dfade3d69d30e643,libbootloader_x86_64_bios_common-047c14d8bc562c32,libcore-a50c746e36f164d0"
    = note: some arguments are omitted. use `--verbose` to show all linker arguments
    = note: rust-lld: error: /tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/bootloader_x86_64_bios_stage_2-c16bbb4799c43bd6.bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0.rcgu.o:(function bootloader_x86_64_bios_stage_2::start: .text._RNvCs2ztQT3sXfKN_30bootloader_x86_64_bios_stage_25start+0x251):'
            >>> referenced by bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0
            
            rust-lld: error: /tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/bootloader_x86_64_bios_stage_2-c16bbb4799c43bd6.bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0.rcgu.o:(function bootloader_x86_64_bios_stage_2::start: .text._RNvCs2ztQT3sXfKN_30bootloader_x86_64_bios_stage_25start+0x25a):'
            >>> referenced by bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0
            
            rust-lld: error: /tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/bootloader_x86_64_bios_stage_2-c16bbb4799c43bd6.bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0.rcgu.o:(function bootloader_x86_64_bios_stage_2::start: .text._RNvCs2ztQT3sXfKN_30bootloader_x86_64_bios_stage_25start+0x260):'
            >>> referenced by bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0
            
            rust-lld: error: /tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/bootloader_x86_64_bios_stage_2-c16bbb4799c43bd6.bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0.rcgu.o:(function bootloader_x86_64_bios_stage_2::start: .text._RNvCs2ztQT3sXfKN_30bootloader_x86_64_bios_stage_25start+0x265):'
            >>> referenced by bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0
            
            rust-lld: error: /tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/bootloader_x86_64_bios_stage_2-c16bbb4799c43bd6.bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0.rcgu.o:(function bootloader_x86_64_bios_stage_2::start: .text._RNvCs2ztQT3sXfKN_30bootloader_x86_64_bios_stage_25start+0x278):'
            >>> referenced by bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0
            
            rust-lld: error: /tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/bootloader_x86_64_bios_stage_2-c16bbb4799c43bd6.bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0.rcgu.o:(function bootloader_x86_64_bios_stage_2::start: .text._RNvCs2ztQT3sXfKN_30bootloader_x86_64_bios_stage_25start+0x289):'
            >>> referenced by bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0
            
            rust-lld: error: /tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/bootloader_x86_64_bios_stage_2-c16bbb4799c43bd6.bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0.rcgu.o:(function bootloader_x86_64_bios_stage_2::start: .text._RNvCs2ztQT3sXfKN_30bootloader_x86_64_bios_stage_25start+0x294):'
            >>> referenced by bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0
            
            rust-lld: error: /tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/bootloader_x86_64_bios_stage_2-c16bbb4799c43bd6.bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0.rcgu.o:(function bootloader_x86_64_bios_stage_2::start: .text._RNvCs2ztQT3sXfKN_30bootloader_x86_64_bios_stage_25start+0x2c3):'
            >>> referenced by bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0
            
            rust-lld: error: /tmp/cargo-installGZT1C1/i386-code16-stage-2/stage-2/deps/bootloader_x86_64_bios_stage_2-c16bbb4799c43bd6.bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0.rcgu.o:(function bootloader_x86_64_bios_stage_2::start: .text._RNvCs2ztQT3sXfKN_30bootloader_x86_64_bios_stage_25start+0x2c8):'
            >>> referenced by bootloader_x86_64_bios_stage_2.1df601a3f4a6dbdb-cgu.0
            

  error: could not compile `bootloader-x86_64-bios-stage-2` (bin "bootloader-x86_64-bios-stage-2") due to 1 previous error
  error: failed to compile `bootloader-x86_64-bios-stage-2 v0.11.12`, intermediate artifacts can be found at `/tmp/cargo-installGZT1C1`.
  To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

  thread '<unnamed>' (154529) panicked at /home/dzamlo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bootloader-0.11.12/build.rs:229:9:
  failed to build bios second stage
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  thread '<unnamed>' (154527) panicked at /home/dzamlo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bootloader-0.11.12/build.rs:34:61:
  called `Result::unwrap()` on an `Err` value: Any { .. }
     Compiling uart_16550 v0.3.2
     Compiling bootloader-x86_64-common v0.11.12
     Compiling bootloader-x86_64-uefi v0.11.12
      Finished `release` profile [optimized] target(s) in 27.33s
    Installing /tmp/dzamlos/target/debug/build/bootloader-eae601fc55b62ccf/out/bin/bootloader-x86_64-uefi.efi
     Installed package `bootloader-x86_64-uefi v0.11.12` (executable `bootloader-x86_64-uefi.efi`)
  warning: be sure to add `/tmp/dzamlos/target/debug/build/bootloader-eae601fc55b62ccf/out/bin` to your PATH to be able to run the installed binaries

  thread 'main' (154525) panicked at /home/dzamlo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bootloader-0.11.12/build.rs:17:29:
  called `Result::unwrap()` on an `Err` value: Any { .. }

It seems there is some linking error when building stage 2.

Activity

  1. Freax13 commented on Nov 26, 2025

    @Freax13
    Member

    Some early debugging results:

    1. The executable is too big. This causes the linker to fail because some relocations exceed the maximum offset. This can be fixed by changing the opt-level to "z".
    2. This write call crashes. I'm not sure why. This only seems to be happening on nightly-2025-11-21 and later. It works on nightly-2025-11-20. AFAICT this isn't caused by the fix for the first issue. Shrinking the file size by other means still has this line failing, so I don't think it's the opt-level. Removing write call allows the kernel to boot.
  2. phil-opp commented on Nov 27, 2025

    @phil-opp
    Member

    Thanks for reporting!

    The executable is too big. This causes the linker to fail because some relocations exceed the maximum offset.

    Note to myself: The relevant part of the error message for this is:

    .text._RNvCs7jEuvmlywsb_30bootloader_x86_64_bios_stage_25start+0x251): relocation R_386_16 out of range: 74743 is not in [-32768, 65535]; references section '.bss._RNvNvXNtCs33L8l6sfb8U_30bootloader_x86_64_bios_stage_24diskNtB4_10DiskAccessNtB4_4Read10read_exact7TMP_BUF'

  3. phil-opp commented on Nov 27, 2025

    @phil-opp
    Member

    This is the rustc changelog between the two nightlies (working and failing): rust-lang/rust@07bdbae...53732d5

  4. phil-opp commented on Nov 27, 2025

    @phil-opp
    Member

    I think the most likely candidate is rust-lang/rust#89917. The change was announced in https://blog.rust-lang.org/2025/11/20/switching-to-v0-mangling-on-nightly/.

    I just tried to add the following to build_bios_stage_2 and this seems to fix cargo check:

    cmd.env(
        "RUSTFLAGS",
        "-Csymbol-mangling-version=legacy -Zunstable-options"
    );

    I still don't understand how the name mangling scheme has such a size impact on binary size though...

  5. phil-opp commented on Nov 27, 2025

    @phil-opp
    Member

    I still don't understand how the name mangling scheme has such a size impact on binary size though...

    Scratch that, the binary size seems to be unchanged. The .text, .start, and .bss. have the exact same size with the old and new mangling schemes. The .rodata is getting 4 bytes smaller with the new mangling scheme (probably some alignment noise). The .strtab is getting even 235 bytes smaller with the new mangling scheme.

    The ELF binary size is 480 before with both the new and old mangling schemes, so there is no size increase at all.

  6. phil-opp commented on Nov 27, 2025

    @phil-opp
    Member

    It looks like this is just some linker magic that organizes things a bit differently in the respective sections. When I move the .bss section before the .text section through the linker script, it seems to work again. I'll prepare a PR with this change.

  7. adoerr commented on Nov 28, 2025

    @adoerr
    1. This write call crashes. I'm not sure why. This only seems to be happening on nightly-2025-11-21 and later. It works on nightly-2025-11-20. AFAICT this isn't caused by the fix for the first issue. Shrinking the file size by other means still has this line failing, so I don't think it's the opt-level. Removing write call allows the kernel to boot.

    I ran into the same issue using a derivative of bootloader. In my case reducing the size of the buffer (to 1024 bytes) provided to VesaInfo:query() fixed the issue without having to revert to legacy name-mangling. Not sure, both things are related, though. Just wanted to share my observation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions