]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/PE: correct SizeOfImage calculation
authorJan Beulich <jbeulich@suse.com>
Fri, 6 Sep 2024 06:34:24 +0000 (08:34 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 6 Sep 2024 06:34:24 +0000 (08:34 +0200)
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.

bfd/peXXigen.c

index 51b567e6a644b104244d99de6e7370e2212b2e0a..c09d16ed0c0faa6e129778a67dbf5d9afcbd7104 100644 (file)
@@ -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;