util/cbfstool/amdcompress: Bail out on invalid ELF

Ensure that only one PT_LOAD segment is inside the input ELF as
the tool only expects and support one PT_LOAD segment. Instead of silently
discarding all other PT_LOAD segments than the first throw an error.

Change-Id: I90cfc8b9dd0b5e8060880790e5ff0ce73843943b
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87315
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Rudolph 2025-04-15 09:37:28 +02:00 committed by Maximilian Brune
commit 69888bc7fc
2 changed files with 20 additions and 3 deletions

View file

@ -137,8 +137,9 @@ SECTIONS {
* .text and .reset breaks the integrity, as .bss or .data might get modified.
*
* Enable ENV_SEPARATE_DATA_AND_BSS for AMD's bootblock and mark as
* data_segment to place it in the second PT_LOAD area. AMDCOMPRESS will ignore
* the second PT_LOAD area and discard it.
* data_segment to place it in the second PT_LOAD area. The second PT_LOAD area
* must be removed using objcopy since AMDCOMPRESS doesn't support multiple
* PT_LOAD segments.
*/
. = BOOTBLOCK_ADDR & ~(16 - 1);
.data . : {