Subject: One more gcc patch

From: Ralf Baechle <[email-masked]>
Date: Fri, 8 Sep 2000 20:58:11 +0200

Ooops, this fixes a bug in the previous patch for gcc-current.  So this
patch does:

 - fix constructors which were not run for shared libs
 - fix warnings when building the compiler itself
 - Keith's gcse patch
 - gcc was generating code which was calling __main from the beginning of
   main which is wrong for Linux

  Ralf

diff -urN gcc-cygnus/gcc/config/mips/linux.h gcc/gcc/config/mips/linux.h
--- gcc-cygnus/gcc/config/mips/linux.h	Tue Aug 29 02:46:28 2000
+++ gcc/gcc/config/mips/linux.h	Sat Sep  9 17:06:28 2000
@@ -170,3 +170,20 @@
 %{mabi=64: -64} \
 %{!fno-PIC:%{!fno-pic:-KPIC}} \
 %{fno-PIC:-non_shared} %{fno-pic:-non_shared}"
+
+/* On svr4, we *do* have support for the .init and .fini sections, and we
+   can put stuff in there to be executed before and after `main'.  We let
+   crtstuff.c and other files know this by defining the following symbols.
+   The definitions say how to change sections to the .init and .fini
+   sections.  This is the same for all known svr4 assemblers.  */
+
+#define INIT_SECTION_ASM_OP     "\t.section\t.init"
+#define FINI_SECTION_ASM_OP     "\t.section\t.fini"
+
+/* Undef junk imported from mips/elf.h.  */
+#undef CTOR_LIST_BEGIN
+#undef CTOR_LIST_END
+#undef DTOR_LIST_BEGIN
+#undef DTOR_LIST_END
+
+#undef INVOKE__main
diff -urN gcc-cygnus/gcc/config/mips/mips.h gcc/gcc/config/mips/mips.h
--- gcc-cygnus/gcc/config/mips/mips.h	Tue Aug 29 02:46:28 2000
+++ gcc/gcc/config/mips/mips.h	Sat Sep  9 16:07:28 2000
@@ -1900,7 +1900,7 @@
 
 extern enum reg_class mips_char_to_class[];
 
-#define REG_CLASS_FROM_LETTER(C) mips_char_to_class[ (C) ]
+#define REG_CLASS_FROM_LETTER(C) mips_char_to_class[ (int) (C) ]
 
 /* The letters I, J, K, L, M, N, O, and P in a register constraint
    string can be used to stand for particular ranges of immediate
diff -urN gcc-cygnus/gcc/gcse.c gcc/gcc/gcse.c
--- gcc-cygnus/gcc/gcse.c	Mon Sep  4 03:00:56 2000
+++ gcc/gcc/gcse.c	Fri Sep  8 12:37:18 2000
@@ -1924,7 +1924,9 @@
 	  /* Don't GCSE something if we can't do a reg/reg copy.  */
 	  && can_copy_p [GET_MODE (dest)]
 	  /* Is SET_SRC something we want to gcse?  */
-	  && want_to_gcse_p (src))
+	  && want_to_gcse_p (src)
+	  /* Copy between modes is prohibited */
+	  && GET_MODE (src) == GET_MODE (dest))
 	{
 	  /* An expression is not anticipatable if its operands are
 	     modified before this insn.  */

---

From: Andreas Jaeger <[email-masked]>
Date: 12 Sep 2000 18:14:07 +0200

>>>>> Ralf Baechle writes:

 >    main which is wrong for Linux

Did you run the testsuite?

It doesn't seem to fix C++:

                === libstdc++ Summary ===

# of expected passes            9
# of unexpected failures        10
# of expected failures          11

The number for g++ are even worse, I stopped the check

Any idea how to get C++ working?

Andreas
-- 
 Andreas Jaeger
  SuSE Labs [email-masked]
   private [email-masked]
    http://www.suse.de/~aj

---

From: Ralf Baechle <[email-masked]>
Date: Wed, 13 Sep 2000 01:08:46 +0200

> Did you run the testsuite?

No; I tried rebuilding a large number of RH 6.2 packages.  A few of them
are broken in ways that make me suspect the compiler is broken.  Might
also be binutils; I did upgrade both in one step.

> Any idea how to get C++ working?

Debugging?

I think historically nobody did ever invest time into getting the libg++
to work so we somewhen have to pay that price ...

  Ralf