diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2007-03-22 15:52:29 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2007-03-22 15:52:29 +0000 |
commit | 50572669e457b60b8eb8e2a10fcd22d217dc7e09 (patch) | |
tree | 8e7179d30424c73170e205c7d60aa59e864f7c78 /bfd/peXXigen.c | |
parent | 0920dee7bad8a96ae1866b9cd451103d8897abf5 (diff) | |
download | gdb-50572669e457b60b8eb8e2a10fcd22d217dc7e09.zip gdb-50572669e457b60b8eb8e2a10fcd22d217dc7e09.tar.gz gdb-50572669e457b60b8eb8e2a10fcd22d217dc7e09.tar.bz2 |
bfd/
2003-03-22 H.J. Lu <hongjiu.lu@intel.com>
PR ld/4210
* peXXigen.c (_bfd_XXi_swap_aouthdr_out): Use the virtual
address and virtual size of the last section for the image
size.
ld/testsuite/
2003-03-22 H.J. Lu <hongjiu.lu@intel.com>
PR ld/4210
* ld-pe/image_size.d: New file.
* ld-pe/image_size.s: Likewise.
* ld-pe/image_size.t: Likewise.
* ld-pe/pe.exp: Run image_size.
Diffstat (limited to 'bfd/peXXigen.c')
-rw-r--r-- | bfd/peXXigen.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 2454436..bbb3c77 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -645,16 +645,22 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) in the virt_size field). Files have been seen (from MSVC 5.0 link.exe) where the file size of the .data segment is quite small compared to the virtual size. Without this - fix, strip munges the file. */ + fix, strip munges the file. + + FIXME: We need to handle holes between sections, which may + happpen when we covert from another format. We just use + the virtual address and virtual size of the last section + for the image size. */ if (coff_section_data (abfd, sec) != NULL && pei_section_data (abfd, sec) != NULL) - isize += SA (FA (pei_section_data (abfd, sec)->virt_size)); + isize = (sec->vma - extra->ImageBase + + SA (FA (pei_section_data (abfd, sec)->virt_size))); } aouthdr_in->dsize = dsize; aouthdr_in->tsize = tsize; extra->SizeOfHeaders = hsize; - extra->SizeOfImage = SA (hsize) + isize; + extra->SizeOfImage = isize; } H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic); |