diff --git a/libgcc/config/aarch64/t-aarch64 b/libgcc/config/aarch64/t-aarch64
index b70e7b94edd2a26ad3c8c9137215c25422dbb938..d500bd0de6728c33a4a0f77c46cbfa4c3aeb2b67 100644
--- a/libgcc/config/aarch64/t-aarch64
+++ b/libgcc/config/aarch64/t-aarch64
@@ -30,3 +30,4 @@ LIB2ADDEH += \
 	$(srcdir)/config/aarch64/__arm_za_disable.S
 
 SHLIB_MAPFILES += $(srcdir)/config/aarch64/libgcc-sme.ver
+LIBGCC2_CFLAGS += -Werror -Wno-prio-ctor-dtor