E.g., using
TOOL = /opt/rpi/arm-gcc/bin $(TOOL)/arm-none-linux-gnueabihf-ld.gold
where /opt/rpi/arm-gcc is the contents of gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz, I get this output:
Attempt to open /opt/rpi/sysroot/opt/vc/lib/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/lib/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/lib/libbcm_host.a failed Attempt to open /opt/rpi/sysroot/usr/lib/libbcm_host.a failed error: cannot find -lbcm_host
So it's only looking for .a libs instead of finding /opt/rpi/sysroot/opt/vc/lib/libbcm_host.so, which exists. I'm passing -Bdynamic to the linker, what am I missing?
I've tried compiling on a Raspberry Pi 4 B using native compiler and the result is the same.
...which means there wasn't an issue with the linker directly, but rather the makefile. After reviewing some wrong paths I added -fpie -fPIE to the compiler options and -pie to the linker options and the linker went for dynamic libraries,