This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[GOLD][PATCH PROPOSAL][ARM] fix the internal error in get_aeabi_object_attribute assert
- From: Viktor Kutuzov <vkutuzov at accesssoftek dot com>
- To: Doug Kwan (éæå) <dougkwan at google dot com>
- Cc: Ian Lance Taylor <iant at google dot com>, binutils <binutils at sourceware dot org>
- Date: Mon, 22 Feb 2010 11:55:28 -0800
- Subject: [GOLD][PATCH PROPOSAL][ARM] fix the internal error in get_aeabi_object_attribute assert
- Reply-to: vkutuzov at accesssoftek dot com
Hi,
this patch proposal fixes an internal error in the
get_aeabi_object_attribute method by initializing an empty attribute
section data in the Target_arm::do_finalize_section method in case it
wasn't initialized before. This situation is occurred here if no
existed input objects were passed into the linker. I got this situation
when I passed a name for non-existed input object in the command line
for the linker:
arm-none-linux-gnueabi-ld missed-module.o -o module-out.o
../install.binutils.gold.crossarm/bin/arm-none-linux-gnueabi-ld:
error: cannot open missed-module.o: No such file or directory
../install.binutils.gold.crossarm/bin/arm-none-linux-gnueabi-ld:
internal error in get_aeabi_object_attribute, at ../../binutils.gold/src/gold/arm.cc:2386
--
-Viktor
Index: arm.cc
===================================================================
RCS file: /cvs/src/src/gold/arm.cc,v
retrieving revision 1.81
diff -u -p -r1.81 arm.cc
--- arm.cc 13 Feb 2010 02:04:20 -0000 1.81
+++ arm.cc 19 Feb 2010 20:30:23 -0000
@@ -7104,6 +7104,11 @@ Target_arm<big_endian>::do_finalize_sect
const Input_objects* input_objects,
Symbol_table* symtab)
{
+ // Create an empty uninitialized attribute section if we still don't have it
+ // at this moment.
+ if (this->attributes_section_data_ == NULL)
+ this->attributes_section_data_ = new Attributes_section_data(NULL, 0);
+
// Merge processor-specific flags.
for (Input_objects::Relobj_iterator p = input_objects->relobj_begin();
p != input_objects->relobj_end();
Index: attributes.cc
===================================================================
RCS file: /cvs/src/src/gold/attributes.cc,v
retrieving revision 1.4
diff -u -p -r1.4 attributes.cc
--- attributes.cc 29 Dec 2009 06:09:03 -0000 1.4
+++ attributes.cc 19 Feb 2010 20:30:23 -0000
@@ -278,7 +278,7 @@ Attributes_section_data::Attributes_sect
const unsigned char *p = view;
p = view;
- if (*(p++) == 'A')
+ if (size > 0 && p != NULL && *(p++) == 'A')
{
size--;
while (size > 0)