This is the tcl-scripts which will convert gcc-2.6.0 to bmake form,

a patch to gcc from Bruce, and to libg++ by me.  I will check in the
actual compiler when Jordan has put in the rest of src/gnu.
This commit is contained in:
Poul-Henning Kamp 1994-08-02 05:22:24 +00:00
parent b53902964f
commit 94e6204340
5 changed files with 1049 additions and 0 deletions

32
gnu/gnu2bmake/README Normal file
View File

@ -0,0 +1,32 @@
This directory contains tools to convert GNU-distributions into bmake-able
trees to be included in the FreeBSD distribution.
The tools are written in Tcl, so you need to install that first.
If there is a patch-file, you should apply that to the distribution first.
You should read the tcl-script first, at least the beginning, to see if there
are any special instructions.
We try to get these patches rolled back into the GNU-distributions, to avoid
code-drift. Please consider very carefully before doing something which isn't
general enough to make it back into the GNU-dist.
If you want to create a new script, here are some hints:
Get as much info as you can from the Makefiles macros.
Use this sequence to test:
make all
make clean ; make all
make cleandir ; make depend ; make all ; make install
make cleandir ; make obj ; make depend ; make all ; make install
make cleandir
Remember to install man-pages (and .texi files ?)
Thanks to Bruce for the patches to gcc, he knows a LOT more about gcc
than I do...
Poul-Henning Kamp
phk@login.dkuug.dk

237
gnu/gnu2bmake/gcc-2.6.0.tcl Normal file
View File

@ -0,0 +1,237 @@
#!/usr/local/bin/tclsh
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
# ----------------------------------------------------------------------------
#
# $FreeBSD$
#
source gnu2bmake.tcl
#######################################################################
# Parameters to tweak
########
set sdir /u7/gcc-2.6.0
set ddir /usr/src/gnu/usr.bin/cc26
#######################################################################
# Do the stunt
########
sh "cd $sdir ; sh configure"
# .h files on their way to ~/include
set l_include {config tm pcp tree input c-lex c-tree flags machmode real
rtl c-parse c-gperf function defaults convert obstack insn-attr
bytecode bc-emit insn-flags expr insn-codes regs hard-reg-set
insn-config loop recog bc-typecd bc-opcode bc-optab typeclass
output basic-block reload integrate conditions bytetypes bi-run
bc-arity multilib stack}
# other files on their way to ~/include
set l_include_x {tree.def machmode.def rtl.def modemap.def bc-typecd.def}
# .h files going into ~/include/i386
set l_include_i386 {perform gstabs gas bsd i386 unix }
# .c source for cpp
set l_cpp {cccp cexp version}
# .c source for cc1
set l_cc1 [zap_suffix [makefile_macro C_OBJS $sdir]]
append l_cc1 " " [zap_suffix [makefile_macro OBJS $sdir]]
append l_cc1 " " [zap_suffix [makefile_macro BC_OBJS $sdir]]
# .c source for cc
set l_cc {gcc version}
append l_cc " " [zap_suffix [makefile_macro OBSTACK $sdir]]
# .c source for c++
set l_cplus [zap_suffix [makefile_macro OBSTACK $sdir]]
# .c source for c++ from "cp" subdir
set l_cplus_cp {g++}
# .c source for cc1plus
set l_cc1plus {c-common}
append l_cc1plus " " [zap_suffix [makefile_macro OBJS $sdir]]
append l_cc1plus " " [zap_suffix [makefile_macro BC_OBJS $sdir]]
# .c source for cc1plus from "cp" subdir
set l_cc1plus_cp {}
append l_cc1plus_cp " " [zap_suffix [makefile_macro CXX_OBJS $sdir/cp]]
# .h file for cc1plus from "cp" subdir
set l_cc1plus_h {lex parse cp-tree decl class hash}
# other file for cc1plus from "cp" subdir
set l_cc1plus_x {tree.def input.c}
# All files used more than once go into the lib.
set l_common [common_set $l_cpp $l_cc1 $l_cc $l_cc1plus $l_cplus]
set l_cpp [reduce_by $l_cpp $l_common]
set l_cc1 [reduce_by $l_cc1 $l_common]
set l_cc [reduce_by $l_cc $l_common]
set l_cplus [reduce_by $l_cplus $l_common]
set l_cc1plus [reduce_by $l_cc1plus $l_common]
# functions in libgcc1
set l_libgcc1 [makefile_macro LIB1FUNCS $sdir]
# functions in libgcc2
set l_libgcc2 [makefile_macro LIB2FUNCS $sdir]
# .c files in libgcc
set l_libgcc {libgcc1.c libgcc2.c}
# .h files in libgcc
set l_libgcc_h {tconfig longlong glimits gbl-ctors}
set version [makefile_macro version $sdir]
set target [makefile_macro target $sdir]
# do ~
sh "rm -rf $ddir"
sh "mkdir $ddir"
set f [open $ddir/Makefile.inc w]
puts $f "#\n# \$FreeBSD\$\n#\n"
puts $f "CFLAGS+=\t-I\${.CURDIR} -I\${.CURDIR}/../include"
puts $f "CFLAGS+=\t-DGCC_INCLUDE_DIR=\\\"FOO\\\""
puts $f "CFLAGS+=\t-DDEFAULT_TARGET_VERSION=\\\"$version\\\""
puts $f "CFLAGS+=\t-DDEFAULT_TARGET_MACHINE=\\\"$target\\\""
puts $f "CFLAGS+=\t-DMD_EXEC_PREFIX=\\\"/usr/libexec/\\\""
puts $f "CFLAGS+=\t-DSTANDARD_STARTFILE_PREFIX=\\\"/usr/lib\\\""
close $f
set f [open $ddir/Makefile w]
puts $f "#\n# \$FreeBSD\$\n#\n"
puts $f "PGMDIR=\tcc_int cpp cc1 cc cc1plus c++ libgcc"
puts $f "SUBDIR=\t\$(PGMDIR)"
puts $f "\n.include <bsd.subdir.mk>"
close $f
# do ~/libgcc
sh "mkdir $ddir/libgcc"
set f [open $ddir/libgcc/Makefile w]
puts $f "#\n# \$FreeBSD\$\n#\n"
puts $f "LIB=\tgcc"
puts $f "INSTALL_PIC_ARCHIVE=\tyes"
puts $f "SHLIB_MAJOR=\t26"
puts $f "SHLIB_MINOR=\t0"
puts $f ""
puts $f "LIB1OBJS=\t[add_suffix $l_libgcc1 .o]"
puts $f "LIB2OBJS=\t[add_suffix $l_libgcc2 .o]"
puts $f {
OBJS= ${LIB1OBJS} ${LIB2OBJS}
LIB1SOBJS=${LIB1OBJS:.o=.so}
LIB2SOBJS=${LIB2OBJS:.o=.so}
P1OBJS=${LIB1OBJS:.o=.po}
P2OBJS=${LIB2OBJS:.o=.po}
${LIB1OBJS}: libgcc1.c
${CC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc1.c
@${LD} -x -r ${.TARGET}
@mv a.out ${.TARGET}
${LIB2OBJS}: libgcc2.c
${CC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc2.c
@${LD} -x -r ${.TARGET}
@mv a.out ${.TARGET}
.if !defined(NOPIC)
${LIB1SOBJS}: libgcc1.c
${CC} -c -fpic ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc1.c
${LIB2SOBJS}: libgcc2.c
${CC} -c -fpic ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc2.c
.endif
.if !defined(NOPROFILE)
${P1OBJS}: libgcc1.c
${CC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc1.c
${P2OBJS}: libgcc2.c
${CC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc2.c
.endif
.include <bsd.lib.mk>
}
close $f
copy_c $sdir $ddir/libgcc $l_libgcc
# do ~/include
sh "mkdir $ddir/include"
copy_l $sdir $ddir/include [add_suffix $l_include .h]
copy_l $sdir $ddir/include $l_include_x
copy_l $sdir $ddir/include [add_suffix $l_libgcc_h .h]
# do ~/include/i386
sh "mkdir $ddir/include/i386"
copy_l $sdir/config/i386 $ddir/include/i386 [add_suffix $l_include_i386 .h]
# do ~/cc_int
mk_lib $ddir cc_int [add_suffix $l_common .c] {
"NOPROFILE=\t1"
"\ninstall:\n\t@true"
}
copy_c $sdir $ddir/cc_int $l_common
# do ~/cpp
mk_prog $ddir cpp [add_suffix $l_cpp .c] {
"BINDIR=\t/usr/libexec"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int/obj"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int"
"LDADD+=\t-lcc_int"
}
copy_c $sdir $ddir/cpp $l_cpp
cp $sdir/cpp.1 $ddir/cpp/cpp.1
# do ~/c++
mk_prog $ddir c++ [add_suffix "$l_cplus $l_cplus_cp" .c] {
"BINDIR=\t/usr/bin"
"NOMAN=\t1"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int/obj"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int"
"LDADD+=\t-lcc_int"
}
copy_c $sdir $ddir/c++ $l_cplus
copy_c $sdir/cp $ddir/c++ $l_cplus_cp
# do ~/cc
mk_prog $ddir cc [add_suffix $l_cc .c] {
"BINDIR=\t/usr/bin"
"MLINKS+=cc.1 gcc.1"
"MLINKS+=cc.1 c++.1"
"MLINKS+=cc.1 g++.1"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int/obj"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int"
"LDADD+=\t-lcc_int"
"\nafterinstall:\n\tcd \$(DESTDIR)\$(BINDIR) ; rm gcc ; ln -s cc gcc"
}
copy_c $sdir $ddir/cc $l_cc
cp $sdir/gcc.1 $ddir/cc/cc.1
# do ~/cc1
mk_prog $ddir cc1 [add_suffix $l_cc1 .c] {
"BINDIR=\t/usr/libexec"
"NOMAN=\t1"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int/obj"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int"
"LDADD+=\t-lcc_int"
}
copy_c $sdir $ddir/cc1 $l_cc1
# do ~/cc1plus
mk_prog $ddir cc1plus [add_suffix "$l_cc1plus_cp $l_cc1plus" .c] {
"BINDIR=\t/usr/libexec"
"NOMAN=\t1"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int/obj"
"LDDESTDIR+=\t-L\${.CURDIR}/../cc_int"
"LDADD+=\t-lcc_int"
}
copy_l $sdir/cp $ddir/cc1plus $l_cc1plus_x
copy_c $sdir $ddir/cc1plus $l_cc1plus
copy_c $sdir/cp $ddir/cc1plus $l_cc1plus_cp
copy_l $sdir/cp $ddir/cc1plus [add_suffix $l_cc1plus_h .h]
exit 0

513
gnu/gnu2bmake/gcc260.patch Normal file
View File

@ -0,0 +1,513 @@
I have removed the "ljo-Fortran" stuff. It doesn't belong in cc. /phk
From kralizec.zeta.org.au!bde Sat Jul 30 22:53:11 1994
Return-Path: <bde@kralizec.zeta.org.au>
Received: from warrane.connect.com.au by tfs.com (smail3.1.28.1) with SMTP
id m0qUTpa-0003wvC; Sat, 30 Jul 94 22:53 PDT
Received: from kralizec.zeta.org.au by warrane.connect.com.au with SMTP id AA24021
(5.67b8/IDA-1.5 for <phk@TFS.COM>); Sun, 31 Jul 1994 15:51:38 +1000
Received: (from bde@localhost) by kralizec.zeta.org.au (8.6.9/8.6.9) id PAA00298 for phk@TFS.COM; Sun, 31 Jul 1994 15:51:11 +1000
Date: Sun, 31 Jul 1994 15:51:11 +1000
From: Bruce Evans <bde@kralizec.zeta.org.au>
Message-Id: <199407310551.PAA00298@kralizec.zeta.org.au>
To: phk@tfs.com
Subject: Re: gcc-2.6.0, diff netbsd/freebsd
---
>> I've compiled nothing else with 2.6.0, but it bootstraps fine on my
>> 1.1R system. What's the problem with stddef.h? I haven't had any
>> troubles here with that file.
>Probably nothing serious, but I already has it on my list.
Here are the diffs for my port of gcc-2.6.0. FreeBSD-1.1.5 and 4.4lite
have an amazing number of bugs in involving namespace pollution from the
runetype stuff. rune_t should never have been in <stddef.h>. <ctype.h>
does not compile if _ANSI_SOURCE is defined ...
Bruce
Makefile.in:
Rip out debugging stuff from libgcc.a the same as FreeBSD does.
final.c:
o If NO_PROFILE_DATA is defined, don't waste space for unused
profile data.
config/i386/freebsd.h:
o Define specs together near the start.
o For -p and -pg, put -Bstatic in LINK_SPEC instead of in LIB_SPEC
so that it gets seen early enough when other libraries are used.
o Update wchar_t stuff. `wchar_t foo[] = "123";' is broken in
FreeBSD-1.1.5 because wchar_t was changed without changing gcc.
I guess nothing actually uses wchar_t :-).
o FUNCTION_PROFILER: don't waste space and time for unused profile
data and pointer to it. Compatible with FreeBSD-1.x.
o FUNCTION_PROFILER_EPILOGUE: for accurate profiling if there's
a readable clock. Incompatible with FreeBSD-1.x (hide it with
#if 0, or add a dummy mexitcount to the user mcount file and
a real mexitexit to the kernel mcount file). Need a -mflag for
this. Want more profiling stuff (profile before function
prologue...) from osfrose.h.
o Fixed white space in "svr4" stuff. Actually it's osfrose stuff.
Formatting now matches osfrose.h.
config/i386/i386.c:
o Fix bugs: profiling may use the pic register. Need a macro for
this - it is machine-dependent. It is already fixed in osfrose.h
by not using the functions in i386.c.
o Support FUNCTION_PROFILER_EPILOGUE. Avoiding the use of the pic
register is even more complicated for the epilogue than for the
prologue. We don't attempt to. See osfrose.h for the prologue.
config/i386/i386.h:
o Avoid average 1.2% code bloat caused by stupid register allocation.
ginclude/stdarg.h, ginclude/varargs.h:
o Handle Net/2 _VA_LIST_ and 4.4lite _BSD_VA_LIST_ right.
ginclude/stddef.h:
o Handle Net/2 _WCHAR_T_ and 4.4lite _BSD_WCHAR_T_ less wrongly than
before. Copy FreeBSD-1.1.5/4.4lite rune_t brokenness. Remove
extra underscores in _GCC_*_T_ which stopped the Net/2 _PTRDIFF_T_,
_SIZE_T_ and _WCHAR_T_ from being undefined. Still need to
handle the 4.4lite _BSD_PTRDIFF_T_ and _BSD_SIZE_T_. They are too
hard to handle using ifdefs anyway. stddef.h takes 227 lines to
define only 3 ANSI typedefs, 1 bogus typedef and 2 ANSI macros.
diff -rc2 gcc-2.6.0/orig/Makefile.in gcc-2.6.0/Makefile.in
*** gcc-2.6.0/orig/Makefile.in Thu Jul 14 08:46:54 1994
--- gcc-2.6.0/Makefile.in Sun Jul 17 05:36:06 1994
***************
*** 212,216 ****
# we use this here because that should be enough, and also
# so that -g1 will be tested.
! LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g1
# Additional options to use when compiling libgcc2.a.
--- 213,217 ----
# we use this here because that should be enough, and also
# so that -g1 will be tested.
! LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) # -g1
# Additional options to use when compiling libgcc2.a.
***************
*** 714,717 ****
--- 716,720 ----
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
mv libgcc1.o $${name}.o; \
+ ld -r -x $${name}.o; mv a.out $${name}.o; \
$(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
rm -f $${name}.o; \
***************
*** 733,736 ****
--- 736,740 ----
$(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ ld -r -x $${name}.o; mv a.out $${name}.o; \
$(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
***************
*** 794,797 ****
--- 798,802 ----
$(srcdir)/libgcc2.c -o $${name}.o; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ ld -r -x $${name}.o; mv a.out $${name}.o; \
$(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
rm -f $${name}.o; \
***************
*** 813,816 ****
--- 818,822 ----
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+ ld -r -x $${name}.o; mv a.out $${name}.o; \
$(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
rm -f $${name}.[so]; \
diff -rc2 gcc-2.6.0/orig/final.c gcc-2.6.0/final.c
*** gcc-2.6.0/orig/final.c Wed Jul 13 11:30:52 1994
--- gcc-2.6.0/final.c Sun Jul 17 05:49:35 1994
***************
*** 954,965 ****
--- 954,969 ----
FILE *file;
{
+ #ifndef NO_PROFILE_DATA
int align = MIN (BIGGEST_ALIGNMENT, POINTER_SIZE);
+ #endif /* not NO_PROFILE_DATA */
int sval = current_function_returns_struct;
int cxt = current_function_needs_context;
+ #ifndef NO_PROFILE_DATA
data_section ();
ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
ASM_OUTPUT_INTERNAL_LABEL (file, "LP", profile_label_no);
assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
+ #endif /* not NO_PROFILE_DATA */
text_section ();
diff -rc2 gcc-2.6.0/config/i386/orig/freebsd.h gcc-2.6.0/config/i386/freebsd.h
*** gcc-2.6.0/config/i386/orig/freebsd.h Fri Jul 15 02:55:14 1994
--- gcc-2.6.0/config/i386/freebsd.h Sun Jul 17 07:33:20 1994
***************
*** 40,46 ****
--- 40,52 ----
}
+ #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
+
/* Like the default, except no -lg. */
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
+ #define LINK_SPEC \
+ "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*} \
+ %{p:-Bstatic} %{pg:-Bstatic} %{Z}"
+
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
***************
*** 50,77 ****
#undef WCHAR_TYPE
! #define WCHAR_TYPE "short unsigned int"
! #define WCHAR_UNSIGNED 1
#undef WCHAR_TYPE_SIZE
! #define WCHAR_TYPE_SIZE 16
#define HAVE_ATEXIT
! /* Redefine this to use %eax instead of %edx. */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (flag_pic) \
! { \
! fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \
! LPREFIX, (LABELNO)); \
! fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
! } \
else \
! { \
! fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \
! fprintf (FILE, "\tcall mcount\n"); \
! } \
}
--- 56,89 ----
#undef WCHAR_TYPE
! #define WCHAR_TYPE "int"
! #define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE
! #define WCHAR_TYPE_SIZE BITS_PER_WORD
#define HAVE_ATEXIT
! /* Tell final.c that we don't need a label passed to mcount. */
!
! #define NO_PROFILE_DATA
!
! /* Redefine this to not pass an unused label in %edx. */
!
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (flag_pic) \
! fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
! else \
! fprintf (FILE, "\tcall mcount\n"); \
! }
!
! #define FUNCTION_PROFILER_EPILOGUE(FILE) \
! { \
! if (flag_pic) \
! fprintf (FILE, "\tcall *mexitcount@GOT(%%ebx)\n"); \
else \
! fprintf (FILE, "\tcall mexitcount\n"); \
}
***************
*** 170,174 ****
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
{ \
! size_directive_output = 1; \
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
assemble_name (FILE, NAME); \
--- 182,186 ----
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
{ \
! size_directive_output = 1; \
fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
assemble_name (FILE, NAME); \
***************
*** 184,202 ****
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
! #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
! do { \
! char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
! if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
! && ! AT_END && TOP_LEVEL \
! && DECL_INITIAL (DECL) == error_mark_node \
! && !size_directive_output) \
! { \
! fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
! assemble_name (FILE, name); \
! fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
! } \
} while (0)
-
/* This is how to declare the size of a function. */
--- 196,213 ----
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
! #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
! do { \
! char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
! if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
! && ! AT_END && TOP_LEVEL \
! && DECL_INITIAL (DECL) == error_mark_node \
! && !size_directive_output) \
! { \
! fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
! assemble_name (FILE, name); \
! fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
! } \
} while (0)
/* This is how to declare the size of a function. */
***************
*** 219,226 ****
} \
} while (0)
-
- #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
- #define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
/* This section copied from i386/osfrose.h */
--- 230,233 ----
diff -rc2 gcc-2.6.0/config/i386/orig/i386.c gcc-2.6.0/config/i386/i386.c
*** gcc-2.6.0/config/i386/orig/i386.c Tue Apr 12 21:40:35 1994
--- gcc-2.6.0/config/i386/i386.c Sun Jul 17 06:10:00 1994
***************
*** 860,864 ****
rtx xops[4];
int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
! || current_function_uses_const_pool);
xops[0] = stack_pointer_rtx;
--- 860,865 ----
rtx xops[4];
int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
! || current_function_uses_const_pool
! || profile_flag || profile_block_flag);
xops[0] = stack_pointer_rtx;
***************
*** 921,926 ****
int reglimit = (frame_pointer_needed
? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
! int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
! || current_function_uses_const_pool);
#ifdef NON_SAVING_SETJMP
--- 922,935 ----
int reglimit = (frame_pointer_needed
? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
!
! #ifdef FUNCTION_PROFILER_EPILOGUE
! if (profile_flag)
! return 0;
! #endif
!
! if (flag_pic && (current_function_uses_pic_offset_table
! || current_function_uses_const_pool
! || profile_flag || profile_block_flag))
! return 0;
#ifdef NON_SAVING_SETJMP
***************
*** 933,938 ****
for (regno = reglimit - 1; regno >= 0; regno--)
! if ((regs_ever_live[regno] && ! call_used_regs[regno])
! || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
nregs++;
--- 942,946 ----
for (regno = reglimit - 1; regno >= 0; regno--)
! if (regs_ever_live[regno] && ! call_used_regs[regno])
nregs++;
***************
*** 955,958 ****
--- 963,971 ----
int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
|| current_function_uses_const_pool);
+
+ #ifdef FUNCTION_PROFILER_EPILOGUE
+ if (profile_flag)
+ FUNCTION_PROFILER_EPILOGUE (file);
+ #endif
/* Compute the number of registers to pop */
diff -rc2 gcc-2.6.0/config/i386/orig/i386.h gcc-2.6.0/config/i386/i386.h
*** gcc-2.6.0/config/i386/orig/i386.h Thu Jun 16 20:36:13 1994
--- gcc-2.6.0/config/i386/i386.h Mon Jul 18 19:18:59 1994
***************
*** 267,272 ****
#define REG_ALLOC_ORDER \
! /*dx,cx,ax,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
! { 1, 2, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
/* Macro to conditionally modify fixed_regs/call_used_regs. */
--- 267,272 ----
#define REG_ALLOC_ORDER \
! /*ax,cx,dx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
! { 0, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
/* Macro to conditionally modify fixed_regs/call_used_regs. */
diff -rc2 gcc-2.6.0/ginclude/orig/stdarg.h gcc-2.6.0/ginclude/stdarg.h
*** gcc-2.6.0/ginclude/orig/stdarg.h Sat Jul 9 12:04:08 1994
--- gcc-2.6.0/ginclude/stdarg.h Mon Jul 18 01:32:16 1994
***************
*** 44,47 ****
--- 44,56 ----
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
+ #if defined (__FreeBSD__)
+ /* This is the correct way to handle all BSD NET2 and BSD 4.4 systems. */
+ #include <machine/ansi.h>
+ #ifdef _BSD_VA_LIST_
+ typedef _BSD_VA_LIST_ __gnuc_va_list;
+ #else
+ typedef _VA_LIST_ __gnuc_va_list;
+ #endif
+ #else
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
typedef char *__gnuc_va_list;
***************
*** 50,53 ****
--- 59,63 ----
#endif
#endif
+ #endif
/* Define the standard macros for the user,
***************
*** 113,118 ****
--- 123,133 ----
#endif
+ #if 0
+ /* BSD 4.4 actually spells the name _BSD_VA_LIST_ and requires it to be
+ * defined and usable in place of va_list when the latter name is not
+ * allowed (e.g., in stdio.h - see above). */
#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
+ #endif
#endif
diff -rc2 gcc-2.6.0/ginclude/orig/stddef.h gcc-2.6.0/ginclude/stddef.h
*** gcc-2.6.0/ginclude/orig/stddef.h Tue Apr 26 04:13:05 1994
--- gcc-2.6.0/ginclude/stddef.h Sun Jul 17 21:52:12 1994
***************
*** 36,40 ****
#define _PTRDIFF_T
#endif
! #ifndef _WCHAR_T_
#define _WCHAR_T
#endif
--- 36,40 ----
#define _PTRDIFF_T
#endif
! #if ! defined (_WCHAR_T_) && ! defined (_BSD_WCHAR_T_)
#define _WCHAR_T
#endif
***************
*** 173,176 ****
--- 173,179 ----
#define __WCHAR_TYPE__ int
#endif
+ #if defined (_ANSI_H_) && defined (_BSD_RUNE_T_)
+ typedef _BSD_RUNE_T_ rune_t; /* WRONG */
+ #endif
typedef __WCHAR_TYPE__ wchar_t;
#endif
***************
*** 189,200 ****
are already defined. */
#ifdef _ANSI_H_
! #ifdef _GCC_PTRDIFF_T_
#undef _PTRDIFF_T_
#endif
! #ifdef _GCC_SIZE_T_
#undef _SIZE_T_
#endif
! #ifdef _GCC_WCHAR_T_
#undef _WCHAR_T_
#endif
#endif /* _ANSI_H_ */
--- 192,204 ----
are already defined. */
#ifdef _ANSI_H_
! #ifdef _GCC_PTRDIFF_T
#undef _PTRDIFF_T_
#endif
! #ifdef _GCC_SIZE_T
#undef _SIZE_T_
#endif
! #ifdef _GCC_WCHAR_T
#undef _WCHAR_T_
+ #undef _BSD_WCHAR_T_
#endif
#endif /* _ANSI_H_ */
diff -rc2 gcc-2.6.0/ginclude/orig/varargs.h gcc-2.6.0/ginclude/varargs.h
*** gcc-2.6.0/ginclude/orig/varargs.h Sat Jul 9 12:04:13 1994
--- gcc-2.6.0/ginclude/varargs.h Mon Jul 18 01:32:02 1994
***************
*** 76,79 ****
--- 76,88 ----
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
+ #if defined (__FreeBSD__)
+ /* This is the correct way to handle all BSD NET2 and BSD 4.4 systems. */
+ #include <machine/ansi.h>
+ #ifdef _BSD_VA_LIST_
+ typedef _BSD_VA_LIST_ __gnuc_va_list;
+ #else
+ typedef _VA_LIST_ __gnuc_va_list;
+ #endif
+ #else
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
typedef char *__gnuc_va_list;
***************
*** 82,85 ****
--- 91,95 ----
#endif
#endif
+ #endif
#define va_start(AP) AP=(char *) &__builtin_va_alist
***************
*** 171,175 ****
--- 181,190 ----
/* The next BSD release (if there is one) wants this symbol to be
undefined instead of _VA_LIST_. */
+ #if 0
+ /* BSD 4.4 actually spells the name _BSD_VA_LIST_ and requires it to be
+ * defined and usable in place of va_list when the latter name is not
+ * allowed (e.g., in stdio.h - see ginclude/stdarg.h). */
#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
+ #endif
#endif

196
gnu/gnu2bmake/gnu2bmake.tcl Normal file
View File

@ -0,0 +1,196 @@
#!/usr/local/bin/tcl
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
# ----------------------------------------------------------------------------
#
# $FreeBSD$
#
#######################################################################
# Generic procedures usable in the process of gnu-to-bmake jobs.
#
#######################################################################
# sh -- execute command.
# argv[1] shell command to execute.
#
proc sh {cmd} {
puts stdout "+ $cmd"
flush stdout
exec sh -e -c $cmd >&@ stdout
}
#######################################################################
# cp -- execute cp(1)
# argv arguments to cp(1)
#
proc cp {args} {
sh "cp $args"
}
#######################################################################
# copy_l -- Copy list of files, try to make(1) them if missing.
# argv[1] source directory
# argv[2] destination directory
# argv[3] list of filenames
#
proc copy_l {src dst files} {
foreach f $files {
if {![file exists $src/${f}]} {
sh "cd $src ; set +e ; make ${f}"
}
if {![file exists $src/${f}]} {
error "Couldn't produce ${f} in $src"
}
cp $src/${f} $dst
}
}
#######################################################################
# copy_c -- Copy list of .c files, try to make(1) them if missing.
# argv[1] source directory
# argv[2] destination directory
# argv[3] list of filenames, with or without .c suffixes.
#
proc copy_c {src dst files} {
regsub -all {\.c} $files {} files
foreach f $files {
if {![file exists $src/${f}.c]} {
sh "cd $src ; set +e ; make ${f}.c"
}
if {![file exists $src/${f}.c]} {
sh "cd $src ; set +e ; make ${f}.o"
}
if {![file exists $src/${f}.c]} {
error "Couldn't produce ${f}.c in $src"
}
cp $src/${f}.c $dst
}
}
#######################################################################
# zap_suffix -- remove suffixes from list if filenames
# argv[1] list of filenames
# argv[2] (optional) regex matching suffixes to be removed,
# default removes all known suffixes, (AND warts too!).
#
proc zap_suffix {lst {suf {\.[cyolhsxS]}}} {
regsub -all $suf $lst {} a
return $a
}
#######################################################################
# add_suffix -- add suffixes to list if filenames
# argv[1] list of filenames
# argv[2] string to add.
#
proc add_suffix {lst suf} {
set l ""
foreach i $lst {lappend l ${i}${suf}}
return $l
}
#######################################################################
# add_prefix -- add prefixes to list if filenames
# argv[1] list of filenames
# argv[2] string to add.
#
proc add_prefix {lst prf} {
set l ""
foreach i $lst {lappend l ${prf}${i}}
return $l
}
#######################################################################
# basename -- removes directory-prefixes from list of names.
# argv[1] list of filenames
#
proc basename {lst} {
set l ""
foreach i $lst {regsub {.*/} $i {} i ; lappend l $i}
return $l
}
#######################################################################
# makefile_macro -- return the contents of a Makefile macro
# argv[1] name of macro
# argv[2] source directory
# argv[3] (optional) name of makefile
#
proc makefile_macro {macro dir {makefile Makefile}} {
# Nobody will miss a core file, right ?
cp $dir/$makefile $dir/make.core
set f [open $dir/make.core a]
puts $f "\n\nGNU2TCL_test:\n\t@echo \$\{$macro\}"
close $f
set a [exec make -f $dir/make.core GNU2TCL_test]
sh "rm -f $dir/make.core"
return $a
}
#######################################################################
# mk_prog -- Make a directory and Makefile for a program.
# argv[1] name of the parent-directory
# argv[2] name of the program
# argv[3] list of .c files (the SRCS macro content).
# argv[4] (optional) list of lines for the Makefile
#
proc mk_prog {ddir name list {make ""}} {
sh "mkdir $ddir/$name"
set f [open $ddir/$name/Makefile w]
puts $f "#\n# \$FreeBSD\$\n#\n"
puts $f "PROG =\t$name"
puts $f "SRCS =\t[lsort $list]"
foreach i $make {puts $f $i}
puts $f "\n.include <bsd.prog.mk>"
close $f
}
#######################################################################
# mk_lib -- Make a directory and Makefile for a library
# argv[1] name of the parent-directory
# argv[2] name of the library
# argv[3] list of .c files (the SRCS macro content).
# argv[4] (optional) list of lines for the Makefile
#
proc mk_lib {ddir name list {make ""}} {
sh "mkdir $ddir/$name"
set f [open $ddir/$name/Makefile w]
puts $f "#\n# \$FreeBSD\$\n#\n"
puts $f "SRCS =\t[lsort $list]"
puts $f "LIB =\t$name"
foreach i $make {puts $f $i}
puts $f "\n.include <bsd.lib.mk>"
close $f
}
#######################################################################
# common_set -- Return the files common to a list of lists.
# argv[] lists of filenames
#
proc common_set {args} {
set a(0) 0 ; unset a(0)
foreach i $args {
foreach j $i {if {[catch {incr a($j)} k]} {set a($j) 1}}
}
set j ""
foreach i [array names a] {
if {$a($i) > 1} {lappend j $i}
}
return $j
}
#######################################################################
# reduce_by -- Remove elements from list, if present in 2nd list.
# argv[1] lists of filenames
# argv[2] lists of filenames to be removed.
#
proc reduce_by {l1 l2} {
set a(0) 0 ; unset a(0)
foreach j $l1 { if {[catch {incr a($j)} k]} {set a($j) 1} }
foreach j $l2 { catch {unset a($j)} }
return [array names a]
}

View File

@ -0,0 +1,71 @@
This patch fixes two things:
config.guess:
i[34]86-*-FreeBSD* -> i386--bsd
libio/gen-params:
We use hex in limits.h
Poul-Henning Kamp
phk@login.dkuug.dk
diff -C2 -r libg++-2.6.orig/config.guess libg++-2.6/config.guess
*** libg++-2.6.orig/config.guess Sat Jul 16 12:11:08 1994
--- libg++-2.6/config.guess Sun Jul 31 20:45:59 1994
***************
*** 197,201 ****
exit 0 ;;
i[34]86:FreeBSD:*:*)
! echo ${UNAME_MACHINE}-unknown-freebsd${UNAME_RELEASE}
exit 0 ;;
i[34]86:NetBSD:*:*)
--- 197,201 ----
exit 0 ;;
i[34]86:FreeBSD:*:*)
! echo ${UNAME_MACHINE}-unknown-bsd
exit 0 ;;
i[34]86:NetBSD:*:*)
diff -C2 -r libg++-2.6.orig/libio/gen-params libg++-2.6/libio/gen-params
*** libg++-2.6.orig/libio/gen-params Mon Jul 18 18:04:09 1994
--- libg++-2.6/libio/gen-params Sun Jul 31 20:50:12 1994
***************
*** 415,432 ****
default_int64=
INT16=32767
INT32=2147483647
INT64=9223372036854775807
! if [ "${SHRT_MAX}" = $INT16 ] ; then
default_int16=short
! if [ "${LONG_MAX}" = $INT32 ] ; then
default_int32=long
! if [ "${LONG_LONG_MAX}" = $INT64 ] ; then
# Most Unices, DOS
default_int64="long long"
fi
! elif [ "${INT_MAX}" = $INT32 ] ; then
default_int32=int
! if [ "${LONG_MAX}" = $INT64 ] ; then
# Some 64-bit Unices, like OSF/1 on the Alpha
default_int64=long
--- 415,435 ----
default_int64=
INT16=32767
+ INT16X=0x7fff
INT32=2147483647
+ INT32X=0x7fffffff
INT64=9223372036854775807
+ INT64X=0x7fffffffffffffff
! if [ "${SHRT_MAX}" = $INT16 -o "${SHRT_MAX}" = $INT16X ] ; then
default_int16=short
! if [ "${LONG_MAX}" = $INT32 -o "${LONG_MAX}" = $INT32X] ; then
default_int32=long
! if [ "${LONG_LONG_MAX}" = $INT64 -o "${LONG_LONG_MAX}" = $INT64X] ; then
# Most Unices, DOS
default_int64="long long"
fi
! elif [ "${INT_MAX}" = $INT32 -o "${INT_MAX}" = $INT32X] ; then
default_int32=int
! if [ "${LONG_MAX}" = $INT64 -o "${LONG_MAX}" = $INT64X] ; then
# Some 64-bit Unices, like OSF/1 on the Alpha
default_int64=long