On 03/28/2016 02:46 AM, Kiyoshi KANAZAWA wrote:
I tried to build gzip-1.7 with solarisstudio12.4 cc, on Solaris10 x64,
and had 'Segmentation Fault' in make check.
% ./configure CC=cc CFLAGS='-m64 -g'
Thanks for reporting that. This exposed some bugs in configure.ac and
lib/match.c: the configuration procedure assumes that, since cc
assembles x86 instructions successfully, the x86 code will actually work
when called from x86-64 code. I fixed this by installing the attached patch.
Also, since -m64 affects the preprocessor output, you need to set
CPPFLAGS and/or put the -m64 into CC instead. Something like the
following should work with gzip 1.7:
./configure CC='cc -m64' CFLAGS='-g' DEFS='-D NO_ASM'
(A space is required between '-D' and 'NO_ASM'.) With the patch, plain
'./configure CC="cc -m64" CFLAGS=-g' should also work.
From a8e5eb6c464c7da9b05e8246d5aa2d66edd39cc9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 28 Mar 2016 16:26:45 -0700
Subject: [PATCH] Port to Oracle Solaris Studio 12.4
Problem reported by Kiyoshi KANAZAWA in: http://bugs.gnu.org/23133
* NEWS: Document this.
* configure.ac (ASMV): Do not define if NO_ASM is
anywhere in DEFS; it doesn't need to be surrounded by white space.
* lib/match.c: Do not use x86 version if __x86_64__ is defined.
---
NEWS | 8 ++++++++
configure.ac | 4 ++--
lib/match.c | 6 +++++-
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index d2bf976..fdae647 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,14 @@ GNU gzip NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
+** Bug fixes
+
+ Port to Oracle Solaris Studio 12 on x86-64.
+ [bug present since at least gzip-1.2.4]
+
+ When configuring gzip, ./configure DEFS='...-DNO_ASM...' now
+ suppresses assembler again. [bug introduced in gzip-1.3.5]
+
* Noteworthy changes in release 1.7 (2016-03-27) [stable]
diff --git a/configure.ac b/configure.ac
index f64df6b..08ad445 100644
--- a/configure.ac
+++ b/configure.ac
@@ -204,8 +204,8 @@ AC_OBJEXT
AC_CACHE_CHECK([for an assembler syntax supported by this package],
[gzip_cv_assembler],
[gzip_cv_assembler=no
- case " $DEFS " in
- *' NO_ASM '*) ;;
+ case $DEFS in
+ *NO_ASM*) ;;
*)
if cp $srcdir/lib/match.c _match.S &&
eval "$CPP $CPPFLAGS $ASCPPFLAGS _match.S > _match.i" &&
diff --git a/lib/match.c b/lib/match.c
index 8846038..41fb03e 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -49,7 +49,11 @@
error: DYN_ALLOC not yet supported in match.s
#endif
-#if defined(i386) || defined(_I386) || defined(__i386) || defined(__i386__)
+/* On x86-64, Sun C 5.13 (Oracle Solaris Studio 12.4) 'cc -E -m64'
+ defines i386 when compiling .s or .S files! Luckily it also
+ defines __x86_64__. See Bug#23133. */
+#if ((defined i386 || defined _I386 || defined __i386 || defined __i386__) \
+ && !defined __x86_64__)
/* This version is for 386 Unix or OS/2 in 32 bit mode.
* Warning: it uses the AT&T syntax: mov source,dest
--
2.5.5