[PATCH v3 1/5] aarch64: Add configure check for linker support for -z gcs

Yury Khrustalev yury.khrustalev@arm.com
Mon Feb 10 11:48:54 GMT 2025


Hello Adhemerval,

On Thu, Feb 06, 2025 at 04:48:33PM -0300, Adhemerval Zanella Netto wrote:
> 
> 
> On 06/02/25 16:34, Adhemerval Zanella Netto wrote:
> > 
> > 
> > On 29/01/25 06:49, Yury Khrustalev wrote:
> >> ---
> >>  configure    | 36 ++++++++++++++++++++++++++++++++++++
> >>  configure.ac |  5 +++++
> >>  2 files changed, 41 insertions(+)
> >>
> >> +# Check if linker supports GCS marking
> >> +LIBC_LINKER_FEATURE([-z gcs=always], [-Wl,-z,gcs=always],
> >> +		    [libc_cv_test_gcs=yes], [libc_cv_test_gcs=no])
> >> +LIBC_CONFIG_VAR([have-test-cc-gcs], [$libc_cv_test_gcs])
> >> +
> > 
> > I think we might also need to check if compiler will ending using -z gcs
> > as well, otherwise users might still some failures if glibc itself it
> > not built with gcs.
> > 
> > For instance, with gcc 14 either with or without --enable-standard-branch-protection
> > (where gcs is support), but with a gcs enabled binutils (so have-test-cc-gcs is yes)
> 
> I meant where gcs is *not* supported, with gcc-15 I don't see this issue (but I
> still need to check with a build without --enable-standard-branch-protection).
> 
> > I see failures because at loading time libc.so.6 is not GCS compatible.
> > 
> > Maybe filtering out such failures (to check libc.so.6 it no GCS compatible), but it
> > also means that GCS won't be usable anyway.
> > 
> >>  AC_MSG_CHECKING(if we can build programs as PIE)
> >>  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
> >>  # error PIE is not supported
> > 

I agree this is better to check both compiler and linker support and only
enabled the new tests when all toolchain components support GCS.

I've sent v4 with the requested changes:
https://inbox.sourceware.org/libc-alpha/20250210114538.1723249-1-yury.khrustalev@arm.com/

Thanks,
Yury



More information about the Libc-alpha mailing list