On 11/25/25 9:13 AM, [email protected] wrote:
From: Tien Fong Chee <[email protected]>
When building 32-bit ARM SPL (e.g. Arria 10), linking may fail with:
arch/arm/cpu/built-in.a: file not recognized: File truncated
cmd/built-in.a: file not recognized: File truncated
dts/built-in.a: file not recognized: File truncated
This happens when a directory (such as arch/arm/cpu/, cmd/, or dts/)
produces no object files under SPL. GNU `ar` still creates a zero-length
archive, which older ARM 32-bit linkers (arm-linux-gnueabihf-ld) treat as
invalid. The final link step then aborts with the "file truncated" error.
By contrast, 64-bit SoCFPGA (Agilex 5) builds use aarch64 linkers that
tolerate empty thin archives, so the same condition does not cause an
error.
To make XPL (SPL/TPL/VPL) builds consistent across architectures, this
patch ensures each affected directory always contributes at least one valid
object:
* `arch/arm/cpu/Makefile` — add a persistent `dummy.o`
* `cmd/Makefile` — add `dummy.o` only when CONFIG_XPL_BUILD=y
* `dts/Makefile` — add `dummy.o` only when CONFIG_XPL_BUILD=y
These dummy objects define no functional code and do not affect runtime
behavior. They only guarantee a valid archive for the linker, preventing
false "file truncated" errors on strict toolchains.
Signed-off-by: Tien Fong Chee <[email protected]>
Signed-off-by: Alif Zakuan Yuslaimi <[email protected]>
Such generic fixes should not be buried in SoC specific series.
+CC Tom
Maybe you need a fix similar to
37a777e1286e ("Makefile: Make sure all linker input objects exist")
?