aboutsummaryrefslogtreecommitdiff
path: root/bfd/peXXigen.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-04-03 11:13:27 +0000
committerNick Clifton <nickc@redhat.com>2003-04-03 11:13:27 +0000
commitff0c9faf3be91184df2cd4cd2ebefc23cd08382c (patch)
tree18bb6a7a69a867c5ccd81f2be2410e3f95d79dc4 /bfd/peXXigen.c
parent9a1b6dc5fdbb00dc906b7d5cfa72f2822c3d5b92 (diff)
downloadgdb-ff0c9faf3be91184df2cd4cd2ebefc23cd08382c.zip
gdb-ff0c9faf3be91184df2cd4cd2ebefc23cd08382c.tar.gz
gdb-ff0c9faf3be91184df2cd4cd2ebefc23cd08382c.tar.bz2
(_bfd_XXi_swap_scnhdr_out): Compute ps and ss differently for object files and
executables. (coff_swap_scnhdr_in): Only set the s_size field for object files or for executables who have not already initialised the field. (bfd_pe_executable_p): New macro. Return true if the PE format bfd is an executable.
Diffstat (limited to 'bfd/peXXigen.c')
-rw-r--r--bfd/peXXigen.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 9ab72d0..ba1c219 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1,5 +1,5 @@
/* Support for the generic parts of PE/PEI; the common executable parts.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Solutions.
@@ -906,12 +906,24 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
sometimes). */
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
{
- ps = scnhdr_int->s_size;
- ss = 0;
+ if (bfd_pe_executable_p (abfd))
+ {
+ ps = scnhdr_int->s_size;
+ ss = 0;
+ }
+ else
+ {
+ ps = 0;
+ ss = scnhdr_int->s_size;
+ }
}
else
{
- ps = scnhdr_int->s_paddr;
+ if (bfd_pe_executable_p (abfd))
+ ps = scnhdr_int->s_paddr;
+ else
+ ps = 0;
+
ss = scnhdr_int->s_size;
}