
On Thu, 16 Dec 2021 19:16:40 +0100 Pali Rohár pali@kernel.org wrote:
The reason that it currently works is just because gcc compiler does not do all checks before doing optimizations and so it currently does generate any errors or warnings.
Compiler cannot currently check this, only linker, because the function is always declared in mvebu's cpu.h.
See https://lore.kernel.org/u-boot/20211214134536.2baeb2a0@thinkpad/ where I also proposed empty static inline implementations for non-A375 platforms, but Stefan thinks it's not an issue currently, because it does not cause any regressions, I guess. U-Boot's build system currently does not allow for -O0, you can choose only -O2 or -Os.
We can always add empty static inline implementations into mvebu's cpu.h when it becomes an issue, or you can send a patch now, if you want a completely perfect code ASAP.
But note that for that you'll need to check other functions there, as well. (If you look at https://source.denx.de/u-boot/u-boot/-/blob/master/arch/arm/mach-mvebu/inclu... there are functions declared, without guarding #ifs, for all mvebu platforms: A3k, A7k, A37x and A38x.)
Marek