PT_NOTE alignment, NT_GNU_PROPERTY_TYPE_0, glibc and gold
Florian Weimer
fweimer@redhat.com
Thu Aug 16 14:01:00 GMT 2018
On 08/16/2018 03:39 PM, H.J. Lu wrote:
> On Thu, Aug 16, 2018 at 6:31 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 08/16/2018 03:19 PM, H.J. Lu wrote:
>>>
>>> On Thu, Aug 16, 2018 at 6:00 AM, Florian Weimer <fweimer@redhat.com>
>>> wrote:
>>>>
>>>> On 08/07/2018 10:41 PM, H.J. Lu wrote:
>>>>>
>>>>>
>>>>> The .note.gnu.property section with NT_GNU_PROPERTY_TYPE_0 has been
>>>>> added to Linux Extensions to gABI:
>>>>>
>>>>> https://github.com/hjl-tools/linux-abi
>>>>>
>>>>> GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED are
>>>>> processor-specific program property types for i386 and x86-64.
>>>>
>>>>
>>>>
>>>> The specification is incomplete as far as alignment matters are
>>>> concerned.
>>>
>>>
>>> https://github.com/hjl-tools/linux-abi/wiki/linux-abi-draft.pdf
>>>
>>> has
>>>
>>> 2.1.7 Alignment of Note Sections
>>>
>>> All entries in a PT_NOTE segment have the same alignment which equals to
>>> the
>>> p_align field in program header.
>>> According to gABI, each note entry should be aligned to 4 bytes in 32-bit
>>> objects or 8 bytes in 64-bit objects. But .note.ABI-tag section (see
>>> Section 2.1.6) and .note.gnu.build-id section (see Section 2.1.4) are
>>> aligned
>>> to 4 bytes in both 32-bit and 64-bit objects. Note parser should use
>>> p_align for
>>> note alignment, instead of assuming alignment based on ELF file class.
>>
>>
>> This is still ambiguous, particularly based on your comments below.
>
> https://github.com/hjl-tools/linux-abi/wiki/linux-abi-draft.pdf
>
> conforms to gABI unless stated otherwise.
I still think there is ambiguity.
> I was wrong. We need 2 NOTE segments one fore 8-byte alignment and
> one for 4-byte alignment.
If one needs to generate two segments, the ABI documents should say so.
Otherwise, linker implementors will assume that there are other ways to
implement this.
> glibc only discards 4-byte aligned NT_GNU_PROPERTY_TYPE_0 note
> since NT_GNU_PROPERTY_TYPE_0 note follows gABI. If gold
> generates 4 byte alignment, it is a gold bug.
See above. I don't have a strong opinion how we make gold and glibc
interoperate, but if gold is wrong, the ABI documents should be made
more precise.
Thanks,
Florian
More information about the Libc-alpha
mailing list