[PATCH 4/4] aarch64: add tests for glibc.cpu.aarch64_bti behaviour

Yury Khrustalev yury.khrustalev@arm.com
Wed Nov 19 14:15:49 GMT 2025


On Wed, Nov 19, 2025 at 09:05:53AM -0300, Adhemerval Zanella Netto wrote:
> 
> ...
> 
> >>> Perhaps before running the test we could check properties of libc.so
> >>> and let these tests to fail as UNSUPPORTED?
> >>
> >> This can be a configure check that enabled Makefile flag.
> > 
> > I'm not sure how this can be a configure check. When we run configure,
> > Glibc is not built yet, so we can't probe ELF properties of libc.so.
> > 
> > During configure run, is it possible to get a full compiler and linker
> > commands that will be used to build libc.so that will take into account
> > environment variables and various configure flags? We could use that to
> > link a dummy binary and probe its properties perhaps?
> 
> I think we can assume that $CC/$CPPFLAGS/$CFLAGS will give us the expected
> ABI and thus we can probe by building a binary and objdump the GNU flags.

OK I think I found a way to do this by testing of a macro is defined by
the compiler if it's invoked as

  $CC $CFLAGS $CPPFLAGS

By checking macros like __ARM_FEATURE_BTI_DEFAULT we can see if a relevant
branch protection was enabled (by default or via compiler flags).

If it is enabled, then all objects will have corresponding marking and the
static linker will mark output binaries. So we don't need to test LDFLAGS
separately.

I'll send updated patch series shortly.

Thanks,
Yury



More information about the Libc-alpha mailing list