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

Linker errors on newer nightly Rust builds #187

Closed
gruxor opened this issue Jun 27, 2023 · 2 comments
Closed

Linker errors on newer nightly Rust builds #187

gruxor opened this issue Jun 27, 2023 · 2 comments

Comments

@gruxor
Copy link

gruxor commented Jun 27, 2023

Title, more or less. Getting the following:

rust-lld: error: duplicate symbol: __aeabi_idiv
          >>> defined at asm_runtime.rs:248 (src\asm_runtime.rs:248)
          >>>            gba-ffbf70226406fe56.gba.73b0a98ac837cf68-cgu.13.rcgu.o:(__aeabi_idiv) in archive C:\dev\rust\crex\target\thumbv4t-none-eabi\debug\deps\libgba-ffbf70226406fe56.rlib
          >>> defined at macros.rs:372 (src\macros.rs:372)
          >>>            compiler_builtins-b0a5ccc670b7af0d.compiler_builtins.db29d814410a5d62-cgu.15.rcgu.o:(.text.__aeabi_idiv+0x1) in archive C:\dev\rust\crex\target\thumbv4t-none-eabi\debug\deps\libcompiler_builtins-b0a5ccc670b7af0d.rlib

rust-lld: error: duplicate symbol: __aeabi_uidiv
          >>> defined at asm_runtime.rs:206 (src\asm_runtime.rs:206)
          >>>            gba-ffbf70226406fe56.gba.73b0a98ac837cf68-cgu.13.rcgu.o:(__aeabi_uidiv) in archive C:\dev\rust\crex\target\thumbv4t-none-eabi\debug\deps\libgba-ffbf70226406fe56.rlib
          >>> defined at macros.rs:372 (src\macros.rs:372)
          >>>            compiler_builtins-b0a5ccc670b7af0d.compiler_builtins.db29d814410a5d62-cgu.8.rcgu.o:(.text.__aeabi_uidiv+0x1) in archive C:\dev\rust\crex\target\thumbv4t-none-eabi\debug\deps\libcompiler_builtins-b0a5ccc670b7af0d.rlib

Issue occurs even with a barebones/brand new project, just by importing the prelude or anything that uses the above MMIO functions. I'm guessing they implemented these functions on the target with the same names, but I'm not familiar enough with the guts of the toolchain to know one way or the other.

Did do some minor testing to see roughly when it started, it appears nightly-2023-05-01-x86_64-pc-windows-msvc works but nightly-2023-06-01-x86_64-pc-windows-msvc doesn't, so it's a change sometime in May. Didn't test this on other operating systems yet, could be isolated to Windows.

@Lokathor
Copy link
Member

Yes, as you guessed: This is an issue with the compiler built-ins crate providing a symbol that the gba crate also provides (since it's standard ARM function it's got a standard name so llvm can link to it). I thought we'd fixed this but i guess there's some sort of regression going on. I will attempt to look into it tomorrow. I expect the fix to be small, but even if so it will probably be a few days minimum for an updated compiler_builtins crate to get out to Nightly.

If you want to get a temporary fix immediately while also using latest Nightly you can clone this repo and delete those two functions and it should build. However, using a Nightly from May is probably also fine until this gets sorted out.

@Lokathor
Copy link
Member

Lokathor commented Mar 4, 2024

There's a work around: rust-lang/compiler-builtins#533 (comment)

Since there's been no movement in a while, I just put this info in the README and I guess it's "fine".

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

2 participants