[gold] PATCH: PR gold/14993: Section sorting interferes with the incremental update

Cary Coutant ccoutant@google.com
Sat Jan 5 01:39:00 GMT 2013
> I don't think the negative file offset should be happening in the
> first place, and it seems to be caused by the fact that we've turned
> on input section tracking for .text. With an incremental update, the
> offset assigned in Output_section::add_input_section should be final
> (and non-negative), and it shouldn't be overridden later in
> Sized_relobj_file::layout_section. I think the right solution is to
> suppress section sorting during an incremental update -- the two are
> fundamentally incompatible. I'll take a closer look at this.

HJ, can you try the attached patch with x32? I've changed
Output_section::add_input_section so that when we allocate patch space
for an input section, we immediately return its offset. There's no
point in tracking it as an input section, because we will not want to
do any sorting.

All tests pass on x86_64.

-cary


2013-01-04  Cary Coutant  <ccoutant@google.com>

        * gold/output.cc (Output_section::add_input_section): For incremental
        updates, don't track input sections that are allocated from patch
        space.
-------------- next part --------------
2013-01-04  Cary Coutant  <ccoutant@google.com>

	* gold/output.cc (Output_section::add_input_section): For incremental
	updates, don't track input sections that are allocated from patch
	space.

diff --git a/gold/output.cc b/gold/output.cc
index f2321b7..01126a3 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -2422,7 +2422,7 @@ Output_section::add_input_section(Layout* layout,
     input_section_size = uncompressed_size;
 
   off_t offset_in_section;
-  off_t aligned_offset_in_section;
+
   if (this->has_fixed_layout())
     {
       // For incremental updates, find a chunk of unused space in the section.
@@ -2432,17 +2432,15 @@ Output_section::add_input_section(Layout* layout,
         gold_fallback(_("out of patch space in section %s; "
 			"relink with --incremental-full"),
 		      this->name());
-      aligned_offset_in_section = offset_in_section;
-    }
-  else
-    {
-      offset_in_section = this->current_data_size_for_child();
-      aligned_offset_in_section = align_address(offset_in_section,
-						addralign);
-      this->set_current_data_size_for_child(aligned_offset_in_section
-					    + input_section_size);
+      return offset_in_section;
     }
 
+  offset_in_section = this->current_data_size_for_child();
+  off_t aligned_offset_in_section = align_address(offset_in_section,
+						  addralign);
+  this->set_current_data_size_for_child(aligned_offset_in_section
+					+ input_section_size);
+
   // Determine if we want to delay code-fill generation until the output
   // section is written.  When the target is relaxing, we want to delay fill
   // generating to avoid adjusting them during relaxation.  Also, if we are
@@ -2507,14 +2505,6 @@ Output_section::add_input_section(Layout* layout,
               this->set_input_section_order_specified();
             }
         }
-      if (this->has_fixed_layout())
-	{
-	  // For incremental updates, finalize the address and offset now.
-	  uint64_t addr = this->address();
-	  isecn.set_address_and_file_offset(addr + aligned_offset_in_section,
-					    aligned_offset_in_section,
-					    this->offset());
-	}
       this->input_sections_.push_back(isecn);
     }
 


More information about the Binutils mailing list