@@ -2422,7 +2422,7 @@ Output_section::add_input_section(Layout* layout,
2422
2422
input_section_size = uncompressed_size;
2423
2423
2424
2424
off_t offset_in_section;
2425
- off_t aligned_offset_in_section;
2425
+
2426
2426
if (this ->has_fixed_layout ())
2427
2427
{
2428
2428
// For incremental updates, find a chunk of unused space in the section.
@@ -2432,17 +2432,15 @@ Output_section::add_input_section(Layout* layout,
2432
2432
gold_fallback (_ (" out of patch space in section %s; "
2433
2433
" relink with --incremental-full" ),
2434
2434
this ->name ());
2435
- aligned_offset_in_section = offset_in_section;
2436
- }
2437
- else
2438
- {
2439
- offset_in_section = this ->current_data_size_for_child ();
2440
- aligned_offset_in_section = align_address (offset_in_section,
2441
- addralign);
2442
- this ->set_current_data_size_for_child (aligned_offset_in_section
2443
- + input_section_size);
2435
+ return offset_in_section;
2444
2436
}
2445
2437
2438
+ offset_in_section = this ->current_data_size_for_child ();
2439
+ off_t aligned_offset_in_section = align_address (offset_in_section,
2440
+ addralign);
2441
+ this ->set_current_data_size_for_child (aligned_offset_in_section
2442
+ + input_section_size);
2443
+
2446
2444
// Determine if we want to delay code-fill generation until the output
2447
2445
// section is written. When the target is relaxing, we want to delay fill
2448
2446
// generating to avoid adjusting them during relaxation. Also, if we are
@@ -2507,14 +2505,6 @@ Output_section::add_input_section(Layout* layout,
2507
2505
this ->set_input_section_order_specified ();
2508
2506
}
2509
2507
}
2510
- if (this ->has_fixed_layout ())
2511
- {
2512
- // For incremental updates, finalize the address and offset now.
2513
- uint64_t addr = this ->address ();
2514
- isecn.set_address_and_file_offset (addr + aligned_offset_in_section,
2515
- aligned_offset_in_section,
2516
- this ->offset ());
2517
- }
2518
2508
this ->input_sections_ .push_back (isecn);
2519
2509
}
2520
2510
0 commit comments