Skip to content

Fails to link with rust-lld with an out of range error in latest Rust Nightly #73

Closed
rust-osdev/bootloader
#139
@w-henderson

Description

@w-henderson

I'm trying to build a project using bootimage and it successfully builds when I run cargo build (not using bootimage to make it bootable), but fails to compile when I run cargo run on the final step of compiling bootloader with bootimage. I wasn't sure whether to make this issue here or on bootloader, but my project compiles bootloader fine so I figured it was probably an issue with bootimage (or my environment!).

I get the following errors:

rust-lld: error: bootloader.30ac1y0p-cgu.0:(.boot-first-stage+0x81): relocation R_X86_64_16 out of range: 88576 is not in [-32768, 65535]; references _rest_of_bootloader_end_addr
          rust-lld: error: bootloader.30ac1y0p-cgu.0:(.boot+0x6A): relocation R_X86_64_16 out of range: 88576 is not in [-32768, 65535]; references _kernel_start_addr
          >>> defined in C:\Rust\Pogostick\target\bootimage\bootloader\x86_64-bootloader\release\deps\libbootloader-0325a9ea9e448093.rlib(kernel_bin-pogostick.o)

          rust-lld: error: bootloader.30ac1y0p-cgu.0:(.boot+0x85): relocation R_X86_64_16 out of range: 880472 is not in [-32768, 65535]; references _kernel_size
          >>> defined in C:\Rust\Pogostick\target\bootimage\bootloader\x86_64-bootloader\release\deps\libbootloader-0325a9ea9e448093.rlib(kernel_bin-pogostick.o)

My target JSON file looks like this:

{
  "llvm-target": "x86_64-unknown-none",
  "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
  "arch": "x86_64",
  "target-endian": "little",
  "target-pointer-width": "64",
  "target-c-int-width": "32",
  "os": "none",
  "executables": true,
  "linker-flavor": "ld.lld",
  "linker": "rust-lld",
  "panic-strategy": "abort",
  "disable-redzone": true,
  "features": "-mmx,-sse,+soft-float"
}

As a side note, it tells me I can run with --verbose to get additional info, but when I do, it only applies to the original build and not to bootloader's runner. I've already tried rebooting and running cargo clean.

Any advice would be much appreciated!

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