1 This patch fixes gen-posix-lock-obj used during library build process to
2 generate gpg-error.h. libgpg-error package delivers the gpg-error.h
3 header file to the target system. When built on Solaris, the updated
4 part of the code generates definition of the gpgrt_lock_t so that it
5 respects the required alignment on SPARCv7 (32bit).
7 The fix can be tested using 'gmake test' in the libgcrypt component. If
8 not applied, the t-lock and random tests fail consistently. For more
9 information see: https://bugs.gnupg.org/gnupg/issue2378
11 The fix was created internally and offered for integration to the
12 upstream. It has not been accepted yet.
14 --- ./src/gen-posix-lock-obj.c.orig Mon Jun 13 08:07:53 2016
15 +++ ./src/gen-posix-lock-obj.c Mon Jun 13 08:08:40 2016
20 -/* Special requirements for certain platforms. */
21 -# define USE_LONG_DOUBLE_FOR_ALIGNMENT 0
22 -#if defined(__sun) && !defined (__LP64__) && !defined(_LP64)
23 -/* Solaris on 32-bit architecture. */
24 -# define USE_DOUBLE_FOR_ALIGNMENT 1
26 -# define USE_DOUBLE_FOR_ALIGNMENT 0
28 -#if defined(__hppa__)
29 -# define USE_16BYTE_ALIGNMENT 1
31 -# define USE_16BYTE_ALIGNMENT 0
34 -#if USE_16BYTE_ALIGNMENT && !HAVE_GCC_ATTRIBUTE_ALIGNED
35 +#if defined(__hppa__) && !HAVE_GCC_ATTRIBUTE_ALIGNED
36 # error compiler is not able to enforce a 16 byte alignment
41 "#define GPGRT_LOCK_INITIALIZER {%d,{{",
42 SIZEOF_PTHREAD_MUTEX_T,
43 -# if USE_16BYTE_ALIGNMENT
44 +/* Special requirements for certain platforms. */
46 " int _x16_align __attribute__ ((aligned (16)));\n",
47 -# elif USE_DOUBLE_FOR_ALIGNMENT
48 - " double _xd_align;\n",
49 -# elif USE_LONG_DOUBLE_FOR_ALIGNMENT
50 - " long double _xld_align;\n",
51 +# elif defined(__sun)
52 + "#if (defined(__sparc) || defined(__sparc__)) && \\\n"
53 + " !defined (__LP64__) && !defined(_LP64)\n"
54 + " double _xd_align;\n"