Portability: common-src/amcrc32chw.c & config/amanda/amanda_configure.m4
[email protected] (Eric Schnoebelen)
| Newsgroups | gmane.comp.archivers.amanda.devel |
|---|---|
| Message-ID | <[email protected]> |
Issue: Attempting to use gcc __builtin functions without appropriate feature tests. Not all platforms use gcc, and not all gcc platforms provide the __builtin_ia32_* functions (as not all gcc platforms are necessarily x86_*) Solution: add feature test macros for the __builtin_ia32_* functions being used, and wrapper their use with the feature test macro. patches inline and as attachments $NetBSD$ Add tests for the gcc __builtin_ia32_crc32[qdsu]i functions. --- config/amanda/amanda_configure.m4.orig 2016-11-23 16:11:15.000000000 +0000 +++ config/amanda/amanda_configure.m4 @@ -364,8 +364,9 @@ ICE_CHECK_DECL(strcasecmp,string.h strin ICE_CHECK_DECL(euidaccess,unistd.h) ICE_CHECK_DECL(eaccess,unistd.h) ICE_CHECK_DECL(clock_gettime,time.h) -AC_CHECK_FUNCS(getservbyname_r) +ICE_CHECK_DECL(getservbyname_r, netdb.h) AC_CHECK_FUNCS(sem_timedwait) +AC_CHECK_FUNCS(__builtin_ia32_crc32qi __builtin_ia32_crc32di __builtin_ia32_crc32si __builtin_ia32_crc32hi) # # Devices $NetBSD$ Change the test to use a feature test macro for the existance of the builtin functions being used. (bad programmer, using compiler internal routines in public code.) --- common-src/amcrc32chw.c.orig 2016-11-23 16:11:16.000000000 +0000 +++ common-src/amcrc32chw.c @@ -29,7 +29,11 @@ #include <amutil.h> #include <amcrc32chw.h> -#if defined __GNUC__ && GCC_VERSION > 40300 && (defined __x86_64__ || defined __i386__ || defined __i486__ || defined __i586__ || defined __i686__) +#if defined HAVE___BUILTIN_IA32_CRC32QI && \ + defined HAVE___BUILTIN_IA32_CRC32DI && \ + defined HAVE___BUILTIN_IA32_CRC32SI && \ + defined HAVE___BUILTIN_IA32_CRC32UI + #define POLY 0x82F63B78 /* Multiply a matrix times a vector over the Galois field of two elements,
config_amanda_amanda_configure.m4.patch
(text/plain, 590 B)
$NetBSD$ Add tests for the gcc __builtin_ia32_crc32[qdsu]i functions. --- config/amanda/amanda_configure.m4.orig 2016-11-23 16:11:15.000000000 +0000 +++ config/amanda/amanda_configure.m4 @@ -364,8 +364,9 @@ ICE_CHECK_DECL(strcasecmp,string.h strin ICE_CHECK_DECL(euidaccess,unistd.h) ICE_CHECK_DECL(eaccess,unistd.h) ICE_CHECK_DECL(clock_gettime,time.h) -AC_CHECK_FUNCS(getservbyname_r) +ICE_CHECK_DECL(getservbyname_r, netdb.h) AC_CHECK_FUNCS(sem_timedwait) +AC_CHECK_FUNCS(__builtin_ia32_crc32qi __builtin_ia32_crc32di __builtin_ia32_crc32si __builtin_ia32_crc32hi) # # Devices
common-src_amcrc32chw.c.patch
(text/plain, 766 B)
$NetBSD$ Change the test to use a feature test macro for the existance of the builtin functions being used. (bad programmer, using compiler internal routines in public code.) --- common-src/amcrc32chw.c.orig 2016-11-23 16:11:16.000000000 +0000 +++ common-src/amcrc32chw.c @@ -29,7 +29,11 @@ #include <amutil.h> #include <amcrc32chw.h> -#if defined __GNUC__ && GCC_VERSION > 40300 && (defined __x86_64__ || defined __i386__ || defined __i486__ || defined __i586__ || defined __i686__) +#if defined HAVE___BUILTIN_IA32_CRC32QI && \ + defined HAVE___BUILTIN_IA32_CRC32DI && \ + defined HAVE___BUILTIN_IA32_CRC32SI && \ + defined HAVE___BUILTIN_IA32_CRC32UI + #define POLY 0x82F63B78 /* Multiply a matrix times a vector over the Galois field of two elements,