Committed, MMIX: Fix valgrind-diagnosed elf64-mmix.c bugs
Hans-Peter Nilsson
hp@bitrange.com
Wed Nov 13 17:33:00 GMT 2002
The last bug (...) diagnosed by Valgrind for binutils for MMIX:
ld-mmix/bpo-19m and ld-mmix/bpo-21m failed. Would probably
cause SEGV on other hosts.
* elf64-mmix.c (_bfd_mmix_finalize_linker_allocated_gregs):
For bpo_gregs_section->contents, allocate _raw_size, not
_cooked_size.
Index: elf64-mmix.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-mmix.c,v
retrieving revision 1.17
diff -p -c -r1.17 elf64-mmix.c
*** elf64-mmix.c 7 Jul 2002 09:10:40 -0000 1.17
--- elf64-mmix.c 14 Nov 2002 01:22:07 -0000
*************** _bfd_mmix_finalize_linker_allocated_greg
*** 2170,2177 ****
n_gregs = gregdata->n_allocated_bpo_gregs;
bpo_gregs_section->contents
! = contents = bfd_alloc (bpo_greg_owner, bpo_gregs_section->_cooked_size);
if (contents == NULL)
return false;
--- 2170,2180 ----
n_gregs = gregdata->n_allocated_bpo_gregs;
+ /* We need to have a _raw_size contents even though there's only
+ _cooked_size worth of data, since the generic relocation machinery
+ will allocate and copy that much temporarily. */
bpo_gregs_section->contents
! = contents = bfd_alloc (bpo_greg_owner, bpo_gregs_section->_raw_size);
if (contents == NULL)
return false;
brgds, H-P
More information about the Binutils
mailing list