--- config/i386/freebsd.h.orig Sun Oct 19 09:31:05 1997 +++ config/i386/freebsd.h Tue Aug 11 14:28:56 1998 @@ -35,10 +35,21 @@ #include "i386/perform.h" #undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__ -D__386BSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)" +#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__=2 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)" + +/* FreeBSD using a.out does not support DWARF2 unwinding mechanisms. + Thus, need the equivalent of "-fsjlj-exceptions" (use setjmp/longjmp + for exceptions). */ +#define DWARF2_UNWIND_INFO 0 + +/* Provide a CPP_SPEC appropriate for OpenBSD. Current we just deal with + the GCC option `-posix'. */ + +#undef CPP_SPEC +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}" /* Like the default, except no -lg. */ -#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" +#define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}" #undef SIZE_TYPE #define SIZE_TYPE "unsigned int" @@ -54,8 +65,13 @@ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 16 +/* We have atexit(3). */ #define HAVE_ATEXIT +/* We want gcc.c to call mktemp() for each file it generates. We would + prefer mkstemp(), but we will take what we get. XXX busted */ +/* #undef MKTEMP_EACH_FILE */ + #undef ASM_APP_ON #define ASM_APP_ON "#APP\n" @@ -114,6 +130,7 @@ #define TYPE_ASM_OP ".type" #define SIZE_ASM_OP ".size" +#define SET_ASM_OP ".set" /* The following macro defines the format used to output the second operand of the .type assembler directive. Different svr4 assemblers @@ -123,6 +140,16 @@ #define TYPE_OPERAND_FMT "@%s" +/* Handle #pragma weak and #pragma pack. */ + +#define HANDLE_SYSV_PRAGMA 1 + +/* This is how we tell the assembler that a symbol is weak. */ + +#define ASM_WEAKEN_LABEL(FILE,NAME) \ + do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ + fputc ('\n', FILE); } while (0) + /* Write the extra assembler code needed to declare a function's result. Most svr4 assemblers don't require any special declaration of the result value, but there are exceptions. */ @@ -131,9 +158,9 @@ #define ASM_DECLARE_RESULT(FILE, RESULT) #endif -/* These macros generate the special .type and .size directives which +/* these macros generate the special .type and .size directives which are used to set the corresponding fields of the linker symbol table - entries in an ELF object file under SVR4. These macros also output + entries in an elf object file under svr4. these macros also output the starting labels for the relevant functions/objects. */ /* Write the extra assembler code needed to declare a function properly. @@ -185,6 +212,7 @@ && DECL_INITIAL (DECL) == error_mark_node \ && !size_directive_output) \ { \ + size_directive_output = 1; \ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ assemble_name (FILE, name); \ fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ @@ -213,33 +241,57 @@ } \ } while (0) +/* XXX - should ASM_SPEC be " %| %{fpic:-k} %{fPIC:-k -K}" ??? */ #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}" + #define LINK_SPEC \ - "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}" + "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \ + %{shared:-Bshareable} \ + %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \ + %{pg:-Bstatic} %{Z}} \ + %{assert*} %{R*}" + +#ifdef FROM_OPENBSD +/* This defines which switch letters take arguments. + make -R /path/to/lib work the same as -R/path/to/lib */ +#undef SWITCH_TAKES_ARG +#define SWITCH_TAKES_ARG(CHAR) \ + (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ + || (CHAR) == 'R') +#endif + +#define STARTFILE_SPEC \ + "%{shared:c++rt0.o%s} \ + %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}" -/* This is defined when gcc is compiled in the BSD-directory-tree, and must - * make up for the gap to all the stuff done in the GNU-makefiles. +#define MD_STARTFILE_PREFIX "/usr/lib/aout/" + +/* FREEBSD_NATIVE is defined when gcc is compiled in the BSD-directory-tree, + * and must make up for the gap to all the stuff done in the GNU-makefiles. */ #ifdef FREEBSD_NATIVE -#define INCLUDE_DEFAULTS { \ - { "/usr/include", 0, 0, 0 }, \ - { "/usr/include/g++", "G++", 1, 1 }, \ - { 0, 0, 0, 0} \ - } +#undef GCC_INCLUDE_DIR +#define GCC_INCLUDE_DIR "/usr/include" + +#undef GPLUSPLUS_INCLUDE_DIR +#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" + +/* Look for the include files in the system-defined places. */ + +#undef INCLUDE_DEFAULTS +#define INCLUDE_DEFAULTS \ + { \ + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ + { GCC_INCLUDE_DIR, 0, 0, 0 }, \ + { 0, 0, 0, 0 } \ + } #undef MD_EXEC_PREFIX #define MD_EXEC_PREFIX "/usr/libexec/" #undef STANDARD_STARTFILE_PREFIX #define STANDARD_STARTFILE_PREFIX "/usr/lib" - -#if 0 /* This is very wrong!!! */ -#define DEFAULT_TARGET_MACHINE "i386-unknown-freebsd_1.0" -#define GPLUSPLUS_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include" -#define TOOL_INCLUDE_DIR "/usr/local/i386-unknown-freebsd_1.0/include" -#define GCC_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include" -#endif #endif /* FREEBSD_NATIVE */ --- configure.orig Sat Feb 28 18:02:02 1998 +++ configure Tue Aug 11 13:51:17 1998 @@ -677,9 +677,9 @@ if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +ac_config_guess="/bin/sh $ac_aux_dir/config.guess" +ac_config_sub="/bin/sh $ac_aux_dir/config.sub" +ac_configure="/bin/sh $ac_aux_dir/configure" # This should be Cygnus configure. # Do some error checking and defaulting for the host and target type. @@ -2797,6 +2797,20 @@ a29k-*-*) # Default a29k environment. use_collect2=yes ;; + alpha*-*-freebsd*) + tm_file=alpha/freebsd.h + # On FreeBSD, the headers are already ok, except for math.h. (??right??) + fixincludes=fixinc.math + fixincludes=fixinc.math + tmake_file=t-libc-ok + ;; + alpha-*-openbsd*) + tm_file=alpha/openbsd.h + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + tmake_file=t-libc-ok + xmake_file=x-openbsd + ;; alpha*-*-linux-gnuecoff*) tm_file="${tm_file} alpha/linux.h" xm_file="${xm_file} alpha/xm-linux.h" @@ -3158,6 +3172,14 @@ use_collect2=yes fixincludes=Makefile.in ;; + hppa*-*-openbsd*) + target_cpu_default=1 + tm_file="pa/pa-openbsd.h" + xm_file=pa/xm-openbsd.h + xmake_file=x-openbsd + use_collect2=yes + fixincludes=Makefile.in + ;; i370-*-mvs*) ;; i[34567]86-ibm-aix*) # IBM PS/2 running AIX @@ -3277,6 +3299,13 @@ fixincludes=fixinc.math tmake_file=t-netbsd ;; + i[34567]86-*-openbsd*) + tm_file=i386/openbsd.h + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + tmake_file=t-libc-ok + xmake_file=x-openbsd + ;; i[34567]86-*-coff*) tm_file=i386/i386-coff.h tmake_file=i386/t-i386bare @@ -3964,6 +3993,13 @@ fixincludes=fixinc.math tmake_file=t-netbsd ;; + m68k-*-openbsd*) + tm_file=m68k/openbsd.h + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + tmake_file=t-libc-ok + xmake_file=x-openbsd + ;; m68k-*-sysv3*) # Motorola m68k's running system V.3 xm_file=m68k/xm-m68kv.h xmake_file=m68k/x-m68kv @@ -4273,6 +4309,20 @@ prefix=$native_prefix fi ;; + mips*el-*-openbsd*) # MIPS running OpenBSD + tm_file=mips/openbsd-le.h + xmake_file=x-openbsd + tmake_file=t-libc-ok + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + ;; + mips*-*-openbsd*) # MIPS big-endian running OpenBSD + tm_file=mips/openbsd-be.h + xmake_file=x-openbsd + tmake_file=t-libc-ok + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + ;; mips-sony-bsd* | mips-sony-newsos*) # Sony NEWS 3600 or risc/news. tm_file=mips/news4.h if [ x$stabs = xyes ]; then @@ -4612,6 +4662,13 @@ fixincludes=fixinc.math tmake_file=t-netbsd ;; + ns32k-*-openbsd*) + tm_file=ns32k/openbsd.h + tmake_file=t-libc-ok + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + xmake_file=x-openbsd + ;; pdp11-*-bsd) tm_file="${tm_file} pdp11/2bsd.h" ;; @@ -4625,10 +4682,23 @@ romp-*-aos*) use_collect2=yes ;; + romp-*-openbsd*) + tm_file=romp/openbsd.h + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + xmake_file=romp/x-openbsd + ;; romp-*-mach*) xmake_file=romp/x-mach use_collect2=yes ;; + powerpc-*-*bsd*) + tm_file=rs6000/openbsd.h + tmake_file=rs6000/t-openbsd + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + xmake_file=rs6000/x-openbsd + ;; powerpc-*-sysv* | powerpc-*-elf*) tm_file=rs6000/sysv4.h xm_file=rs6000/xm-sysv4.h @@ -4841,6 +4911,13 @@ fixincludes=fixinc.math tmake_file=t-netbsd ;; + sparc-*-openbsd*) + tm_file=sparc/openbsd.h + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + tmake_file=t-libc-ok + xmake_file=x-openbsd + ;; sparc-*-bsd*) tm_file=sparc/bsd.h ;; @@ -5009,6 +5086,14 @@ # On NetBSD, the headers are already okay, except for math.h. fixincludes=fixinc.math tmake_file=t-netbsd + float_format=vax + ;; + vax-*-openbsd*) + tm_file=vax/openbsd.h + tmake_file="t-libc-ok vax/t-openbsd" + # On OpenBSD, the headers are already okay. + fixincludes=Makefile.in + xmake_file=x-openbsd float_format=vax ;; vax-*-ultrix*) # vaxen running ultrix --- choose-temp.c.orig Thu Dec 4 06:17:56 1997 +++ choose-temp.c Tue Aug 11 04:05:05 1998 @@ -107,12 +107,17 @@ base = try (getenv ("TMP"), base); base = try (getenv ("TEMP"), base); +#ifdef COMMENT_OUT /* XXX - P_tmpdir is not /tmp in 4.4BSD */ #ifdef P_tmpdir base = try (P_tmpdir, base); #endif +#endif /* XXX */ /* Try /usr/tmp, then /tmp. */ +#ifdef COMMENT_OUT /* XXX - want /tmp used, peroid. Sometimes pkg_add can + create a /usr/tmp, so beware. */ base = try (usrtmp, base); +#endif /* XXX */ base = try (tmp, base); /* If all else fails, use the current directory! */ --- flags.h.orig Wed Dec 31 05:02:33 1997 +++ flags.h Tue Aug 11 13:31:22 1998 @@ -216,6 +216,20 @@ extern int flag_unroll_all_loops; +/* Nonzero forces all invariant computations in loops to be moved + outside the loop. */ + +extern int flag_move_all_movables; + +/* Nonzero forces all general induction variables in loops to be + strength reduced. */ + +extern int flag_reduce_all_givs; + +/* Nonzero gets another run of loop_optimize performed. */ + +extern int flag_rerun_loop_opt; + /* Nonzero for -fcse-follow-jumps: have cse follow jumps to do a more extensive job. */ --- toplev.c.orig Wed Feb 25 18:04:46 1998 +++ toplev.c Tue Aug 11 14:40:22 1998 @@ -463,6 +463,20 @@ int flag_unroll_all_loops; +/* Nonzero forces all invariant computations in loops to be moved + outside the loop. */ + +int flag_move_all_movables = 0; + +/* Nonzero forces all general induction variables in loops to be + strength reduced. */ + +int flag_reduce_all_givs = 0; + +/* Nonzero gets another run of loop_optimize performed. */ + +int flag_rerun_loop_opt = 0; + /* Nonzero for -fwritable-strings: store string constants in data segment and don't uniquize them. */ --- loop.c.orig Fri Feb 6 11:23:34 1998 +++ loop.c Tue Aug 11 16:57:35 1998 @@ -1637,6 +1637,7 @@ extra cost because something else was already moved. */ if (already_moved[regno] + || flag_move_all_movables || (threshold * savings * m->lifetime) >= insn_count || (m->forces && m->forces->done && n_times_used[m->forces->regno] == 1)) @@ -3911,7 +3912,7 @@ of such giv's whether or not we know they are used after the loop exit. */ - if (v->lifetime * threshold * benefit < insn_count + if (!flag_reduce_all_givs && v->lifetime * threshold * benefit < insn_count && ! bl->reversed) { if (loop_dump_stream) --- cp/lex.c.orig Wed Nov 26 12:13:20 1997 +++ cp/lex.c Tue Aug 11 13:37:17 1998 @@ -3329,6 +3329,14 @@ token_buffer[0] = '^'; token_buffer[1] = 0; } + else if (ptr->token == NAMESPACE) + { + static int warned; + if (! warned) + warning ("namespaces are mostly broken in this version of g++"); + + warned = 1; + } value = (int) ptr->token; } --- gcc.1.orig Tue Feb 17 10:44:00 1998 +++ gcc.1 Tue Aug 11 13:30:01 1998 @@ -182,7 +182,7 @@ \-Waggregate\-return \-Wcast\-align \-Wcast\-qual -\-Wchar\-subscript +\-Wchar\-subscripts \-Wcomment \-Wconversion \-Wenum\-clash --- invoke.texi.orig Tue Feb 17 10:54:05 1998 +++ invoke.texi Tue Aug 11 13:29:38 1998 @@ -115,7 +115,7 @@ @smallexample -fsyntax-only -pedantic -pedantic-errors -w -W -Wall -Waggregate-return -Wbad-function-cast --Wcast-align -Wcast-qual -Wchar-subscript -Wcomment +-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Werror -Wformat -Wid-clash-@var{len} -Wimplicit -Wimplicit-int -Wimplicit-function-declarations -Wimport -Winline @@ -153,6 +153,7 @@ -frerun-cse-after-loop -fschedule-insns -fschedule-insns2 -fstrength-reduce -fthread-jumps -funroll-all-loops -funroll-loops +-fmove-all-movables -freduce-all-givs -frerun-loop-opt -O -O0 -O1 -O2 -O3 @end smallexample @@ -2284,6 +2285,47 @@ Perform the optimization of loop unrolling. This is done for all loops and usually makes programs run more slowly. @samp{-funroll-all-loops} implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}. + +@item -fmove-all-movables +Forces all invariant computations in loops to be moved +outside the loop. +This option is provided primarily to improve performance +for some Fortran code, though it might improve code written +in other languages. + +@emph{Note:} When compiling programs written in Fortran, +this option is enabled by default. + +Analysis of Fortran code optimization and the resulting +optimizations triggered by this option, and the +@samp{-freduce-all-givs} and @samp{-frerun-loop-opt} +options as well, were +contributed by Toon Moene (@code{toon@@moene.indiv.nluug.nl}). + +Please let us (@code{fortran@@gnu.ai.mit.edu}) +know how use of these options affects +the performance of your production code. +We're very interested in code that runs @emph{slower} +when these options are @emph{enabled}. + +@item -freduce-all-givs +Forces all general-induction variables in loops to be +strength-reduced. +This option is provided primarily to improve performance +for some Fortran code, though it might improve code written +in other languages. + +@emph{Note:} When compiling programs written in Fortran, +this option is enabled by default. + +@item -frerun-loop-opt +Runs loop optimizations a second time. +This option is provided primarily to improve performance +for some Fortran code, though it might improve code written +in other languages. + +@emph{Note:} When compiling programs written in Fortran, +this option is enabled by default. @item -fno-peephole Disable any machine-specific peephole optimizations. --- config/alpha/alpha.c.orig Fri Feb 6 17:23:50 1998 +++ config/alpha/alpha.c Tue Aug 11 04:06:42 1998 @@ -1843,7 +1843,7 @@ /* Write a version stamp. Don't write anything if we are running as a cross-compiler. Otherwise, use the versions in /usr/include/stamp.h. */ -#if !defined(CROSS_COMPILE) && !defined(_WIN32) && !defined(__linux__) && !defined(VMS) +#if !defined(CROSS_COMPILE) && !defined(_WIN32) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__linux__) && !defined(VMS) #include #endif --- ginclude/stdarg.h.orig Sat Oct 18 10:26:07 1997 +++ ginclude/stdarg.h Tue Aug 11 13:27:03 1998 @@ -64,7 +64,7 @@ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST -#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) +#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) || defined(__OpenBSD__) typedef char *__gnuc_va_list; #else typedef void *__gnuc_va_list; --- ginclude/stddef.h.orig Mon Oct 28 04:35:28 1996 +++ ginclude/stddef.h Tue Aug 11 13:26:05 1998 @@ -24,7 +24,7 @@ /* On 4.3bsd-net2, make sure ansi.h is included, so we have one less case to deal with in the following. */ -#if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__) +#if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__) || defined (__OpenBSD__) #include #endif