Home GnuPG

Fix constant division for AMD64 assembly on Solaris/x86
43376891c01fUnpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

Fix constant division for AMD64 assembly on Solaris/x86

* configure.ac (gcry_cv_gcc_as_const_division_ok): Add new check for
constant division in assembly and test for "-Wa,--divide" workaround.
(gcry_cv_gcc_amd64_platform_as_ok): Check for also constant division.

Appearantly on Solaris/x86 '/' character is treated as begining of line
comment by GNU as. This causes problems when compiling SHA-1 SSSE3
implementation:

On 02.01.2014 16:26, Richard PALO wrote:

COLLECT_GCC_OPTIONS='-D' 'HAVE_CONFIG_H' '-I' '.' '-I' '..' '-I' '../src' '-I' '/var/tmp/pkgsrc/security/libgcrypt/work/.buildlink/include' '-I' '/var/tmp/pkgsrc/security/libgcrypt/work/.buildlink/include/gettext' '-D' '_REENTRANT' '-O2' '-MT' 'sha1-ssse3-amd64.lo' '-MD' '-MP' '-MF' '.deps/sha1-ssse3-amd64.Tpo' '-c' '-fPIC' '-D' 'PIC' '-o' '.libs/sha1-ssse3-amd64.o' '-v' '-mtune=generic' '-march=x86-64'
/usr/gnu/bin/as -v -I . -I .. -I ../src -I /var/tmp/pkgsrc/security/libgcrypt/work/.buildlink/include -I /var/tmp/pkgsrc/security/libgcrypt/work/.buildlink/include/gettext -V -Qy -s --64 -o .libs/sha1-ssse3-amd64.o /var/tmpccAxWPXX.s
GNU assembler version 2.23.1 (i386-pc-solaris2.11) using BFD version (GNU Binutils) 2.23.1
/var/tmp
ccAxWPXX.s: Assembler messages:
/var/tmpccAxWPXX.s:34: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:38: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:42: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:46: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:54: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:58: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:62: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:66: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:70: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:74: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:78: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:82: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:86: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:90: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:94: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:98: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:102: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:106: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:110: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:114: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:119: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:123: Error: unbalanced parenthesis in operand 1.
/var/tmpccAxWPXX.s:127: Error: unbalanced parenthesis in operand 1.
/var/tmp
ccAxWPXX.s:132: Error: unbalanced parenthesis in operand 1.

apparently the paddd code, such as

`paddd (.LK_XMM + ((i)/20)*16) RIP, tmp0;`

isn't digested well, appended is the generated assembler code.

On 02.01.2014 17:41, Richard PALO wrote:

Hi again, after finding the following:
https://sourceware.org/bugzilla/show_bug.cgi?id=4572

I tried using '-Wa,--divide' and that seemed to workaround the problem...

perhaps the code, or at least the Makefile could be adapted accordingly?

Patch adds detection of this feature and attempts to workaround issue with by
adding "-Wa,--divide" to CPPFLAGS. If workaround does not work (old GAS on
Solaris/x86), we'll disable AMD64 assembly.

[v3]:

  • Update CPPFLAGS after testing instead of CFLAGS.

Reported-and-tested-by: Richard PALO <richard.palo@free.fr>

  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Jan 12 2014, 9:53 AM
Parents
rCb0ac1f9b143a: Use the generic autogen.sh script.
Branches
Unknown
Tags
Unknown

Event Timeline

Jussi Kivilinna <jussi.kivilinna@iki.fi> committed rC43376891c01f: Fix constant division for AMD64 assembly on Solaris/x86 (authored by Jussi Kivilinna <jussi.kivilinna@iki.fi>).Jan 12 2014, 9:53 AM