From facf14996c32efef0c0bf63c0424069858787c6e Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Mon, 18 Dec 2017 14:50:22 -0700 Subject: util/cbfstool: calculate cbfs file size for xip stages The initial lookup for cbfs location for xip stages is implicitly using the ELF size assuming it's relatively equivalent. However, if the ELF that is being converted contains debug information or other metadata then the location lookup can fail because the ELF is considerably bigger than the real footprint. BUG=b:70801221 Change-Id: I47024dcd8205a09885d3a3f76e255eb5e3c55d9e Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/22936 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- util/cbfstool/elfparsing.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'util/cbfstool/elfparsing.h') diff --git a/util/cbfstool/elfparsing.h b/util/cbfstool/elfparsing.h index 978592bc46..1c6bf5e81a 100644 --- a/util/cbfstool/elfparsing.h +++ b/util/cbfstool/elfparsing.h @@ -124,4 +124,10 @@ int elf_writer_add_rel(struct elf_writer *ew, const char *sym, Elf64_Addr addr); */ int elf_writer_serialize(struct elf_writer *ew, struct buffer *out); +/* + * Calculate the loadable program's file size footprint. Returns < 0 on error, + * 0 on success. + */ +int elf_program_file_size(const struct buffer *input, size_t *file_size); + #endif /* ELFPARSING_H */ -- cgit v1.2.3