aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-09-11 22:52:20 +0000
committerIan Lance Taylor <ian@airs.com>1999-09-11 22:52:20 +0000
commite166a60fd9d8b86149b175d598035997744114f6 (patch)
tree31bf421268cdc17ed774048ee32ba80ad4a83fb3
parent1135238bd09b1d50c83ca3586b511bfc63d94185 (diff)
downloadgdb-e166a60fd9d8b86149b175d598035997744114f6.zip
gdb-e166a60fd9d8b86149b175d598035997744114f6.tar.gz
gdb-e166a60fd9d8b86149b175d598035997744114f6.tar.bz2
1999-09-11 Donn Terry <donn@interix.com>
* peicode.h (coff_swap_scnhdr_in): Don't check for a special section name of _BSS; check IMAGE_SCN_CNT_UNINITIALIZED_DATA instead. Don't clear the s_paddr field for an uninitialized data section.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/peicode.h18
2 files changed, 17 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d6992ad..d844da2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -7,6 +7,11 @@
1999-09-11 Donn Terry <donn@interix.com>
+ * peicode.h (coff_swap_scnhdr_in): Don't check for a special
+ section name of _BSS; check IMAGE_SCN_CNT_UNINITIALIZED_DATA
+ instead. Don't clear the s_paddr field for an uninitialized data
+ section.
+
* coffcode.h (coff_mkobject_hook): Set timestamp field in
coff_data_type to f_timdat.
* peicode.h (pe_mkobject_hook): Likewise.
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 7193add..d284dd9 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -1112,10 +1112,10 @@ coff_swap_aouthdr_out (abfd, in, out)
}
static void
- coff_swap_scnhdr_in (abfd, ext, in)
- bfd *abfd;
- PTR ext;
- PTR in;
+coff_swap_scnhdr_in (abfd, ext, in)
+ bfd *abfd;
+ PTR ext;
+ PTR in;
{
SCNHDR *scnhdr_ext = (SCNHDR *) ext;
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
@@ -1143,10 +1143,16 @@ static void
scnhdr_int->s_vaddr += pe_data (abfd)->pe_opthdr.ImageBase;
scnhdr_int->s_vaddr &= 0xffffffff;
}
- if (strcmp (scnhdr_int->s_name, _BSS) == 0)
+
+ /* If this section holds uninitialized data, use the virtual size
+ (stored in s_paddr) instead of the physical size. */
+ if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
{
scnhdr_int->s_size = scnhdr_int->s_paddr;
- scnhdr_int->s_paddr = 0;
+ /* This code used to set scnhdr_int->s_paddr to 0. However,
+ coff_set_alignment_hook stores s_paddr in virt_size, which
+ only works if it correctly holds the virtual size of the
+ section. */
}
}