Tue May 5 18:23:10 2009 UTC ()
Pull up following revision(s) (requested by mhitch in ticket #738):
	gnu/dist/binutils/bfd/elf32-vax.c: revision 1.9
Allocate relocation section using bfd_zalloc() to ensure no garbage
relocations when not all the entries are used.  Fixes PR port-vax/39182.


(bouyer)
diff -r1.7 -r1.7.18.1 src/gnu/dist/binutils/bfd/elf32-vax.c

cvs diff -r1.7 -r1.7.18.1 src/gnu/dist/binutils/bfd/Attic/elf32-vax.c (expand / switch to unified diff)

--- src/gnu/dist/binutils/bfd/Attic/elf32-vax.c 2007/04/19 19:50:59 1.7
+++ src/gnu/dist/binutils/bfd/Attic/elf32-vax.c 2009/05/05 18:23:09 1.7.18.1
@@ -1300,27 +1300,32 @@ elf_vax_size_dynamic_sections (output_bf @@ -1300,27 +1300,32 @@ elf_vax_size_dynamic_sections (output_bf
1300 else if (strncmp (name, ".got", 4) != 0) 1300 else if (strncmp (name, ".got", 4) != 0)
1301 { 1301 {
1302 /* It's not one of our sections, so don't allocate space. */ 1302 /* It's not one of our sections, so don't allocate space. */
1303 continue; 1303 continue;
1304 } 1304 }
1305 1305
1306 if (strip) 1306 if (strip)
1307 { 1307 {
1308 _bfd_strip_section_from_output (info, s); 1308 _bfd_strip_section_from_output (info, s);
1309 continue; 1309 continue;
1310 } 1310 }
1311 1311
1312 /* Allocate memory for the section contents. */ 1312 /* Allocate memory for the section contents. */
1313 s->contents = (bfd_byte *) bfd_alloc (dynobj, s->size); 1313 /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
 1314 Unused entries should be reclaimed before the section's contents
 1315 are written out, but at the moment this does not happen. Thus in
 1316 order to prevent writing out garbage, we initialise the section's
 1317 contents to zero. */
 1318 s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
1314 if (s->contents == NULL && s->size != 0) 1319 if (s->contents == NULL && s->size != 0)
1315 return FALSE; 1320 return FALSE;
1316 } 1321 }
1317 1322
1318 if (elf_hash_table (info)->dynamic_sections_created) 1323 if (elf_hash_table (info)->dynamic_sections_created)
1319 { 1324 {
1320 /* Add some entries to the .dynamic section. We fill in the 1325 /* Add some entries to the .dynamic section. We fill in the
1321 values later, in elf_vax_finish_dynamic_sections, but we 1326 values later, in elf_vax_finish_dynamic_sections, but we
1322 must add the entries now so that we get the correct size for 1327 must add the entries now so that we get the correct size for
1323 the .dynamic section. The DT_DEBUG entry is filled in by the 1328 the .dynamic section. The DT_DEBUG entry is filled in by the
1324 dynamic linker and used by the debugger. */ 1329 dynamic linker and used by the debugger. */
1325#define add_dynamic_entry(TAG, VAL) \ 1330#define add_dynamic_entry(TAG, VAL) \
1326 _bfd_elf_add_dynamic_entry (info, TAG, VAL) 1331 _bfd_elf_add_dynamic_entry (info, TAG, VAL)