Re: Detection of hadware feature => please do not use signal

Bastien Roucariès <rouca@debian.org>

From: Bastien Roucariès <rouca@debian.org>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-bugs@lists.postgresql.org
Date: 2024-11-08T08:56:45Z
Lists: pgsql-bugs
Le jeudi 7 novembre 2024, 23:43:45 UTC Thomas Munro a écrit :
> On Fri, Nov 8, 2024 at 4:51 AM Bastien Roucariès <rouca@debian.org> wrote:
> > Le jeudi 7 novembre 2024, 00:01:58 UTC Thomas Munro a écrit :
> > > It doesn't look like I need to include <asm/hwcap.h> from Bastien's
> > > original message, because <sys/auxv.h> pulls in <bits/hwcap.h>
> 
> > Not on arm32 unfortunatly.... and it is a HWCAP2_flags
> 
> Ah, that is unfortunate.  I was confused about whether we even used
> this code on armv7/aarch32 builds, but I see that we do.  OK, here is
> a version like that.

I will guard the include by replacing
+#if defined(__linux__) && !defined(__aarch64__)
by
+#if defined(__linux__) && !defined(__aarch64__) && !defined(HWCAP2_CRC32)

> 
> I also noticed that the Linux docs explicitly tell you that SIGILL is
> unreliable for this purpose:
> 
> https://docs.kernel.org/arch/arm64/elf_hwcaps.html
> 
Bastien

Commits

  1. Update configure probes for CFLAGS needed for ARM CRC instructions.

  2. Support runtime CRC feature probing on NetBSD/ARM using sysctl().

  3. Use auxv to check for CRC32 instructions on ARM.

  4. Improve our method for probing the availability of ARM CRC instructions.