Bug 16546 - [4.0 Regression] [unit-at-a-time] Solaris 10/x86 libobjc bootstrap failure: invalid assembler code
: [4.0 Regression] [unit-at-a-time] Solaris 10/x86 libobjc bootstrap failure: i...
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: objc
: 4.0.0
: P2 critical
: 4.0.0
Assigned To: Andrew Pinski
:
: build, patch, wrong-code
:
:
  Show dependency treegraph
 
Reported: 2004-07-14 17:19 UTC by Rainer Orth
Modified: 2004-11-08 21:34 UTC (History)
2 users (show)

See Also:
Host:
Target: i386-pc-solaris2.10
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-09-28 03:01:05


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2004-07-14 17:19:26 UTC
Between 20040618 and 20040709, mainline bootstrap on i386-pc-solaris2.10
started to fail in libobjc:

$ /vol/gcc/obj/gcc-3.5.0-20040709/10-gcc/gcc/xgcc -B/vol/gcc/obj/gcc-3.5.0-20040709/10-gcc/gcc/ -B/vol/gcc/share/i386-pc-solaris2.10/bin/ -B/vol/gcc/share/i386-pc-solaris2.10/lib/ -isystem /vol/gcc/share/i386-pc-solaris2.10/include -isystem /vol/gcc/share/i386-pc-solaris2.10/sys-include -fgnu-runtime -c -I. -I/vol/gnu/src/gcc/gcc-dist/libobjc -O2 -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -DHAVE_GTHR_DEFAULT -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -I/vol/gnu/src/gcc/gcc-dist/libobjc/objc -I/vol/gnu/src/gcc/gcc-dist/libobjc/../gcc -I/vol/gnu/src/gcc/gcc-dist/libobjc/../gcc/config -I../../gcc -I/vol/gnu/src/gcc/gcc-dist/libobjc/../include /vol/gnu/src/gcc/gcc-dist/libobjc/NXConstStr.m  -fPIC -DPIC -o .libs/NXConstStr.o -v -save-temps
Reading specs from /vol/gcc/obj/gcc-3.5.0-20040709/10-gcc/gcc/specs
Configured with: /vol/gnu/src/gcc/gcc-dist/configure --prefix=/vol/gcc --with-local-prefix=/vol/gcc --disable-nls --disable-libmudflap
Thread model: posix
gcc version 3.5.0 20040709 (experimental)
 /vol/gcc/obj/gcc-3.5.0-20040709/10-gcc/gcc/cc1obj -E -quiet -v -I. -I/vol/gnu/src/gcc/gcc-dist/libobjc -I/vol/gnu/src/gcc/gcc-dist/libobjc/objc -I/vol/gnu/src/gcc/gcc-dist/libobjc/../gcc -I/vol/gnu/src/gcc/gcc-dist/libobjc/../gcc/config -I../../gcc -I/vol/gnu/src/gcc/gcc-dist/libobjc/../include -iprefix /amnt/figaro/volumes/obj-gcc/gcc/obj.sol86/gcc-3.5.0-20040709/10-gcc/gcc/../lib/gcc/i386-pc-solaris2.10/3.5.0/ -isystem /vol/gcc/obj/gcc-3.5.0-20040709/10-gcc/gcc/include -DHAVE_GTHR_DEFAULT -DIN_GCC -DIN_TARGET_LIBS -DPIC -isystem /vol/gcc/share/i386-pc-solaris2.10/include -isystem /vol/gcc/share/i386-pc-solaris2.10/sys-include /vol/gnu/src/gcc/gcc-dist/libobjc/NXConstStr.m -W -Wall -Wwrite-strings -Wstrict-prototypes -fgnu-runtime -fno-strict-aliasing -fPIC -fworking-directory -O2 -O2 -fpch-preprocess -o NXConstStr.mi
ignoring nonexistent directory "/vol/gcc/share/i386-pc-solaris2.10/include"
ignoring nonexistent directory "/vol/gcc/share/i386-pc-solaris2.10/sys-include"
ignoring nonexistent directory "/amnt/figaro/volumes/obj-gcc/gcc/obj.sol86/gcc-3.5.0-20040709/10-gcc/gcc/../lib/gcc/i386-pc-solaris2.10/3.5.0/include"
ignoring nonexistent directory "/vol/gcc/lib/gcc/i386-pc-solaris2.10/3.5.0/include"
ignoring nonexistent directory "/vol/gcc/share/i386-pc-solaris2.10/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /vol/gnu/src/gcc/gcc-dist/libobjc
 /vol/gnu/src/gcc/gcc-dist/libobjc/objc
 /vol/gnu/src/gcc/gcc-dist/libobjc/../gcc
 /vol/gnu/src/gcc/gcc-dist/libobjc/../gcc/config
 ../../gcc
 /vol/gnu/src/gcc/gcc-dist/libobjc/../include
 /vol/gcc/obj/gcc-3.5.0-20040709/10-gcc/gcc/include
 /vol/gcc/include
 /usr/include
End of search list.
 /vol/gcc/obj/gcc-3.5.0-20040709/10-gcc/gcc/cc1obj -fpreprocessed NXConstStr.mi -quiet -dumpbase NXConstStr.m -auxbase-strip .libs/NXConstStr.o -g -O2 -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -version -fgnu-runtime -fno-strict-aliasing -fPIC -o NXConstStr.s
GNU Objective-C version 3.5.0 20040709 (experimental) (i386-pc-solaris2.10)
	compiled by GNU C version 3.5.0 20040709 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
/vol/gnu/src/gcc/gcc-dist/libobjc/NXConstStr.m:42: warning: unused variable `_OBJC_INSTANCE_METHODS_NXConstantString'
/vol/gnu/src/gcc/gcc-dist/libobjc/NXConstStr.m:42: warning: unused variable `_OBJC_INSTANCE_VARIABLES_NXConstantString'
 /usr/ccs/bin/as -V -Qy -s -o .libs/NXConstStr.o NXConstStr.s
as: Sun Compiler Common 9.0 2004/02/05
Assembler: NXConstStr.m
	"NXConstStr.s", line 66 : .size argument has negative value
	"NXConstStr.s", line 96 : .size argument has negative value

The crucial difference between the assembler outputs (around line 66) is
like this:

        .type   _OBJC_INSTANCE_METHODS_NXConstantString, @object
-       .size   _OBJC_INSTANCE_METHODS_NXConstantString, 32
+       .size   _OBJC_INSTANCE_METHODS_NXConstantString, -1
 _OBJC_INSTANCE_METHODS_NXConstantString:

I haven't yet started looking for the culprit patch.

Environment:
System: SunOS sunfirev60x-01 5.10 s10_55 i86pc i386 i86pc
Architecture: i86pc

	
host: i386-pc-solaris2.10
build: i386-pc-solaris2.10
target: i386-pc-solaris2.10
configured with: /vol/gnu/src/gcc/gcc-dist/configure --prefix=/vol/gcc --with-local-prefix=/vol/gcc --disable-nls --disable-libmudflap

How-To-Repeat:
Bootstrap mainline as described above.
Comment 1 Andrew Pinski 2004-07-14 17:25:32 UTC
hmm, I think I know which patch, I will look at it later today as Zack (who I
think wrote the patch) is 
gone until later next week and I feel responsible for libobjc and for causing
the bootstrap failure as I 
had to do with the patch (I think it is one of the IMA patches).
Comment 2 Andrew Pinski 2004-07-15 04:48:14 UTC
Confirmed. hmm it works correctly at -O0 or -O2 -fno-unit-at-a-time
Comment 3 Rainer Orth 2004-07-15 19:52:14 UTC
Subject: Re:  [3.5 Regression] [unit-at-a-time] Solaris 10/x86 libobjc
bootstrap failure: invalid assembler code

pinskia at gcc dot gnu dot org writes:

> Confirmed. hmm it works correctly at -O0 or -O2 -fno-unit-at-a-time

Indeed: compiling the few affected files with -O2 -fno-unit-at-a-time let
the bootstrap finish.  Testsuite run in progress.

    Rainer
Comment 4 Andrew Pinski 2004-09-12 22:36:23 UTC
Do you know if this happens any more?
Comment 5 Rainer Orth 2004-09-13 09:39:54 UTC
Subject: Re:  [4.0 Regression] [unit-at-a-time] Solaris 10/x86 libobjc
bootstrap failure: invalid assembler code

pinskia at gcc dot gnu dot org writes:

> Do you know if this happens any more?

It does: I just tried mainline as of 20040910, and building libobjc failed
in the same way (but with the same workaround).  Unfortunately, I've got a
new failure linking libgcj.so, so the bootstrap doesn't complete even with
the workaround.

    Rainer
Comment 6 Andrew Pinski 2004-09-28 03:01:04 UTC
Reduced testcase:
@implementation NXConstantString
-(const char *) cString
{
  return 0;
}
@end
Comment 7 Andrew Pinski 2004-09-28 03:24:01 UTC
The type of the decl is wrong.
I think I have a fix, just needs testing with both NeXT runtime and GNU runtime.
Comment 8 Andrew Pinski 2004-09-28 03:30:50 UTC
Can you try this patch (I am testing it right now on powerpc-darwin for the
NeXT runtime), the code I 
am removing dates back before EGCS:
Index: objc-act.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.248
diff -u -p -r1.248 objc-act.c
--- objc-act.c    24 Sep 2004 23:15:33 -0000    1.248
+++ objc-act.c    28 Sep 2004 03:29:33 -0000
@@ -3754,9 +3754,6 @@ static void
 generate_method_descriptors (tree protocol)
 {
   tree initlist, chain, method_list_template;
-  tree variable_length_type
-    = xref_tag (RECORD_TYPE,
-        get_identifier (UTAG_METHOD_PROTOTYPE_LIST));
   int size;

   if (!objc_method_prototype_template)
@@ -3779,7 +3776,6 @@ generate_method_descriptors (tree protoc
     = generate_descriptor_table (method_list_template,
                      "_OBJC_PROTOCOL_CLASS_METHODS",
                      size, initlist, protocol);
-      TREE_TYPE (UOBJC_CLASS_METHODS_decl) = variable_length_type;
     }
   else
     UOBJC_CLASS_METHODS_decl = 0;
@@ -3800,7 +3796,6 @@ generate_method_descriptors (tree protoc
     = generate_descriptor_table (method_list_template,
                      "_OBJC_PROTOCOL_INSTANCE_METHODS",
                      size, initlist, protocol);
-      TREE_TYPE (UOBJC_INSTANCE_METHODS_decl) = variable_length_type;
     }
   else
     UOBJC_INSTANCE_METHODS_decl = 0;
@@ -4484,8 +4479,6 @@ static void
 generate_ivar_lists (void)
 {
   tree initlist, ivar_list_template, chain;
-  tree variable_length_type
-    = xref_tag (RECORD_TYPE, get_identifier (UTAG_IVAR_LIST));
   int size;

   generating_instance_variables = 1;
@@ -4507,7 +4500,6 @@ generate_ivar_lists (void)
       UOBJC_CLASS_VARIABLES_decl
     = generate_ivars_list (ivar_list_template, "_OBJC_CLASS_VARIABLES",
                    size, initlist);
-      TREE_TYPE (UOBJC_CLASS_VARIABLES_decl) = variable_length_type;
     }
   else
     UOBJC_CLASS_VARIABLES_decl = 0;
@@ -4522,7 +4514,6 @@ generate_ivar_lists (void)
       UOBJC_INSTANCE_VARIABLES_decl
     = generate_ivars_list (ivar_list_template, "_OBJC_INSTANCE_VARIABLES",
                    size, initlist);
-      TREE_TYPE (UOBJC_INSTANCE_VARIABLES_decl) = variable_length_type;
     }
   else
     UOBJC_INSTANCE_VARIABLES_decl = 0;
@@ -4654,8 +4645,6 @@ static void
 generate_dispatch_tables (void)
 {
   tree initlist, chain, method_list_template;
-  tree variable_length_type
-    = xref_tag (RECORD_TYPE, get_identifier (UTAG_METHOD_LIST));
   int size;

   if (!objc_method_template)
@@ -4678,7 +4667,6 @@ generate_dispatch_tables (void)
                     ? "_OBJC_CLASS_METHODS"
                     : "_OBJC_CATEGORY_CLASS_METHODS"),
                    size, initlist);
-      TREE_TYPE (UOBJC_CLASS_METHODS_decl) = variable_length_type;
     }
   else
     UOBJC_CLASS_METHODS_decl = 0;
@@ -4704,7 +4692,6 @@ generate_dispatch_tables (void)
       = generate_dispatch_table (method_list_template,
                      "_OBJC_CATEGORY_INSTANCE_METHODS",
                      size, initlist);
-      TREE_TYPE (UOBJC_INSTANCE_METHODS_decl) = variable_length_type;
     }
   else
     UOBJC_INSTANCE_METHODS_decl = 0;
Comment 9 Andrew Pinski 2004-09-28 23:18:05 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02909.html>.
Comment 10 Rainer Orth 2004-10-01 19:45:35 UTC
Subject: Re:  [4.0 Regression] [unit-at-a-time] Solaris 10/x86 libobjc
bootstrap failure: invalid assembler code

pinskia at gcc dot gnu dot org writes:

> Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02909.html>.

I've just verified that current mainline still fails to build objc without
this patch, but the bootstrap succeeds with it, and i386-pc-solaris2.10
objc test results are good:

                === objc Summary ===

# of expected passes            1421
# of unsupported tests          7

Thanks.
    Rainer
Comment 11 Rainer Orth 2004-10-28 16:16:45 UTC
Subject: Re:  [4.0 Regression] [unit-at-a-time] Solaris 10/x86 libobjc
bootstrap failure: invalid assembler code

Unfortunately the patch has remained unreviewed for a month now and the
bootstrap failure exists for almost two months ;-(

    Rainer
Comment 12 Andrew Pinski 2004-11-08 21:34:53 UTC
Fixed finnally.
Comment 13 CVS Commits 2004-11-08 21:34:54 UTC
Subject: Bug 16546

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2004-11-08 21:34:38

Modified files:
	gcc/objc       : ChangeLog objc-act.c 

Log message:
	2004-11-08  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR objc/16546
	* objc-act.c (generate_method_descriptors): Remove setting
	the new decls' type to variable_length_type.
	(generate_ivar_lists): Likewise.
	(generate_dispatch_tables): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/ChangeLog.diff?cvsroot=gcc&r1=1.16&r2=1.17
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/objc-act.c.diff?cvsroot=gcc&r1=1.253&r2=1.254