[PATCH v1 2/8] arm: Fix "file truncated" linker errors from empty built-in.a in SPL/TPL/VPL builds
Marek Vasut
marek.vasut at mailbox.org
Tue Nov 25 13:23:04 CET 2025
On 11/25/25 9:13 AM, alif.zakuan.yuslaimi at altera.com wrote:
> From: Tien Fong Chee <tien.fong.chee at intel.com>
>
> 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 <tien.fong.chee at altera.com>
> Signed-off-by: Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi at altera.com>
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")
?
More information about the U-Boot
mailing list