[PATCH, GCC, AARCH64] Add GNU note section with BTI and PAC.

H.J. Lu hjl.tools@gmail.com
Tue Apr 2 02:28:00 GMT 2019


On Tue, Apr 2, 2019 at 10:05 AM Richard Henderson <rth@twiddle.net> wrote:
>
> On 4/1/19 8:53 PM, Sudakshina Das wrote:
> >> This could stand to use a comment, a moment's thinking about the sizes, and to
> >> use the existing asm output functions.
> >>
> >>      /* PT_NOTE header: namesz, descsz, type.
> >>         namesz = 4 ("GNU\0")
> >>         descsz = 12 (see below)
> > I was trying out these changes but the descsz of 12 gets rejected by
> > readelf. It hits the following
> >
> >    unsigned int    size = is_32bit_elf ? 4 : 8;
> >
> >    printf (_("      Properties: "));
> >
> >    if (pnote->descsz < 8 || (pnote->descsz % size) != 0)
> >      {
> >        printf (_("<corrupt GNU_PROPERTY_TYPE, size = %#lx>\n"),
> > pnote->descsz);
> >        return;
> >      }
>
> Hmm, interesting.  The docs say that padding is not to be included in descsz
> (gabi4.1, page 82).  To my eye this is a bug in binutils, but perhaps we will
> have to live with it.
>
> Nick, thoughts?

descsz is wrong.  From:

https://github.com/hjl-tools/linux-abi/wiki/Linux-Extensions-to-gABI

n_desc The note descriptor. The first n_descsz bytes in n_desc is the pro-
gram property array.

The program property array
Each array element represents one program property with type, data
size and data.
In 64-bit objects, each element is an array of 8-byte integers in the
format of the
target processor. In 32-bit objects, each element is an array of
4-byte integers in
the format of the target processor.


-- 
H.J.



More information about the Gcc-patches mailing list