Skip to content

AEABI division function linking problems (again) #533

Closed
@Lokathor

Description

@Lokathor

I got a bug report yesterday that the gba crate no longer builds because of linking errors (rust-console/gba#187).

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "C:\\Users\\Daniel\\AppData\\Local\\Temp\\rustccI5P5G\\symbols.o" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\examples\\hello-472b02b74d42dc56.hello.ff7e989594f6dafe-cgu.0.rcgu.o" "--as-needed" "-L" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\deps" "-L" "D:\\dev\\gba\\target\\debug\\deps" "-L" "C:\\Users\\Daniel\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv4t-none-eabi\\lib" "-Bstatic" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\deps\\libgba-9a437158f6d53742.rlib" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\deps\\libbracer-de8a5334b1c7d053.rlib" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\deps\\libbitfrob-c6a9cbfb626642c0.rlib" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\deps\\libvoladdress-6c15bc02bfc75894.rlib" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\deps\\librustc_std_workspace_core-a7ec4ea53facd032.rlib" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\deps\\libcore-71be2443f3a85b43.rlib" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\deps\\libcompiler_builtins-d2b4ad49f4a33cb8.rlib" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-L" "C:\\Users\\Daniel\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv4t-none-eabi\\lib" "-o" "D:\\dev\\gba\\target\\thumbv4t-none-eabi\\debug\\examples\\hello-472b02b74d42dc56" "--gc-sections" "-O1" "-Tlinker_scripts/mono_boot.ld"
  = note: rust-lld: error: duplicate symbol: __aeabi_uidiv
          >>> defined at asm_runtime.rs:206 (src\asm_runtime.rs:206)
          >>>            gba-9a437158f6d53742.gba.d4abc47cdc4ad47-cgu.0.rcgu.o:(__aeabi_uidiv) in archive D:\dev\gba\target\thumbv4t-none-eabi\debug\deps\libgba-9a437158f6d53742.rlib
          >>> defined at macros.rs:372 (src\macros.rs:372)
          >>>            compiler_builtins-d2b4ad49f4a33cb8.compiler_builtins.ee71fd72058c181a-cgu.0.rcgu.o:(.text.__aeabi_uidiv+0x1) in archive D:\dev\gba\target\thumbv4t-none-eabi\debug\deps\libcompiler_builtins-d2b4ad49f4a33cb8.rlib

          rust-lld: error: duplicate symbol: __aeabi_idiv
          >>> defined at asm_runtime.rs:248 (src\asm_runtime.rs:248)
          >>>            gba-9a437158f6d53742.gba.d4abc47cdc4ad47-cgu.0.rcgu.o:(__aeabi_idiv) in archive D:\dev\gba\target\thumbv4t-none-eabi\debug\deps\libgba-9a437158f6d53742.rlib
          >>> defined at macros.rs:372 (src\macros.rs:372)
          >>>            compiler_builtins-d2b4ad49f4a33cb8.compiler_builtins.ee71fd72058c181a-cgu.0.rcgu.o:(.text.__aeabi_idiv+0x1) in archive D:\dev\gba\target\thumbv4t-none-eabi\debug\deps\libcompiler_builtins-d2b4ad49f4a33cb8.rlib


error: could not compile `gba` (example "hello") due to previous error

And, indeed, if I comment the division functions from the gba crate then it does build.

In #478 the division functions were made to be weak-link, so this seems to be a regression of some form.

Looking into the recent PRs, #526 may have done something weird? I'm not familiar enough with the macros to say for sure, but the person who reported the bug to the gba crate said that the Nightly from May 1 didn't have the problem, and now there is the problem, so the dates would seem to line up.

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