From: Jan Beulich Date: Fri, 6 Sep 2024 06:34:24 +0000 (+0200) Subject: bfd/PE: correct SizeOfImage calculation X-Git-Tag: gdb-16-branchpoint~991 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a844415db8784bf92c0adc7163dc9b5c552a84e1;p=thirdparty%2Fbinutils-gdb.git bfd/PE: correct SizeOfImage calculation We don't really want to align the last section's size to object alignment (when that section may itself not be aligned as much), we want image size to be a multiple thereof. --- diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 51b567e6a64..c09d16ed0c0 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -699,8 +699,8 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) for the image size. */ if (coff_section_data (abfd, sec) != NULL && pei_section_data (abfd, sec) != NULL) - isize = (sec->vma - extra->ImageBase - + SA (FA (pei_section_data (abfd, sec)->virt_size))); + isize = SA (sec->vma - extra->ImageBase + + FA (pei_section_data (abfd, sec)->virt_size)); } aouthdr_in->dsize = dsize;