Bug 12101 - [3.3/3.4 Regression] i386 Solaris no longer works with GNU as?
Summary: [3.3/3.4 Regression] i386 Solaris no longer works with GNU as?
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3
: P2 critical
Target Milestone: 3.3.2
Assignee: Rainer Orth
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2003-08-29 00:56 UTC by Joe Weening
Modified: 2004-01-17 04:22 UTC (History)
1 user (show)

See Also:
Host: i386-pc-solaris2.8
Target: i386-pc-solaris2.8
Build: i386-pc-solaris2.8
Known to work:
Known to fail:
Last reconfirmed: 2003-09-02 15:40:10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Weening 2003-08-29 00:56:50 UTC
I've configured GCC 3.3 using --with-as=/usr/local/gnu/bin/as which is GNU as
(from binutils 2.13).  However it now outputs the Sun assembler syntax for
cmov instructions, e.g. "cmovl.s".  GCC 3.2 outputs "cmovs" when configured
with the GNU assembler on an i386 Solaris system.

The change appears to be related to the fact that gcc/config/i386/sol2.h
now sets CMOV_SUN_AS_SYNTAX unconditionally whereas prior to GCC 3.3, it
didn't set it when configured to compile for the GNU assembler.
Comment 1 Andrew Pinski 2003-08-29 01:29:20 UTC
This patch removed support <http://gcc.gnu.org/ml/gcc-patches/2002-06/msg01616.html> for 
checking for gas at configure time.
Comment 2 Rainer Orth 2003-09-02 15:40:09 UTC
I'm looking into this.  Would you please tell me how exactly the problem occured
for you:

* what version of gas did you use?

* during a regular bootstrap of gcc 3.3 (if so, what configure options and
  make command did you use?)

* compiling some file after bootstrap finished (if so, please attach the
  preprocessed input file and the exact compilation command used)

I'll probably go for detecting the support cmov syntax at configure time
instead of fixing the current hack to hard code the outcome.
Comment 3 Rainer Orth 2003-09-03 18:26:37 UTC
Subject: Re:  [3.3/3.4 Regression] i386 Solaris no longer works with GNU as?

Hi Joe,

[please keep gcc-bugzilla on the Cc: so this info lands in Bugzilla as
well.  Thanks.]

> In reply to your questions:
> 
> * what version of gas did you use?
> 
> It reports "GNU assembler 2.13" (from binutils-2.13).
> 
> * during a regular bootstrap of gcc 3.3 (if so, what configure options and
>   make command did you use?)
> 
> The configure command was:
> /usr/local/gnu/src/gcc-3.3/configure --prefix=/usr/local/gnu --with-as=/usr/local/gnu/bin/as

You usually have to add --with-gnu-as as well if the assembler specified
with --with-as is GNU as.

> My path was setup to use GNU "make" instead of Sun's "make" program.
> Also I did "setenv NM_FOR_TARGET /usr/local/gnu/bin/nm" before running
> configure; but I've forgotten why.  (Sorry.)
> 
> * compiling some file after bootstrap finished (if so, please attach the
>   preprocessed input file and the exact compilation command used)
> 
> The way I discovered the problem was by running the configure script
> of gmp-4.1.  It compiles and runs the following program to check for
> various GCC problems:
> 
> 
> /* The following provokes an internal error from gcc 2.95.2 -mpowerpc64
>    (without -maix64), hence detecting an unusable compiler */
> void *g() { return (void *) 0; }
> void *f() { return g(); }
> 
> /* The following provokes an invalid instruction syntax from i386 gcc
>    -march=pentiumpro on Solaris 2.8.  The native sun assembler
>    requires a non-standard syntax for cmov which gcc (as of 2.95.2 at
>    least) doesn't know.  */
> int n;
> int cmov () { return (n >= 0 ? n : 0); }
> 
> int main () { return 0; }
> 
> 
> Based on the results, it discovered the problem with the cmov syntax,
> and adjusted GMP's configuration to avoid generating it.
> 
> I'm going to be away from my email for several weeks, beginning
> tomorrow, so won't be able to give you additional info for a while.

Ok, thanks for the info.

Although the problem was alread obvious from Andrew's comment, I've now
been able to reproduce it myself:

I've configured mainline for i686-pc-solaris2.9 with gas 2.14 and
bootstrapped with BOOT_CFLAGS='-g -O2 -march=i686', i.e. in the same way
originally used to verify the patch that introduced CMOV_SUN_AS_SYNTAX.
After fixing an unrelated problem caused by using gas 2.14 with the native
ld, bootstrap failed with the same syntax error as before that patch.  The
macro had been defined in a very contrieved location, which got lost during
my config/sol2.h rewrite.

I'm currently testing a patch for 3.4 that detects support for Sun vs. gas
cmov syntax at configure time and defines (the equivalent of) the above
macro accordingly.  Bootstrap finished, and the testsuite run is in
progress.  Afterwards, I'll verify the patch with the native as as well.

The patch for 3.3.2 needs to be slightly different because that part of
configure.in changed significantly in 3.4, but this will be easy as well.

Maybe I get this this done and verified before the weekend, otherwise this
will have to wait another week until I return from a short vacation.

	Rainer
Comment 4 GCC Commits 2003-09-04 21:39:07 UTC
Subject: Bug 12101

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ro@gcc.gnu.org	2003-09-04 21:39:00

Modified files:
	gcc            : ChangeLog configure.in configure config.in 
	gcc/config/i386: i386.c sol2.h 

Log message:
	* configure.in (gcc_cv_as_ix86_cmov_sun_syntax): Check if
	assembler supports Sun syntax for cmov.
	* configure: Regenerate.
	* config.in: Likewise.
	* config/i386/i386.c: Rename CMOV_SUN_AS_SYNTAX to
	HAVE_AS_IX86_CMOV_SUN_SYNTAX.
	* config/i386/sol2.h (CMOV_SUN_AS_SYNTAX): Remove.
	Fixes PR target/12101.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.973&r2=2.974
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/configure.in.diff?cvsroot=gcc&r1=1.723&r2=1.724
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/configure.diff?cvsroot=gcc&r1=1.740&r2=1.741
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config.in.diff?cvsroot=gcc&r1=1.172&r2=1.173
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.598&r2=1.599
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/sol2.h.diff?cvsroot=gcc&r1=1.26&r2=1.27

Comment 6 Rainer Orth 2003-09-09 19:53:54 UTC
Fixed for 3.3.2, 3.4:

http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00217.html