[Pkg-gnupg-commit] [libgpg-error] 24/35: Fix for HPPA.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Apr 25 21:47:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository libgpg-error.

commit f1104b92249005a31961d1a32c38ba65a0b3ff3a
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Mon Apr 25 16:46:46 2016 +0900

    Fix for HPPA.
    
    * configure.ac (HAVE_GCC_ATTRIBUTE_ALIGNED): Revert.
    * src/gen-posix-lock-obj.c (USE_16BYTE_ALIGNMENT): Revert.
    * src/syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h: Revert.
    
    --
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
    
    This fixes commit 5168b97.  I considered wrongly that long double were
    128-bit in HPPA.  Currently, all that we can do for HPPA is assuming
    GCC and use its extension of "aligned" attribute.
---
 configure.ac                                     | 22 ++++++++++++++++++++++
 src/gen-posix-lock-obj.c                         | 13 ++++++++++---
 src/syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h |  2 +-
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6d25b51..566ea62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -274,6 +274,20 @@ if test "$GCC" = yes; then
 fi
 
 #
+# 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 ELF visibility support.
 #
 AC_CACHE_CHECK(whether the visibility attribute is supported,
@@ -544,3 +558,11 @@ echo "
         Revision: mym4_revision  (mym4_revision_dec)
         Platform: $host$tmp
 "
+if test "$gcry_cv_gcc_attribute_aligned" != "yes" ; then
+cat <<G10EOF
+***
+***  Please note 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 79b56de..e32a3cd 100644
--- a/src/gen-posix-lock-obj.c
+++ b/src/gen-posix-lock-obj.c
@@ -43,6 +43,7 @@
 #endif
 
 /* Special requirements for certain platforms.  */
+# define USE_LONG_DOUBLE_FOR_ALIGNMENT 0
 #if defined(__sun) && !defined (__LP64__) && !defined(_LP64)
 /* Solaris on 32-bit architecture.  */
 # define USE_DOUBLE_FOR_ALIGNMENT 1
@@ -50,9 +51,13 @@
 # define USE_DOUBLE_FOR_ALIGNMENT 0
 #endif
 #if defined(__hppa__)
-# define USE_LONG_DOUBLE_FOR_ALIGNMENT 1
+# define USE_16BYTE_ALIGNMENT 1
 #else
-# define USE_LONG_DOUBLE_FOR_ALIGNMENT 0
+# 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
 
 #ifdef USE_POSIX_THREADS
@@ -117,7 +122,9 @@ main (void)
           "\n"
           "#define GPGRT_LOCK_INITIALIZER {%d,{{",
           SIZEOF_PTHREAD_MUTEX_T,
-# if USE_DOUBLE_FOR_ALIGNMENT
+# if USE_16BYTE_ALIGNMENT
+          "    int _x16_align __attribute__ ((aligned (16)));\n",
+# elif USE_DOUBLE_FOR_ALIGNMENT
           "    double _xd_align;\n",
 # elif USE_LONG_DOUBLE_FOR_ALIGNMENT
           "    long double _xld_align;\n",
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 3682577..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,7 +7,7 @@ typedef struct
   long _vers;
   union {
     volatile char _priv[48];
-    long double _xld_align;
+    int _x16_align __attribute__ ((aligned (16)));
     long _x_align;
     long *_xp_align;
   } u;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libgpg-error.git



More information about the Pkg-gnupg-commit mailing list