You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmake: linking app with runtime library together with rust app library
The Zephyr PR zephyrproject-rtos/zephyr#78320
clean up and improves link handling in Zephyr.
One improvement is the deterministic and correct link location of
runtime and C library linking at the end of link arguments to ensure
all libraries are able to use standard functions.
However the librustapp.a library created by the cargo tool also contains
runtime functions. It would in most cases be considered correct that a
library, such as librustapp.a, which provides functions are linked first
so that those functions provided as part of rust toolchain takes
precedence over the runtime library provided by the C / C++ toolchain.
However on the riscv32 / riscv64 architecture the rust prebuilt
libraries makes use of relocation types in the clzsi2 object which are
unknown to the ld linker in use.
Thus linking librustapp.a first, for example like `librustapp.a -lgcc`
results in the following warning (and thus CI failures):
> <path>/ld.bfd: <path>/librustapp.a(45c91108d938afe8-clzdi2.o):
> unsupported relocation type 0x3d
Therefore we ensure that the runtime library is linked first, for
example `-lgcc librustapp.a`.
Signed-off-by: Torsten Rasmussen <[email protected]>
0 commit comments