Hello,
I have a strange situation which I'm trying to figure out, I have a static library that also implements retargeting of _read and _write syscalls by using nosys specs on ARM GCC compiler. The idea is that you can retarget printf/scanf output/input to some other source like UART or in my case Segger RTT.
In my case, there is a syscalls.c file that has my specific syscalls implementation. If I don't call a single function directly in my object files, those custom syscalls from the static library will be completely ignored during the linking process. However, calling even one function somewhere in object files will cause all other functions from the static library to be linked by the linker, even if those other functions were not called directly. In this case, changing the order of the libraries makes no difference I believe this is something else from linking order.