aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac23
-rw-r--r--src/gen-posix-lock-obj.c19
-rw-r--r--src/syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h1
3 files changed, 42 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 653d7ed..e1f167f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,6 +167,20 @@ AC_CHECK_FUNCS([flockfile])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
+#
+# Check whether the compiler supports the GCC style aligned attribute
+#
+AC_CACHE_CHECK([whether the GCC style aligned attribute is supported],
+ [gcry_cv_gcc_attribute_aligned],
+ [gcry_cv_gcc_attribute_aligned=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [[struct { int a; } foo __attribute__ ((aligned (16)));]])],
+ [gcry_cv_gcc_attribute_aligned=yes])])
+if test "$gcry_cv_gcc_attribute_aligned" = "yes" ; then
+ AC_DEFINE(HAVE_GCC_ATTRIBUTE_ALIGNED,1,
+ [Defined if a GCC style "__attribute__ ((aligned (n))" is supported])
+fi
+
# Check for thread library.
#
@@ -278,5 +292,12 @@ echo "
Revision: mym4_revision (mym4_revision_dec)
Platform: $host
-
"
+if test "$gcry_cv_gcc_attribute_aligned" != "yes" ; then
+cat <<G10EOF
+***
+*** Please not that your compiler does not support the GCC style
+*** aligned attribute. Using this software may evoke bus errors.
+***
+G10EOF
+fi
diff --git a/src/gen-posix-lock-obj.c b/src/gen-posix-lock-obj.c
index df732c3..d2bc645 100644
--- a/src/gen-posix-lock-obj.c
+++ b/src/gen-posix-lock-obj.c
@@ -40,6 +40,19 @@
# error sizeof pthread_mutex_t is not known.
#endif
+/* Special requirements for certain platforms. */
+#if defined(__hppa__) && defined(__linux__)
+# define USE_16BYTE_ALIGNMENT 1
+#else
+# define USE_16BYTE_ALIGNMENT 0
+#endif
+
+
+#if USE_16BYTE_ALIGNMENT && !HAVE_GCC_ATTRIBUTE_ALIGNED
+# error compiler is not able to enforce a 16 byte alignment
+#endif
+
+
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
@@ -76,6 +89,7 @@ main (void)
" long _vers;\n"
" union {\n"
" volatile char _priv[%d];\n"
+ "%s"
" long _x_align;\n"
" long *_xp_align;\n"
" } u;\n"
@@ -84,6 +98,11 @@ main (void)
"#define GPGRT_LOCK_INITIALIZER {%d,{{",
HOST_TRIPLET_STRING,
SIZEOF_PTHREAD_MUTEX_T,
+#if USE_16BYTE_ALIGNMENT
+ " int _x16_align __attribute__ ((aligned (16)));\n",
+#else
+ "",
+#endif
LOCK_ABI_VERSION);
p = (unsigned char *)&mtx;
for (i=0; i < sizeof mtx; i++)
diff --git a/src/syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h b/src/syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h
index fd47664..b57bb76 100644
--- a/src/syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h
+++ b/src/syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h
@@ -7,6 +7,7 @@ typedef struct
long _vers;
union {
volatile char _priv[48];
+ int _x16_align __attribute__ ((aligned (16)));
long _x_align;
long *_xp_align;
} u;