FW: [PATCH v2 1/4] aarch64: add configure checks for BTI support
Bill Roberts
bill.roberts@foss.arm.com
Sun Nov 16 10:54:27 GMT 2025
On 11/19/25 3:15 PM, Bill Roberts wrote:
>
>
> From: Andreas Schwab <schwab@suse.de>
> Date: Wednesday, November 19, 2025 at 10:46 AM
> To: Yury Khrustalev <Yury.Khrustalev@arm.com>
> Cc: libc-alpha@sourceware.org <libc-alpha@sourceware.org>, adhemerval.zanella@linaro.org <adhemerval.zanella@linaro.org>, Jeremy Linton <Jeremy.Linton@arm.com>, Bill Roberts <Bill.Roberts@arm.com>, Steve Capper <Steve.Capper@arm.com>
> Subject: Re: [PATCH v2 1/4] aarch64: add configure checks for BTI support
+ my fossmail account so the mail server doesn't mangle this patch.
I'll probably bounce the list, I tried to subscribe but I kept getting
an error that the hidden token didn't match and I never got the
generated acceptance email message, but I digress.
>
> On Nov 19 2025, Yury Khrustalev wrote:
>
>> diff --git a/aclocal.m4 b/aclocal.m4
>> index cfe9c0b538..31f13a2f46 100644
>> --- a/aclocal.m4
>> +++ b/aclocal.m4
>> @@ -497,3 +497,17 @@ LIBC_CHECK_TEST_CXX(
>> [LIBC_TRY_CXX_OPTION([$2], [$4], [$5])])
>> )
>> ])
>> +
>> +dnl Check if a CC compiler defines a macro.
>> +dnl LIBC_CHECK_CC_MACRO([message], [macro],
>> +dnl [CC-cache-id], [CC-action-if-true], [CC-action-if-false])
>> +AC_DEFUN([LIBC_CHECK_CC_MACRO],
>> +[
>> +AC_CACHE_CHECK([$1], $3, [dnl
>> + if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -dM -E - < /dev/null | grep -wF "$2" 1>&AS_MESSAGE_LOG_FD])
>> + then
>> + [$4]
>> + else
>> + [$5]
>> + fi])
>> +])
>
> This should use AC_EGREP_CPP, and I don't think we need an extra macro
> for that.
You can't, unfortunately, I learned this the painful way. These macros
don't respect CFLAGS only CPPFLAGS. So there's a few ways to handle that:
1. You can add CFLAGS to CPPFLAGS and restore them after the check
2. Use AC_COMPILE_IFELSE
3. Run your own check as done here using $CC -E
I've used option 3 in the past, only when I needed the value of the
macro, so I could propagate the PAC value to determine which key to use
in an M4 script. AC_COMPILE_IFELSE is another way to do it, if a binary
yes no result is all that is needed. You can also nest the
AC_COMPILE_IFELSE if you need to figure out, for instance which PAC key
to use. This is the way GMP want's it done, but I am not a fan of that
approach, as it exploded the size of the configure script.
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
More information about the Libc-alpha
mailing list