From 7a9af8c4a0fdb228854799a8b96eef29932a2004 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 21 Aug 2000 23:42:56 +0000 Subject: Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. --- bfd/ChangeLog | 9 +++++++++ bfd/elf32-i386.c | 7 ++++++- bfd/elf32-m68k.c | 7 ++++++- bfd/elf32-sparc.c | 7 ++++++- bfd/elf64-hppa.c | 7 ++++++- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8509380..15e54df 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2000-08-21 H.J. Lu + + * elf32-i386.c (elf_i386_size_dynamic_sections): Zero out the + dynamic allocated content space. Add a comment to remind us that + one day this ought to be fixed. + * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise. + * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise. + * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise. + 2000-08-21 Jason Eckhardt * elf32-i860.c (elf32_i860_relocate_pc16): Just write the immediate diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index ace8287..bed0315 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1198,7 +1198,12 @@ elf_i386_size_dynamic_sections (output_bfd, info) } /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); + /* FIXME: This should be a call to bfd_alloc not bfd_zalloc. + Unused entries should be reclaimed before the section's contents + are written out, but at the moment this does not happen. Thus in + order to prevent writing out garbage, we initialise the section's + contents to zero. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); if (s->contents == NULL && s->_raw_size != 0) return false; } diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index bee73b5..96d636c 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1267,7 +1267,12 @@ elf_m68k_size_dynamic_sections (output_bfd, info) } /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); + /* FIXME: This should be a call to bfd_alloc not bfd_zalloc. + Unused entries should be reclaimed before the section's contents + are written out, but at the moment this does not happen. Thus in + order to prevent writing out garbage, we initialise the section's + contents to zero. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); if (s->contents == NULL && s->_raw_size != 0) return false; } diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 0029384..1dd0351 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -1019,7 +1019,12 @@ elf32_sparc_size_dynamic_sections (output_bfd, info) } /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); + /* FIXME: This should be a call to bfd_alloc not bfd_zalloc. + Unused entries should be reclaimed before the section's contents + are written out, but at the moment this does not happen. Thus in + order to prevent writing out garbage, we initialise the section's + contents to zero. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); if (s->contents == NULL && s->_raw_size != 0) return false; } diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index b5edaf1..fc102aa 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -1740,7 +1740,12 @@ elf64_hppa_size_dynamic_sections (output_bfd, info) been allocated already. */ if (s->contents == NULL) { - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); + /* FIXME: This should be a call to bfd_alloc not bfd_zalloc. + Unused entries should be reclaimed before the section's contents + are written out, but at the moment this does not happen. Thus in + order to prevent writing out garbage, we initialise the section's + contents to zero. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); if (s->contents == NULL && s->_raw_size != 0) return false; } -- cgit v1.1