diff --git a/popt-alignment-checks.patch b/popt-alignment-checks.patch new file mode 100644 index 0000000..b00df4e --- /dev/null +++ b/popt-alignment-checks.patch @@ -0,0 +1,74 @@ +Index: popt-1.16/configure.ac +=================================================================== +--- popt-1.16.orig/configure.ac ++++ popt-1.16/configure.ac +@@ -47,7 +47,7 @@ AC_SYS_LARGEFILE + + AC_ISC_POSIX + +-AC_CHECK_HEADERS(float.h fnmatch.h glob.h langinfo.h libintl.h mcheck.h unistd.h) ++AC_CHECK_HEADERS(float.h fnmatch.h glob.h langinfo.h libintl.h mcheck.h unistd.h stdalign.h) + + # For some systems we know that we have ld_version scripts. + # Use it then as default. +Index: popt-1.16/popt.c +=================================================================== +--- popt-1.16.orig/popt.c ++++ popt-1.16/popt.c +@@ -25,6 +25,15 @@ extern long long int strtoll(const char + + #include "poptint.h" + ++#ifdef HAVE_STDALIGN_H ++#include ++#define ALIGNOF(x) alignof(x) ++#elif defined __GNUC__ ++#define ALIGNOF(x) __alignof__(x) ++#else ++#define ALIGNOF(x) sizeof(x) ++#endif ++ + #ifdef MYDEBUG + /*@unchecked@*/ + int _popt_debug = 0; +@@ -977,12 +986,8 @@ static unsigned int seed = 0; + + int poptSaveLongLong(long long * arg, unsigned int argInfo, long long aLongLong) + { +- if (arg == NULL +-#ifdef NOTYET + /* XXX Check alignment, may fail on funky platforms. */ +- || (((unsigned long long)arg) & (sizeof(*arg)-1)) +-#endif +- ) ++ if (arg == NULL || (((unsigned long)arg) & (ALIGNOF(*arg)-1))) + return POPT_ERROR_NULLARG; + + if (aLongLong != 0 && LF_ISSET(RANDOM)) { +@@ -1023,7 +1028,7 @@ int poptSaveLongLong(long long * arg, un + int poptSaveLong(long * arg, unsigned int argInfo, long aLong) + { + /* XXX Check alignment, may fail on funky platforms. */ +- if (arg == NULL || (((unsigned long)arg) & (sizeof(*arg)-1))) ++ if (arg == NULL || (((unsigned long)arg) & (ALIGNOF(*arg)-1))) + return POPT_ERROR_NULLARG; + + if (aLong != 0 && LF_ISSET(RANDOM)) { +@@ -1056,7 +1061,7 @@ int poptSaveLong(long * arg, unsigned in + int poptSaveInt(/*@null@*/ int * arg, unsigned int argInfo, long aLong) + { + /* XXX Check alignment, may fail on funky platforms. */ +- if (arg == NULL || (((unsigned long)arg) & (sizeof(*arg)-1))) ++ if (arg == NULL || (((unsigned long)arg) & (ALIGNOF(*arg)-1))) + return POPT_ERROR_NULLARG; + + if (aLong != 0 && LF_ISSET(RANDOM)) { +@@ -1089,7 +1094,7 @@ int poptSaveInt(/*@null@*/ int * arg, un + int poptSaveShort(/*@null@*/ short * arg, unsigned int argInfo, long aLong) + { + /* XXX Check alignment, may fail on funky platforms. */ +- if (arg == NULL || (((unsigned long)arg) & (sizeof(*arg)-1))) ++ if (arg == NULL || (((unsigned long)arg) & (ALIGNOF(*arg)-1))) + return POPT_ERROR_NULLARG; + + if (aLong != 0 && LF_ISSET(RANDOM)) { diff --git a/popt.changes b/popt.changes index 676c243..1cd482f 100644 --- a/popt.changes +++ b/popt.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Oct 7 14:25:32 UTC 2013 - schwab@suse.de + +- popt-alignment-checks.patch: fix alignment checks + ------------------------------------------------------------------- Sun Jul 7 16:34:40 UTC 2013 - jengelh@inai.de diff --git a/popt.spec b/popt.spec index bb8bdf7..b805eef 100644 --- a/popt.spec +++ b/popt.spec @@ -32,6 +32,7 @@ BuildRequires: libtool BuildRequires: pkgconfig BuildRoot: %{_tmppath}/%{name}-%{version}-build Patch0: popt-libc-updates.patch +Patch1: popt-alignment-checks.patch %description Popt is a C library for parsing command line parameters. Popt was @@ -71,6 +72,7 @@ API documentation of the popt library, too. %prep %setup -q %patch0 +%patch1 -p1 %build autoreconf -fiv