This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[COMMIT] Fix thinko in elf32_arm_output_symbol_hook
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org
- Date: Wed, 11 Jan 2006 18:16:28 +0000
- Subject: [COMMIT] Fix thinko in elf32_arm_output_symbol_hook
Hi Guys,
The code to create an array of mapping symbols in bfd/elf32-arm.c:
elf32_arm_output_symbol_hook() has as small problem - it reallocates
the map array and then installs the new entry into the old, possibly
NULL, memory location. I am installing the attached patch to fix
this.
Cheers
Nick
bfd/ChangeLog
2006-01-11 Nick Clifton <nickc@redhat.com>
* elf32-arm.c (elf32_arm_output_symbol_hook): Install new entry
into the newly (re)allocated map array.
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.61
diff -c -3 -p -r1.61 elf32-arm.c
*** bfd/elf32-arm.c 12 Dec 2005 17:03:39 -0000 1.61
--- bfd/elf32-arm.c 11 Jan 2006 18:04:32 -0000
*************** elf32_arm_output_symbol_hook (struct bfd
*** 7459,7464 ****
--- 7459,7465 ----
mapcount = arm_data->mapcount + 1;
map = arm_data->map;
+
/* TODO: This may be inefficient, but we probably don't usually have many
mapping symbols per section. */
newmap = bfd_realloc (map, mapcount * sizeof (* map));
*************** elf32_arm_output_symbol_hook (struct bfd
*** 7467,7474 ****
arm_data->map = newmap;
arm_data->mapcount = mapcount;
! map[mapcount - 1].vma = elfsym->st_value;
! map[mapcount - 1].type = name[1];
}
return TRUE;
--- 7468,7475 ----
arm_data->map = newmap;
arm_data->mapcount = mapcount;
! newmap[mapcount - 1].vma = elfsym->st_value;
! newmap[mapcount - 1].type = name[1];
}
return TRUE;