[PATCH] Fix constant division for AMD64 assembly on Solaris/x86
Jussi Kivilinna
jussi.kivilinna at iki.fi
Fri Jan 10 16:06:56 CET 2014
On 09.01.2014 20:18, Richard PALO wrote:
> Le 09/01/14 17:20, Jussi Kivilinna a écrit :
>> On 07.01.2014 17:30, Richard PALO wrote:
>>> Le 05/01/14 17:43, Jussi Kivilinna a écrit :
>>>
>>> Hi, I needed to adjust your patch a bit to work, namely CFLAGS => CPPFLAGS and a bit of logic after the -Wa,--divide test as follows:
>>>> + if test "$gcry_cv_gcc_as_const_division_with_wadivide_ok" = "no" ; then
>>>> + CPPFLAGS="$_gcc_cppflags_save"
>>>> + fi
>>
>> Ah, configure.ac checks are inline assembly in C-language; so CFLAGS are used there. But CPPFLAGS are used for *.S assembly files. Does attached patch work? It modifies CFLAGS for the check and applies the workaround to CPPFLAGS if needed.
>>
>> -Jussi
>>
>>>
>>> this seems to be alright for me now..
>>>
>>> cheers
>>
> Hi Jussi,
>
> Do you mean the updated patch I sent doesn't work for you?
>
> That's real strange. I believe both CPPFLAGS and CFLAGS are always used during configure. That's why I used only cppflags in the reworked patch, and on my machine it works fine (as follows):
>
You're right. I was not fully aware about where/how CPPFLAGS are used, and got confused. Sorry.
-Jussi
>> configure:16940: checking whether GCC assembler handles division correctly
>> configure:16950: gcc -c -O2 -I/opt/local/include -I/usr/include -fvisibility=hidden -I/opt/local/include -I/usr/include -D_REENTRANT conftest.c >&5
>> /var/tmp//ccvAWXuj.s: Assembler messages:
>> /var/tmp//ccvAWXuj.s:3: Error: unbalanced parenthesis in operand 1.
>> configure:16950: $? = 1
>> configure: failed program was:
>> | /* confdefs.h */
>> | #define PACKAGE_NAME "libgcrypt"
>> | #define PACKAGE_TARNAME "libgcrypt"
>> | #define PACKAGE_VERSION "1.6.0"
>> | #define PACKAGE_STRING "libgcrypt 1.6.0"
>> | #define PACKAGE_BUGREPORT "http://bugs.gnupg.org"
>> | #define PACKAGE_URL ""
>> | #define PACKAGE "libgcrypt"
>> | #define VERSION "1.6.0"
>> | #define PACKAGE "libgcrypt"
>> | #define VERSION "1.6.0"
>> | #define STDC_HEADERS 1
>> | #define HAVE_SYS_TYPES_H 1
>> | #define HAVE_SYS_STAT_H 1
>> | #define HAVE_STDLIB_H 1
>> | #define HAVE_STRING_H 1
>> | #define HAVE_MEMORY_H 1
>> | #define HAVE_STRINGS_H 1
>> | #define HAVE_INTTYPES_H 1
>> | #define HAVE_STDINT_H 1
>> | #define HAVE_UNISTD_H 1
>> | #define __EXTENSIONS__ 1
>> | #define _ALL_SOURCE 1
>> | #define _GNU_SOURCE 1
>> | #define _POSIX_PTHREAD_SEMANTICS 1
>> | #define _TANDEM_SOURCE 1
>> | #define HAVE_DLFCN_H 1
>> | #define LT_OBJDIR ".libs/"
>> | #define SIZEOF_UNSIGNED_SHORT 2
>> | #define SIZEOF_UNSIGNED_INT 4
>> | #define SIZEOF_UNSIGNED_LONG 8
>> | #define SIZEOF_UNSIGNED_LONG_LONG 8
>> | #define HAVE_UINTPTR_T 1
>> | #define EGD_SOCKET_NAME ""
>> | #define ENABLE_DRNG_SUPPORT 1
>> | #define PRINTABLE_OS_NAME "SunOS"
>> | #define NAME_OF_DEV_RANDOM "/dev/random"
>> | #define NAME_OF_DEV_URANDOM "/dev/urandom"
>> | #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT
>> | #define HAVE_PTHREAD /**/
>> | #define PTHREAD_IN_USE_DETECTION_HARD 1
>> | #define USE_POSIX_THREADS 1
>> | #define USE_POSIX_THREADS_WEAK 1
>> | #define HAVE_PTHREAD_RWLOCK 1
>> | #define HAVE_PTHREAD_MUTEX_RECURSIVE 1
>> | #define STDC_HEADERS 1
>> | #define HAVE_UNISTD_H 1
>> | #define HAVE_SYS_SELECT_H 1
>> | #define HAVE_SYS_MSG_H 1
>> | #define RETSIGTYPE void
>> | #define HAVE_DECL_SYS_SIGLIST 0
>> | #define HAVE_USHORT_TYPEDEF 1
>> | #define HAVE_ULONG_TYPEDEF 1
>> | #define HAVE_SYS_SOCKET_H 1
>> | #define HAVE_BUILTIN_BSWAP32 1
>> | #define HAVE_BUILTIN_BSWAP64 1
>> | #define HAVE_VLA 1
>> | #define GCRY_USE_VISIBILITY 1
>> | #define HAVE_GCC_ATTRIBUTE_ALIGNED 1
>> | #define HAVE_GCC_ASM_VOLATILE_MEMORY 1
>> | #define HAVE_GCC_INLINE_ASM_SSSE3 1
>> | #define HAVE_GCC_INLINE_ASM_PCLMUL 1
>> | #define HAVE_GCC_INLINE_ASM_AVX 1
>> | #define HAVE_GCC_INLINE_ASM_AVX2 1
>> | #define HAVE_GCC_INLINE_ASM_BMI2 1
>> | /* end confdefs.h. */
>> | __asm__("xorl $(123456789/12345678), %ebp;\n\t");
>> configure:16955: result: no
>> configure:16963: checking whether GCC assembler handles division correctly with "-Wa,--divide"
>> configure:16973: gcc -c -O2 -I/opt/local/include -I/usr/include -fvisibility=hidden -I/opt/local/include -I/usr/include -D_REENTRANT -Wa,--divide conftest.c >&5
>> configure:16973: $? = 0
>> configure:16978: result: yes
>> configure:16991: checking whether GCC assembler is compatible for amd64 assembly implementations
>> configure:17015: gcc -c -O2 -I/opt/local/include -I/usr/include -fvisibility=hidden -I/opt/local/include -I/usr/include -D_REENTRANT -Wa,--divide conftest.c >&5
>> configure:17015: $? = 0
>> configure:17020: result: yes
>> configure:17034: checking whether GCC assembler is compatible for Intel syntax assembly implementations
>> configure:17062: gcc -c -O2 -I/opt/local/include -I/usr/include -fvisibility=hidden -I/opt/local/include -I/usr/include -D_REENTRANT -Wa,--divide conftest.c >&5
>> configure:17062: $? = 0
>> configure:17067: result: yes
>
>
> By the way, I should remind that this patch only fixes assembly with gas (GNU as) which has the '--divide' option...
> User's of sun's /usr/bin/as will get the assembler disabled.
>
>
>
More information about the Gcrypt-devel
mailing list