Hi Marek,
On 25/11/2025 8:23 pm, Marek Vasut wrote:
[CAUTION: This email is from outside your organization. Unless you trust
the sender, do not click on links or open attachments as it may be a
fraudulent email attempting to steal your information and/or compromise
your computer.]
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")
?
I already have the referenced commit in my test branch, and I can
confirm that the same compilation error still appears on CycloneV when
certain directories produce no SPL objects.
The existing fix ensures that built-in.o is always present, but it does
not prevent ar from generating empty built-in.a archives, which older
ARM 32-bit linkers (such as CycloneV toolchains) reject as “file truncated”.
This patch complements the earlier fix by ensuring that each SPL
directory contributes at least one real object, so the resulting
built-in.a archives are non-empty and accepted by all toolchains. It
does not change runtime behavior—only ensures the archives remain valid.
Thanks,
Alif