Re: [arm-gnu] Segmentation fault using --be8 option
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [arm-gnu] Segmentation fault using --be8 option
- To: "Carlos O'Donell" <carlos@xxxxxxxxxxxxxxxx>
- Subject: Re: [arm-gnu] Segmentation fault using --be8 option
- From: Nick Clifton <nickc@xxxxxxxxxx>
- Date: Wed, 11 Jan 2006 18:13:27 +0000
Hi Carlos,
I reproduced the problem with the following testcase:
echo "EOF" >> test.c
int _start (void)
{
return 0;
}
EOF
arm-none-linux-gnueabi-gcc -mbig-endian -c test.c
arm-none-linux-gnueabi-ld -EB --be8 -o test test.o
Segmentation fault.
Thanks for the test case. I was able to reproduce the problem using
this and it turned out to be a simple thinko in the code to handle the
byte swapping of mapping symbols. It is fixed by the attached patch.
Cheers
Nick
bfd/ChangeLog
2006-01-11 Nick Clifton <nickc@xxxxxxxxxx>
* 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;