Package: libgpg-error
Version: 1.13-0.3
Severity: normal
Tags: patch
libgpg-error fails to build on hppa because the t-lock test fails.
The test fails because the _gpgrt_lock_t and gpgrt_lock_t objects have
different sizes. This happens becuase the pthread_mutex_t type on
hppa-linux has 16-byte alignement:
/* Data structures for mutex handling. The structure of the attribute
type is not exposed on purpose. */
typedef union
{
struct __pthread_mutex_s
{
int __lock __attribute__ ((aligned(16)));
unsigned int __count;
int __owner;
/* KIND must stay at this position in the structure to maintain
binary compatibility. */
int __kind;
/* The old 4-word 16-byte aligned lock. This is initalized
to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
Unused in NPTL. */
int __compat_padding[4];
/* In the old structure there are 4 words left due to alignment.
In NPTL two words are used. */
unsigned int __nusers;
__extension__ union
{
int __spins;
__pthread_slist_t __list;
};
/* Two more words are left before the NPTL
pthread_mutex_t is larger than Linuxthreads. */
int __reserved1;
int __reserved2;
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
long int __align;
} pthread_mutex_t;
The code in gen-posix-lock-obj.c assumes that a long or pointer to long
will provide sufficient alignment:
/* To force a probably suitable alignment of the structure we use a
union and include a long and a pointer to a long. */
printf ("## lock-obj-pub.%s.h\n"
"## File created by " PGM " - DO NOT EDIT\n"
"## To be included by mkheader into gpg-error.h\n"
"\n"
"typedef struct\n"
"{\n"
" long _vers;\n"
" union {\n"
" volatile char _priv[%d];\n"
" long _x_align;\n"
" long *_xp_align;\n"
" } u;\n"
"} gpgrt_lock_t;\n"
"\n"
"#define GPGRT_LOCK_INITIALIZER {%d,{{",
HOST_TRIPLET_STRING,
SIZEOF_PTHREAD_MUTEX_T,
LOCK_ABI_VERSION);
The attached hack resolves the issue.
-- System Information:
Debian Release: jessie/sid
APT prefers unreleased
APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: hppa (parisc64)
Kernel: Linux 3.16.0-rc7+ (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to en_CA.utf8)
Shell: /bin/sh linked to /bin/dash
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
libgpg-error (1.13-0.3) unstable; urgency=medium
.
* Non-maintainer upload.
* Use dh-autoreconf instead of autotools-dev. Closes: #749522.
Author: Matthias Klose <[email protected]>
Bug-Debian: http://bugs.debian.org/749522
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>
--- libgpg-error-1.13.orig/src/gen-posix-lock-obj.c
+++ libgpg-error-1.13/src/gen-posix-lock-obj.c
@@ -75,6 +75,9 @@ main (void)
" long _vers;\n"
" union {\n"
" volatile char _priv[%d];\n"
+#if defined(__hppa__) && defined(__linux__)
+ " int __lock __attribute__ ((aligned(16)));\n"
+#endif
" long _x_align;\n"
" long *_xp_align;\n"
" } u;\n"