This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] x86: Add a GNU_PROPERTY_X86_ISA_1_USED note if needed


On Fri, Jul 20, 2018 at 2:30 AM, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> On 19/07/18 22:33, H.J. Lu wrote:
>>
>> Here is the updated patch.  Any comments?
>>
>>
>> H.J.
>> --
>> When -z separate-code, which is enabled by default for Linux/x86, is
>> used to create executable, ld won't place any data in the code-only
>> PT_LOAD segment.  If there are no data sections placed before the
>> code-only PT_LOAD segment, the program headers won't be mapped into
>> any PT_LOAD segment.  When the executable tries to access it (based
>> on the program header address passed in AT_PHDR), it will lead to
>> segfault.  This patch inserts a GNU_PROPERTY_X86_ISA_1_USED note if
>> there may be no data sections before the text section so that the
>> first PT_LOAD segment won't be code-only and will contain the program
>> header.
>
>
> i agree with Rich's comment on the bugzilla ticket:
> simply always adding a .phdrs section that covers
> the program headers would ensure that this kind of
> bug is not introduced on other targets and seems
> less hackish than adding a note.

We can explore it.

> i don't know why there is no such section already,
> or if there is any drawback adding such a section,
> is the requirement to access program headers in a
> static linked executable a linux only thing?
>

The program headers aren't required to be mapped into
process image.  It may not be correct for Linux kermel
to set AT_PHDR to an unmapped address.  But I'd like
to support the existing kernel.  I am going to check in
my change ASIS and backport it to 2.31 branch.

I will see what I can do for .phdrs section.  But it probably
won't be backported to 2.31 branch.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]