> I'd just change the "rd" to "rdpr" without any ifdef.
Thanks for the explanations. Like this?
Index: Makefile
===================================================================
RCS file: /cvs/ports/security/polarssl/Makefile,v
retrieving revision 1.45
diff -u -p -r1.45 Makefile
--- Makefile 2 Apr 2022 13:52:41 -0000 1.45
+++ Makefile 2 Apr 2022 16:15:22 -0000
@@ -6,6 +6,7 @@ GH_ACCOUNT= ARMmbed
GH_PROJECT= mbedtls
GH_TAGNAME= mbedtls-2.28.0
DISTNAME= ${GH_TAGNAME}
+REVISION= 0
# check SOVERSION
SHARED_LIBS += mbedtls 7.0
Index: patches/patch-library_timing_c
===================================================================
RCS file: patches/patch-library_timing_c
diff -N patches/patch-library_timing_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-library_timing_c 2 Apr 2022 19:25:01 -0000
@@ -0,0 +1,23 @@
+Use unprivileged read from %tick register to avoid SIGILL on sparc64.
+
+Index: library/timing.c
+--- library/timing.c.orig
++++ library/timing.c
+@@ -137,7 +137,7 @@ unsigned long mbedtls_timing_hardclock( void )
+ #if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \
+ defined(__GNUC__) && defined(__sparc64__)
+
+-#if defined(__OpenBSD__)
++#if 0
+ #warning OpenBSD does not allow access to tick register using software
version instead
+ #else
+ #define HAVE_HARDCLOCK
+@@ -145,7 +145,7 @@ unsigned long mbedtls_timing_hardclock( void )
+ unsigned long mbedtls_timing_hardclock( void )
+ {
+ unsigned long tick;
+- asm volatile( "rdpr %%tick, %0;" : "=&r" (tick) );
++ asm volatile( "rd %%tick, %0;" : "=&r" (tick) );
+ return( tick );
+ }
+ #endif /* __OpenBSD__ */