bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/25662] objcopy sets invalid sh_offset for the first sectio


From: jozef.l at mittosystems dot com
Subject: [Bug binutils/25662] objcopy sets invalid sh_offset for the first section in a no_contents segment containing program headers
Date: Thu, 12 Mar 2020 14:46:11 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25662

--- Comment #1 from Jozef Lawrynowicz <jozef.l at mittosystems dot com> ---
Created attachment 12368
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12368&action=edit
patch

The attached patch fixes the issue, although I haven't been able to totally
convince myself of the reasoning behind the change.

In this situation, assign_file_positions_for_load_sections will align the
first section in the segment to the required segment alignment, but then to
avoid wasting space, the offset of the next segment will be adjusted back to
the
end of the no_contents segment, even if that offset overlaps the SHT_NOBITS
section.

So in a similar manner we can disregard any "padding" between the start of the
no_contents segment and the first SHT_NOBITS section, by keeping
p_vaddr_offset set to 0. The gap between the segment and section start
is not used as padding in the normal sense to adjust the address of later
sections and segments, it is just there to align that first SHT_NOBITS section.

If that sounds about right I'll post the patch to the mailing list for
approval.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]