[PATCH][GOLD] Fix ARM kernel build problem due to stub sizing.

Doug Kwan (關振德) dougkwan@google.com
Tue Apr 13 17:53:00 GMT 2010


Hi Ian,

    This fixes a problem in which an assert is triggered because
current data size is not up to date.  I can the code to compute the
accurate value instead in Arm_input_section::set_final_data_size.
Becuase we have 3 stub types and hence 3 sub-tables in a stub table,
tracking the size accurately is not very efficient.

-Doug

2010-04-13  Doug Kwan  <dougkwan@google.com>

        * arm.cc (Arm_input_section::set_final_data_size): Compute
        accurate final data size instead of using current data size.
-------------- next part --------------
? gold/autom4te.cache
Index: gold/arm.cc
===================================================================
RCS file: /cvs/src/src/gold/arm.cc,v
retrieving revision 1.98
diff -u -u -p -r1.98 arm.cc
--- gold/arm.cc	8 Apr 2010 06:56:15 -0000	1.98
+++ gold/arm.cc	13 Apr 2010 17:34:55 -0000
@@ -4935,21 +4935,17 @@ template<bool big_endian>
 void
 Arm_input_section<big_endian>::set_final_data_size()
 {
-  // If this owns a stub table, finalize its data size as well.
+  off_t off = convert_types<off_t, uint64_t>(this->original_size_);
+
   if (this->is_stub_table_owner())
     {
-      uint64_t address = this->address();
-
       // The stub table comes after the original section contents.
-      address += this->original_size_;
-      address = align_address(address, this->stub_table_->addralign());
-      off_t offset = this->offset() + (address - this->address());
-      this->stub_table_->set_address_and_file_offset(address, offset);
-      address += this->stub_table_->data_size();
-      gold_assert(address == this->address() + this->current_data_size());
+      off = align_address(off, this->stub_table_->addralign());
+      this->stub_table_->set_address_and_file_offset(this->address() + off,
+						     this->offset() + off);
+      off += this->stub_table_->data_size();
     }
-
-  this->set_data_size(this->current_data_size());
+  this->set_data_size(off);
 }
 
 // Reset address and file offset.


More information about the Binutils mailing list