Public bug reported:
Building the Ubuntu kernel for riscv64 with certain
configurations/toolchains fails at link time with undefined reference
errors for __bswapsi2() and __bswapdi2().
These are GCC/Clang compiler runtime builtins that the toolchain emits
for byte-swapping 32-bit and 64-bit quantities (e.g., from
__builtin_bswap32/__builtin_bswap64 or swab operations) when it cannot
expand them inline. The kernel does not provide these symbols, so the
final link fails with errors such as:
```
ld: undefined reference to `__bswapsi2'
ld: undefined reference to `__bswapdi2'
```
Fix: Provide kernel implementations of these helpers for riscv. Add
arch/riscv/lib/bswapsi.c and arch/riscv/lib/bswapdi.c, implementing
__bswapsi2() and __bswapdi2() on top of the existing
___constant_swab32()/___constant_swab64() macros, export the symbols,
and wire them into the build via lib-y in arch/riscv/lib/Makefile.
** Affects: linux-riscv (Ubuntu)
Importance: Undecided
Assignee: Sarah Emery (semerys)
Status: New
** Affects: linux-riscv (Ubuntu Noble)
Importance: Undecided
Assignee: Sarah Emery (semerys)
Status: New
** Also affects: linux-riscv (Ubuntu Noble)
Importance: Undecided
Status: New
** Changed in: linux-riscv (Ubuntu)
Assignee: (unassigned) => Sarah Emery (semerys)
** Changed in: linux-riscv (Ubuntu Noble)
Assignee: (unassigned) => Sarah Emery (semerys)
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2163639
Title:
undefined reference to __bswapsi2/__bswapdi2 at kernel link time
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-riscv/+bug/2163639/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs