PT_NOTE alignment, NT_GNU_PROPERTY_TYPE_0, glibc and gold
H.J. Lu
hjl.tools@gmail.com
Wed Sep 26 18:36:00 GMT 2018
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.
More information about the Binutils
mailing list