Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linking with rust-lld failed: exit status: 1 #87

Closed
saivishwak opened this issue Oct 8, 2022 · 4 comments
Closed

linking with rust-lld failed: exit status: 1 #87

saivishwak opened this issue Oct 8, 2022 · 4 comments

Comments

@saivishwak
Copy link

Build Error ->

Building bootloader
Compiling bootloader v0.9.23 (/home/vishwak/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/bootloader-0.9.23)
error: linking with rust-lld failed: exit status: 1
|
= note: "rust-lld" "-flavor" "gnu" "/tmp/rustce5sqQC/symbols.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.0.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.10.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.11.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.12.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.13.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.14.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.15.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.2.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.3.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.4.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.5.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.6.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.7.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.8.rcgu.o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.9.rcgu.o" "--as-needed" "-L" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps" "-L" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/release/deps" "-L" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/build/bootloader-fde440b665d7cabe/out" "-L" "/home/vishwak/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-bootloader/lib" "-Bstatic" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libxmas_elf-1b0eb3c9e888241a.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libzero-57189841b2339f05.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libx86_64-e25559ea51de7d3f.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libvolatile-d6ac5c40aab33080.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libbitflags-31a974eb394720c5.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libbit_field-9221251971479c34.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libusize_conversions-62d1ca308bc02994.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libfixedvec-ff02a9f57794635e.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libbootloader-2367883e8c24fdcd.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/librlibc-49b62c07f530266c.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/librustc_std_workspace_core-22c20f375a03a6ed.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libcore-12df7a30b9be6a65.rlib" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/libcompiler_builtins-b00de6a92c2e2781.rlib" "-Bdynamic" "--eh-frame-hdr" "-znoexecstack" "-L" "/home/vishwak/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-bootloader/lib" "-o" "/home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7" "--gc-sections" "-O1"
= note: rust-lld: error: undefined symbol: _rest_of_bootloader_start_addr
>>> referenced by bootloader.cc87495c-cgu.1
>>> /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot-first-stage+0x60)
>>> referenced by bootloader.cc87495c-cgu.1
>>> /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot-first-stage+0x7B)

      rust-lld: error: undefined symbol: _rest_of_bootloader_end_addr
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot-first-stage+0x81)

      rust-lld: error: undefined symbol: _kernel_buffer
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x59)

      rust-lld: error: undefined symbol: _memory_map
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0xCA)
      >>> referenced by main.rs:108 (src/main.rs:108)
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(stage_4)

      rust-lld: error: undefined symbol: __page_table_start
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x1A1)
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x20C)
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x219)
      >>> referenced 2 more times

      rust-lld: error: undefined symbol: __page_table_end
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x1A6)
      >>> referenced by main.rs:111 (src/main.rs:111)
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(stage_4)
      >>> referenced by main.rs:105 (src/main.rs:105)
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(stage_4)

      rust-lld: error: undefined symbol: _p3
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x1B4)
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x1C9)

      rust-lld: error: undefined symbol: _p4
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x1BC)
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x24C)
      >>> referenced by main.rs:114 (src/main.rs:114)
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(stage_4)
      >>> referenced 1 more times

      rust-lld: error: undefined symbol: _p2
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x1C1)
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x1D6)
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x1FB)

      rust-lld: error: undefined symbol: _p1
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x1CE)
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x231)
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x371)

      rust-lld: error: undefined symbol: __bootloader_end
      >>> referenced by bootloader.cc87495c-cgu.1
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(.boot+0x221)
      >>> referenced by main.rs:113 (src/main.rs:113)
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(stage_4)
      >>> referenced by main.rs:105 (src/main.rs:105)
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(stage_4)

      rust-lld: error: undefined symbol: __bootloader_start
      >>> referenced by main.rs:112 (src/main.rs:112)
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(stage_4)
      >>> referenced by main.rs:105 (src/main.rs:105)
      >>>               /home/vishwak/Desktop/rob_os/target/bootimage/bootloader/x86_64-bootloader/release/deps/bootloader-450374ad17af6ce7.bootloader.cc87495c-cgu.1.rcgu.o:(stage_4)

error: could not compile bootloader due to previous error
Error: Bootloader build failed.
Stderr:

@paandahl
Copy link

paandahl commented Oct 9, 2022

I think there has been a slight breaking change in the Rust compiler. I had the same problem and was able to work around it by changing from "ld.lld" to "ld" within the "pre-link-args"-section of:

/home/vishwak/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/bootloader-0.9.23/x86_64-bootloader.json

@KurlykovDanila
Copy link

I also encountered the same problem in rustc 1.66.0-nightly. I was helped by rolling back to the version (nightly-2022-07-15-x86_64), rustc 1.64.0-nightly

@phil-opp
Copy link
Member

Thanks for reporting! This appears to be an accidental regression in rustc, which is going to be fixed by rust-lang/rust#102836. Until then, staying on an older nightly is probably the best workaround for now.

See also rust-osdev/bootloader#271.

@phil-opp
Copy link
Member

This should be fixed on the latest Rust nightlies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants