This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PT_NOTE alignment, NT_GNU_PROPERTY_TYPE_0, glibc and gold
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Cary Coutant <ccoutant at gmail dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, x86-64-abi <x86-64-abi at googlegroups dot com>, Binutils <binutils at sourceware dot org>, GNU C Library <libc-alpha at sourceware dot org>, Mark Wielaard <mark at klomp dot org>, Michael Matz <matz at suse dot de>, Nick Clifton <nickc at redhat dot com>, "Carlos O'Donell" <carlos at redhat dot com>, "szabolcs.nagy" <szabolcs dot nagy at arm dot com>
- Date: Wed, 26 Sep 2018 11:36:09 -0700
- Subject: Re: PT_NOTE alignment, NT_GNU_PROPERTY_TYPE_0, glibc and gold
- References: <CAMe9rOrrayKnc_cPm4SmnDnUGLbBUmOYMBTMOM8KLAHVmb=rUQ@mail.gmail.com> <13a92cb0-a993-f684-9a96-e02e4afb1bef@redhat.com> <87sh2547ib.fsf@oldenburg.str.redhat.com> <CAJimCsFDmPD-T7RV53j15NnuW1fZ2mHSxjUbvDu7EC+oEg_fng@mail.gmail.com>
On Wed, Sep 26, 2018 at 10:39 AM, Cary Coutant <ccoutant@gmail.com> wrote:
>
> Some requirements I'd like to see:
NT_GNU_PROPERTY_TYPE_0 is documented at
https://github.com/hjl-tools/linux-abi
> (1) An NT_GNU_PROPERTY_TYPE_0 note section must be named
> ".note.gnu.property" with type SHT_NOTE.
If it isn't specified this way, please send a patch.
> (2) A ".note.gnu.property" section must contain one and only one note,
> whose type must be NT_GNU_PROPERTY_TYPE_0.
True for linker output and all properties must be sorted. For relocatable
inputs, there may be more than one NT_GNU_PROPERTY_TYPE_0 notes:
[hjl@gnu-cfl-1 tmp]$ touch n.c
[hjl@gnu-cfl-1 tmp]$ gcc -fcf-protection -c n.c -Wa,-mx86-used-note=yes
[hjl@gnu-cfl-1 tmp]$ readelf -n n.o
Displaying notes found in: .note.gnu.property
Owner Data size Description
GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
Properties: x86 feature: IBT, SHSTK
GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
Properties: x86 ISA used: <None>
x86 feature used: x86
[hjl@gnu-cfl-1 tmp]$
> (3) A ".note.gnu.property" section must have sh_align of 8, and its
> length must be a multiple of 8.
If it isn't specified this way, please send a patch.
> (4) A linker is expected to combine ".note.gnu.property" sections in a
> manner described by the ABI documentation, and place the combined
> result, as a single note, in a unique SHT_NOTE section named
> ".note.gnu.property", and in a unique PT_NOTE segment.
>
Why is a unique PT_NOTE segment required? A PT_NOTE segment
may have more than one SHT_NOTE sections with the same section
alignment and each SHT_NOTE section is padded to section alignment.
--
H.J.