[PATCH v6 02/14] aarch64: configure test for BTI support

H.J. Lu hjl.tools@gmail.com
Tue Jul 7 14:39:21 GMT 2020


On Tue, Jul 7, 2020 at 7:27 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
>
> The 07/06/2020 15:12, Adhemerval Zanella wrote:
> >
> >
> > On 06/07/2020 15:07, Szabolcs Nagy wrote:
> > > The 07/06/2020 11:11, Adhemerval Zanella via Libc-alpha wrote:
> > >>
> > >>
> > >> On 01/07/2020 11:38, Szabolcs Nagy wrote:
> > >>> Check BTI support in the compiler and linker.  The check also
> > >>> requires READELF that understands the BTI GNU property note.
> > >>> It is expected to succeed with gcc >=gcc-9 configured with
> > >>> --enable-standard-branch-protection and binutils >=binutils-2.33.
> > >>>
> > >>> Note: passing -mbranch-protection=bti in CFLAGS when building glibc
> > >>> may not be enough to get a glibc that supports BTI because crtbegin*
> > >>> and crtend* provided by the compiler needs to be BTI compatible too.
> > >>
> > >> If I read correctly this scenario should be covered by the configure
> > >> test, right?
> > >
> > > it is not covered because the config checks use -nostdlib
> > > and -nostartfiles (otherwise objects from the libc that
> > > the toolchain uses would leak into the checks).
> > >
> > > so if gcc startfiles are not bti compatible then configure
> > > succeeds (but later on there will be link failures so the
> > > build fails).
> >
> > Right, would be hard to try to fail early on configure for this
> > case?
>
> i don't know how to reliably link with gcc start files
> but not with libc start files.
>
> explicit link wiht crtbeginS.o may not be right, the
> exact name depends on the compiler driver.
>
> so i would have to provide dummy libc start files to be
> able to do the check, but that can go bad in many ways
> so the check may not be reliable.

For CET, I added --enable-cet to enable CET in GCC run-time,
including crtbeginS.o, ...  Since CET enabled run-time is backward
compatible, it is safe to do so.  In fact, --enable-cet is the default
starting from GCC 10.

-- 
H.J.


More information about the Libc-alpha mailing list