diff --git a/src/port/pg_crc32c_armv8_choose.c b/src/port/pg_crc32c_armv8_choose.c
index f21a8243e9..09f909a298 100644
--- a/src/port/pg_crc32c_armv8_choose.c
+++ b/src/port/pg_crc32c_armv8_choose.c
@@ -8,10 +8,6 @@
  * computation. Otherwise, fall back to the pure software implementation
  * (slicing-by-8).
  *
- * XXX: The glibc-specific getauxval() function, with the HWCAP_CRC32
- * flag, is used to determine if the CRC Extension is available on the
- * current platform. Is there a more portable way to determine that?
- *
  * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
@@ -24,17 +20,27 @@
 
 #include "c.h"
 
-#include <sys/auxv.h>
-#include <asm/hwcap.h>
-
+#include "libpq/pqsignal.h"
 #include "port/pg_crc32c.h"
 
+static volatile sig_atomic_t illegal_instruction_detected;
+pg_crc32c pg_crc32c_armv8_choose_dummy;
+
+static void
+illegal_instruction_handler(int signo)
+{
+	illegal_instruction_detected = 1;
+}
+
 static bool
 pg_crc32c_armv8_available(void)
 {
-	unsigned long auxv = getauxval(AT_HWCAP);
+	illegal_instruction_detected = 0;
+	pqsignal(SIGILL, illegal_instruction_handler);
+	pg_crc32c_armv8_choose_dummy = pg_comp_crc32c_armv8(0, 0, 0);
+	pqsignal(SIGILL, SIG_DFL);
 
-	return (auxv & HWCAP_CRC32) != 0;
+	return illegal_instruction_detected == 0;
 }
 
 /*
