This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.4 PATCH: Fix Solaris/x86 bootstrap failure (-Werror fallout)
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 4 Nov 2003 21:20:36 +0100 (MET)
- Subject: 3.4 PATCH: Fix Solaris/x86 bootstrap failure (-Werror fallout)
The libgcc etc. -Werror patch caused Solaris/x86 bootstrap to fail. Even
with the patch now reverted, it seems useful to fix the problems found:
* I had to add -Wno-error to CRTSTUFF_T_CFLAGS to avoid this error:
/vol/gnu/src/gcc/gcc/gcc/libgcc2.c: In function `__enable_execute_stack':
/vol/gnu/src/gcc/gcc/gcc/libgcc2.c:1607: warning: implicit declaration of function `mprotect'
make[3]: *** [libgcc/./_trampoline.o] Error 1
(same as on Solaris/SPARC). Initially, this didn't work until I noticed
that for unknown reasons, t-svr4 was listed in tmake_files *after*
i386/t-sol2. It should certainly be the other way round to allow the
Solaris/x86 fragment to override the t-svr4 defaults.
* i386/gmon-sol2.c has several obvious errors. The patch below fixes them
for now, but the obvious course of action is to merge the sparc and i386
versions of gmon-sol2.c. I'll try this once I get to it.
Bootstrapped without regressions on i386-pc-solaris2.9.
Ok for mainline?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Tue Nov 4 21:04:58 2003 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config.gcc (i[34567]86-*-solaris2*): Let i386/t-sol2 override
t-svr4.
* config/i386/t-sol2 (TARGET_LIBGCC2_CFLAGS): Add -Wno-error.
* config/i386/gmon-sol2.c (sccsid): Disable, unused.
Include various headers for declarations of system functions.
(monstartup, _mcleanup, internal_mcount, moncontrol): Declare.
Change definitions to ISO C90 form.
(_mcleanup): Comment text after #endif.
(internal_mcount): Provide full etext prototype.
Cast monstartup args.
Index: gcc/config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.405
diff -u -p -r1.405 config.gcc
--- gcc/config.gcc 23 Oct 2003 05:16:52 -0000 1.405
+++ gcc/config.gcc 4 Nov 2003 20:13:52 -0000
@@ -1034,7 +1034,7 @@ i[34567]86-*-sco3.2v5*) # 80386 running
i[34567]86-*-solaris2*)
xm_defines="SMALL_ARG_MAX"
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h i386/sysv4.h sol2.h i386/sol2.h"
- tmake_file="i386/t-sol2 t-svr4"
+ tmake_file="t-svr4 i386/t-sol2"
if test x$gnu_ld = xyes; then
tmake_file="$tmake_file t-slibgcc-elf-ver"
else
Index: gcc/config/i386/gmon-sol2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/gmon-sol2.c,v
retrieving revision 1.3
diff -u -p -r1.3 gmon-sol2.c
--- gcc/config/i386/gmon-sol2.c 22 Nov 1999 18:40:19 -0000 1.3
+++ gcc/config/i386/gmon-sol2.c 4 Nov 2003 20:14:10 -0000
@@ -54,14 +54,16 @@
* should be.
*/
-#ifndef lint
+#if 0
static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91";
#endif /* not lint */
-#if 0
-#include <unistd.h>
+#include "tconfig.h"
+#include "tsystem.h"
+#include <fcntl.h>
+#include "coretypes.h"
+#include "tm.h"
-#endif
#ifdef DEBUG
#include <stdio.h>
#endif
@@ -105,6 +107,11 @@ struct rawarc {
extern char *sbrk ();
#endif
+void monstartup (char *, char *);
+void _mcleanup (void);
+void internal_mcount (void);
+void moncontrol (int);
+
/*
* froms is actually a bunch of unsigned shorts indexing tos
*/
@@ -126,9 +133,8 @@ static int s_scale;
extern int errno;
-monstartup(lowpc, highpc)
- char *lowpc;
- char *highpc;
+void
+monstartup(char *lowpc, char *highpc)
{
int monsize;
char *buffer;
@@ -203,7 +209,8 @@ monstartup(lowpc, highpc)
moncontrol(1);
}
-_mcleanup()
+void
+_mcleanup(void)
{
int fd;
int fromindex;
@@ -220,7 +227,7 @@ _mcleanup()
}
# ifdef DEBUG
fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
-# endif DEBUG
+# endif /* DEBUG */
write( fd , sbuf , ssiz );
endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
@@ -234,7 +241,7 @@ _mcleanup()
fprintf( stderr ,
"[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
frompc , tos[toindex].selfpc , tos[toindex].count );
-# endif DEBUG
+# endif /* DEBUG */
rawarc.raw_frompc = (unsigned long) frompc;
rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
rawarc.raw_count = tos[toindex].count;
@@ -249,7 +256,8 @@ asm(".globl _mcount; _mcount: jmp intern
/* This is for compatibility with old versions of gcc which used mcount. */
asm(".globl mcount; mcount: jmp internal_mcount");
-internal_mcount()
+void
+internal_mcount(void)
{
register char *selfpc;
register unsigned short *frompcindex;
@@ -271,10 +279,10 @@ internal_mcount()
frompcindex = (void *) __builtin_return_address (1);
if(!already_setup) {
- extern etext();
+ extern void etext(void);
already_setup = 1;
/* monstartup(0, etext); */
- monstartup(0x08040000, etext);
+ monstartup((char *)0x08040000, (char *)etext);
#ifdef USE_ONEXIT
on_exit(_mcleanup, 0);
#else
@@ -387,8 +395,8 @@ overflow:
* profiling is what mcount checks to see if
* all the data structures are ready.
*/
-moncontrol(mode)
- int mode;
+void
+moncontrol(int mode)
{
if (mode)
{
Index: gcc/config/i386/t-sol2
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/t-sol2,v
retrieving revision 1.5
diff -u -p -r1.5 t-sol2
--- gcc/config/i386/t-sol2 17 May 2001 03:15:56 -0000 1.5
+++ gcc/config/i386/t-sol2 4 Nov 2003 20:14:10 -0000
@@ -31,4 +31,4 @@ crtn.o: $(srcdir)/config/i386/sol2-cn.as
# .text section.
CRTSTUFF_T_CFLAGS = -fPIC -O2
-TARGET_LIBGCC2_CFLAGS = -fPIC
+TARGET_LIBGCC2_CFLAGS = -fPIC -Wno-error