Subject: bug#78251: arm-trusted-firmware for pine64 FTBFS

From: Vagrant Cascadian <[email-masked]>
Date: Mon, 05 May 2025 10:59:45 -0700

On 2025-05-05, Vagrant Cascadian wrote:
> On 2025-05-05, Vagrant Cascadian wrote:
>> On 2025-05-05, Efraim Flashner wrote:
>>> I was trying to deploy a new generation on my pine64 and the
>>> arm-trusted-firmware failed to build.  I tried changing the make-flags
>>> on arm-trusted-firmware to set CFLAGS=-Os but the overflow was still 216
>>> bytes.  Changing it to -O2 made it 4312 bytes.  Adding DEBUG=0 didn't
>>> make a difference either.
> ...
>>> ld: address 0x500d8 of /tmp/guix-build-arm-trusted-firmware-sun50i-a64-2.12.1.drv-0/source/build/sun50i_a64/debug/bl31/bl31.elf section `.data' is not within region `RAM'
>>> ld: BL31 image has exceeded its limit.
>>> ld: region `RAM' overflowed by 216 bytes
>>> collect2: error: ld returned 1 exit status
>>> make: *** [Makefile:1557: /tmp/guix-build-arm-trusted-firmware-sun50i-a64-2.12.1.drv-0/source/build/sun50i_a64/debug/bl31/bl31.elf] Error 1
> ...
>> Might be worth bisecting to see where it started failing (presuming it
>> ever built natively)? I might give that a whirl...
>
> Well, the issue was introduced in the commit where 2.12.1 was added,
> 3aed6ee07bd0d22cd6cf897eada7ea3b95f6adf5, the immediately preceeding
> commit still built successfully.

And bisected upstream with:

  guix build --with-commit=arm-trusted-firmware-sun50i-a64=$(git show | awk '/^commit/{print $2}'}) arm-trusted-firmware-sun50i-a64

git bisect start
# status: waiting for both good and bad commits
# good: [4ec2948fe3f65dba2f19e691e702f7de2949179c] Merge "docs(changelog): changelog for v2.12 release" into integration
git bisect good 4ec2948fe3f65dba2f19e691e702f7de2949179c
# status: waiting for bad commit, 1 good commit known
# bad: [8cf9edba5cc3ec11ed5463f206aa5819f7fdbade] docs(changelog): changelog for lts-v2.12.1 release
git bisect bad 8cf9edba5cc3ec11ed5463f206aa5819f7fdbade
# good: [16b87247ed03fbe98c5c4a96c4dd00844ae53284] fix(security): add CVE-2024-7881 mitigation to Cortex-X3
git bisect good 16b87247ed03fbe98c5c4a96c4dd00844ae53284
# bad: [7e41b706e97c0e36e19d51b6a1785280e9ff4108] fix(cpus): workaround for Neoverse-N2 erratum 3701773
git bisect bad 7e41b706e97c0e36e19d51b6a1785280e9ff4108
# bad: [24526273fc504500c36029fa8c188f4e394f4f07] fix(cpus): workaround for Cortex-A720 erratum 3699561
git bisect bad 24526273fc504500c36029fa8c188f4e394f4f07
# bad: [7e4bf042a0dda901b9e5a7f79d37a34d81614e79] chore(cpus): fix incorrect header macro
git bisect bad 7e4bf042a0dda901b9e5a7f79d37a34d81614e79
# bad: [9427c061eb8dee00c32d72c20d6bc231002a575c] fix(security): apply SMCCC_ARCH_WORKAROUND_4 to affected cpus
git bisect bad 9427c061eb8dee00c32d72c20d6bc231002a575c
# good: [bea64fd5272deaf53111135baf36abb47b73b93e] fix(security): add support in cpu_ops for CVE-2024-7881
git bisect good bea64fd5272deaf53111135baf36abb47b73b93e
# first bad commit: [9427c061eb8dee00c32d72c20d6bc231002a575c] fix(security): apply SMCCC_ARCH_WORKAROUND_4 to affected cpus

Yay guix build --with-commit!!!!

Last time I built this version on Debian it worked fine ... but now you
have me wanting to double-check! Differences in the toolchains between
Debian and guix might be a clue...

live well,
  vagrant