This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[GOLD][PATCH PROPOSAL][ARM] fix the internal error in get_aeabi_object_attribute assert


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]