[GOLD][PATCH] Avoid generating .ARM.attributes section in output if merging none from input.

Doug Kwan (關振德) dougkwan@google.com
Wed Jun 16 01:51:00 GMT 2010


Hi Ian,

    This patch fixes a problem during kernel build.  The kernel
building process uses ld -r multiple times and it sometimes produces
intermediate objects with no code and data.  Previously we emitted an
empty .ARM.attributes section with all default values and set the EABI
version to unknown.  That caused the objects to be considered not
empty and the EABI version info and attributes merged.  We should
ignore such objects like ld.

-Doug

2010-06-15  Doug Kwan  <dougkwan@google.com>

	* arm.cc (Target_arm::do_finalize_sections): Do not emit an
	.ARM.attributes section if we have not merged any input
	attributes sections.
-------------- next part --------------
? gold/autom4te.cache
Index: gold/arm.cc
===================================================================
RCS file: /cvs/src/src/gold/arm.cc,v
retrieving revision 1.107
diff -u -u -p -r1.107 arm.cc
--- gold/arm.cc	8 Jun 2010 00:33:41 -0000	1.107
+++ gold/arm.cc	15 Jun 2010 20:20:54 -0000
@@ -8101,6 +8101,7 @@ Target_arm<big_endian>::do_finalize_sect
     const Input_objects* input_objects,
     Symbol_table* symtab)
 {
+  bool merged_any_attributes = false;
   // Merge processor-specific flags.
   for (Input_objects::Relobj_iterator p = input_objects->relobj_begin();
        p != input_objects->relobj_end();
@@ -8115,6 +8116,7 @@ Target_arm<big_endian>::do_finalize_sect
 	      arm_relobj->processor_specific_flags());
 	  this->merge_object_attributes(arm_relobj->name().c_str(),
 					arm_relobj->attributes_section_data());
+	  merged_any_attributes = true;
 	}
     } 
 
@@ -8129,6 +8131,7 @@ Target_arm<big_endian>::do_finalize_sect
 	  arm_dynobj->processor_specific_flags());
       this->merge_object_attributes(arm_dynobj->name().c_str(),
 				    arm_dynobj->attributes_section_data());
+      merged_any_attributes = true;
     }
 
   // Create an empty uninitialized attribute section if we still don't have it
@@ -8210,9 +8213,9 @@ Target_arm<big_endian>::do_finalize_sect
 	}
     }
 
-  // Create an .ARM.attributes section unless we have no regular input
-  // object.  In that case the output will be empty.
-  if (input_objects->number_of_relobjs() != 0)
+  // Create an .ARM.attributes section if we have merged any attributes
+  // from inputs.
+  if (merged_any_attributes)
     {
       Output_attributes_section_data* attributes_section =
       new Output_attributes_section_data(*this->attributes_section_data_);


More information about the Binutils mailing list