From: Simon Glass <simon.glass@canonical.com> When CONFIG_ULIB is enabled for cross-compiled EFI builds, some built-in.o archives are empty (e.g. arch/riscv/cpu/generic/built-in.o for efi-riscv_app64). The objcopy --redefine-sym command fails on empty files. Skip them by checking the file size before calling objcopy, producing an empty output file to keep the archive list consistent. Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- scripts/build_api.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/build_api.py b/scripts/build_api.py index aa8b4f16a1a..a82cd83503c 100755 --- a/scripts/build_api.py +++ b/scripts/build_api.py @@ -356,6 +356,12 @@ class SymbolRedefiner: Returns: bool: True if file was modified, False otherwise """ + # Skip empty archives (objcopy cannot process them) + if os.path.getsize(path) == 0: + with open(outfile, 'wb'): + pass + return False + # Always run objcopy to apply redefinitions self.redefine_file(path, outfile) -- 2.43.0