This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Assembler error under Solaris 2.6 x86


On Tue, 9 February 1999, 17:00:40, tuan@optimus.mitre.org wrote:

 > Hi,
 > 
 > Here are the source files.  I'm can't seem to compile the object file
 > for UtEnvironment.C.  My compile line is:
 > g++ -I. -Wall -g -c UtEnvironment.C
 > 
 > Please note that this compiles under Linux with egcs 1.0.3a
 > but not under Solaris x86 2.6 with either egcs 1.1.1 or gcc 2.8.1.
 > I get the Assembler error mentioned below.  I have not tried 
 > egcs 1.0.3a or any snapshot releases under Solaris x86 2.6.
 > 
 > Thanks,
 > Tuan

Well, it's what I initially suspected; Solaris' native "/usr/ccs/bin/as"
is responsible for your grief.  Take a look at my session on
i386-pc-solaris2.7:

Script started on Wed 10 Feb 1999 08:27:27 PM MET
sh-2.02$ gcc -v
Reading specs from /tools/gnu/lib/gcc-lib/i386-pc-solaris2.7/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
sh-2.02$ gcc -I. -Wall -g -c UtEnvironment.C 
sh-2.02$ gcc --print-prog-name=as
/tools/gnu/i386-pc-solaris2.7/bin/as
sh-2.02$ /tools/gnu/i386-pc-solaris2.7/bin/as --version
GNU assembler 2.9.1
Copyright 1997 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `i386-pc-solaris2.7'.
sh-2.02$ gcc -B/usr/ccs/bin/ -I. -Wall -g -c UtEnvironment.C 
Assembler: UtEnvironment.C
	aline 29927	: symbol already has a type
	aline 29928	: multiply defined label
	aline 29965	: symbol already has a size
	aline 31454	: symbol already has a type
	aline 31455	: multiply defined label
	aline 31560	: symbol already has a size
sh-2.02$ gcc -B/usr/ccs/bin/ --print-prog-name=as
/usr/ccs/bin/as
sh-2.02$ exit

script done on Wed 10 Feb 1999 08:29:19 PM MET

As you  can see, GNU   as assembles your code   without a hitch, while
/usr/ccs/bin/as  is    complaining.  I've     appended  a patch     to
binutils-2.9.1.tar.gz, which allows you  to build/use even GNU "ld" on
this particular system.

Later,
manfred

-------- BEGIN: PATCH for GNU binutils on i386-pc-solaris2.x ---------
binutils-2.9.1/ChangeLog

1999-01-29  Manfred Hollstein  <manfred@s-direktnet.de>

	* configure.in: Add comment explaining that we can live with
	"buggy" libc, perl, etc. on "i[3456]86-*-solaris2*".

binutils-2.9.1/gas/ChangeLog

Sat Sep  5 19:00:38 1998  Ian Lance Taylor  <ian@cygnus.com>

	* ehopt.c (check_eh_frame): Check the size of the FDE, and don't
	optimize across FDE boundaries.

binutils-2.9.1/ld/ChangeLog

1999-01-29  Manfred Hollstein  <manfred@s-direktnet.de>

	* configure.tgt: Add "i[3456]86-*-solaris2*" to list of
	supported targets.

diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el binutils-2.9.1.orig/configure.in binutils-2.9.1/configure.in
--- binutils-2.9.1.orig/configure.in	Fri May  1 18:00:42 1998
+++ binutils-2.9.1/configure.in	Fri Jan 29 15:27:58 1999
@@ -613,7 +613,8 @@ case "${target}" in
     # The linker does static linking correctly, but the Solaris C library
     # has bugs such that some important functions won't work when statically
     # linked.  (See man pages for getpwuid, for example.)
-    noconfigdirs="$noconfigdirs ld target-libgloss"
+    # manfred@s-direktnet.de: we can live with it.
+    # noconfigdirs="$noconfigdirs ld target-libgloss"
     ;;
   i[3456]86-*-sysv4*)
     # The SYSV4 C compiler doesn't handle Emacs correctly
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el binutils-2.9.1.orig/gas/ehopt.c binutils-2.9.1/gas/ehopt.c
--- binutils-2.9.1.orig/gas/ehopt.c	Fri May  1 17:45:09 1998
+++ binutils-2.9.1/gas/ehopt.c	Fri Jan 29 15:22:43 1999
@@ -261,17 +261,52 @@ check_eh_frame (exp, pnbytes)
      expressionS *exp;
      unsigned int *pnbytes;
 {
+  static int saw_size;
+  static symbolS *size_end_sym;
   static int saw_advance_loc4;
   static fragS *loc4_frag;
   static int loc4_fix;
 
+  if (saw_size
+      && S_IS_DEFINED (size_end_sym))
+    {
+      /* We have come to the end of the CIE or FDE.  See below where
+         we set saw_size.  We must check this first because we may now
+         be looking at the next size.  */
+      saw_size = 0;
+      saw_advance_loc4 = 0;
+    }
+
   if (flag_traditional_format)
     {
       /* Don't optimize.  */
     }
   else if (strcmp (segment_name (now_seg), ".eh_frame") != 0)
-    saw_advance_loc4 = 0;
-  else if (*pnbytes == 1
+    {
+      saw_size = 0;
+      saw_advance_loc4 = 0;
+    }
+  else if (! saw_size
+	   && *pnbytes == 4)
+    {
+      /* This might be the size of the CIE or FDE.  We want to know
+         the size so that we don't accidentally optimize across an FDE
+         boundary.  We recognize the size in one of two forms: a
+         symbol which will later be defined as a difference, or a
+         subtraction of two symbols.  Either way, we can tell when we
+         are at the end of the FDE because the symbol becomes defined
+         (in the case of a subtraction, the end symbol, from which the
+         start symbol is being subtracted).  Other ways of describing
+         the size will not be optimized.  */
+      if ((exp->X_op == O_symbol || exp->X_op == O_subtract)
+	  && ! S_IS_DEFINED (exp->X_add_symbol))
+	{
+	  saw_size = 1;
+	  size_end_sym = exp->X_add_symbol;
+	}
+    }
+  else if (saw_size
+	   && *pnbytes == 1
 	   && exp->X_op == O_constant
 	   && exp->X_add_number == DW_CFA_advance_loc4)
     {
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el binutils-2.9.1.orig/ld/configure.tgt binutils-2.9.1/ld/configure.tgt
--- binutils-2.9.1.orig/ld/configure.tgt	Fri May  1 17:48:48 1998
+++ binutils-2.9.1/ld/configure.tgt	Fri Jan 29 15:25:03 1999
@@ -80,6 +80,7 @@ i[3456]86-*-linux-gnu*)	targ_emul=elf_i3
 			targ_extra_emuls=i386linux
 			tdir_i386linux=${targ_alias}aout
 			;;
+i[3456]86-*-solaris2*)	targ_emul=elf_i386 ;;
 i[3456]86-*-sysv4*)	targ_emul=elf_i386 ;;
 i[3456]86-*-unixware)	targ_emul=elf_i386 ;;
 i[3456]86-*-netbsd*)	targ_emul=i386nbsd ;;
--------- END: PATCH for GNU binutils on i386-pc-solaris2.x ----------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]