diff options
| author | svn2git <svn2git@FreeBSD.org> | 1994-07-01 08:00:00 +0000 |
|---|---|---|
| committer | svn2git <svn2git@FreeBSD.org> | 1994-07-01 08:00:00 +0000 |
| commit | 5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 (patch) | |
| tree | e779b5a6edddbb949b7990751b12d6f25304ba86 /gnu/usr.bin/cc25 | |
| parent | a16f65c7d117419bd266c28a1901ef129a337569 (diff) | |
Diffstat (limited to 'gnu/usr.bin/cc25')
| -rw-r--r-- | gnu/usr.bin/cc25/Freebsd.gcc258.patch | 39 | ||||
| -rw-r--r-- | gnu/usr.bin/cc25/Makefile | 6 | ||||
| -rw-r--r-- | gnu/usr.bin/cc25/README | 209 | ||||
| -rw-r--r-- | gnu/usr.bin/cc25/gcc258-freebsd.patch | 1188 | ||||
| -rwxr-xr-x | gnu/usr.bin/cc25/gnu2bsd.tcl | 470 | ||||
| -rw-r--r-- | gnu/usr.bin/cc25/usr.bin.cpp/Makefile | 10 | ||||
| -rw-r--r-- | gnu/usr.bin/cc25/usr.bin.cpp/cpp.script | 91 | ||||
| -rw-r--r-- | gnu/usr.bin/cc25/usr.bin.f77/Makefile | 7 | ||||
| -rw-r--r-- | gnu/usr.bin/cc25/usr.bin.f77/f77.script | 114 |
9 files changed, 2134 insertions, 0 deletions
diff --git a/gnu/usr.bin/cc25/Freebsd.gcc258.patch b/gnu/usr.bin/cc25/Freebsd.gcc258.patch new file mode 100644 index 000000000000..97af031aad05 --- /dev/null +++ b/gnu/usr.bin/cc25/Freebsd.gcc258.patch @@ -0,0 +1,39 @@ +# Last updated 19940220 phk@login.dkuug.dk +# These are patches to FreeBSD-current, to make it compile with gcc-2.5.8 +# Eventually these, or maybe better ones should make it into the FreeBSD +# source tree. + +./gnu/usr.bin/cc/lib/tm.h + Define ____386BSD____ __FreeBSD__ if not so already. +./gnu/usr.bin/rcs/lib/conf.h + make compilable by gcc2.5.8 + +diff -U3 /usr/src-current/./gnu/usr.bin/cc/lib/tm.h ./gnu/usr.bin/cc/lib/tm.h +--- /usr/src-current/./gnu/usr.bin/cc/lib/tm.h Mon Jan 10 23:48:12 1994 ++++ ./gnu/usr.bin/cc/lib/tm.h Fri Feb 18 00:54:15 1994 +@@ -2,6 +2,13 @@ + + /* This is tested by i386gas.h. */ + #define YES_UNDERSCORES ++#ifndef ____386BSD____ ++#define ____386BSD____ ++#endif ++ ++#ifndef __FreeBSD__ ++#define __FreeBSD__ ++#endif + + #include "i386/gstabs.h" + +diff -U3 /usr/src-current/./gnu/usr.bin/rcs/lib/conf.h ./gnu/usr.bin/rcs/lib/conf.h +--- /usr/src-current/./gnu/usr.bin/rcs/lib/conf.h Fri Jun 18 06:22:13 1993 ++++ ./gnu/usr.bin/rcs/lib/conf.h Fri Feb 18 00:54:17 1994 +@@ -219,7 +219,7 @@ + /* Adjust the following declarations as needed. */ + + +-#if __GNUC__ && !__STRICT_ANSI__ ++#if __GNUC__ && !__STRICT_ANSI__ && !__FreeBSD__ + # define exiting volatile /* GCC extension: function cannot return */ + #else + # define exiting diff --git a/gnu/usr.bin/cc25/Makefile b/gnu/usr.bin/cc25/Makefile new file mode 100644 index 000000000000..67dff93dba18 --- /dev/null +++ b/gnu/usr.bin/cc25/Makefile @@ -0,0 +1,6 @@ + +PGMDIR= gcc_int xgcc cccp cc1 cc1plus cc1obj g++ usr.bin.cpp usr.bin.f77 +LIBDIR= libgcc libobjc +SUBDIR= $(PGMDIR) $(LIBDIR) + +.include <bsd.subdir.mk> diff --git a/gnu/usr.bin/cc25/README b/gnu/usr.bin/cc25/README new file mode 100644 index 000000000000..566908f2c026 --- /dev/null +++ b/gnu/usr.bin/cc25/README @@ -0,0 +1,209 @@ + ---------------------------------------------------------------------------- + "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 + ---------------------------------------------------------------------------- + + $Id: README,v 1.2 1994/02/27 21:42:34 phk Exp $ + +"If you're looking for trouble, + you've come to the right place !" + The King. + +(I have taken the time to rewrite the README. It had become a proper mess, +just like any other workspace of mine.) + +What is this ? +-------------- +My intention is that this will be the link between the GNU-release of GCC, +and the FreeBSD integrated version of GCC. The problem^H^H^H^H^H^Hchallenge +is that FreeBSD uses BSD style Makefiles, whereas GNU uses their own scheme. +Thus, everytime GNU adds a file, changes a flag and so on, we have to find +out what consequences this should have for the FreeBSD Makefiles. This +stuff, should make that process easier, and reproducible. + +The next challenge^H^H^H^H^H^H^H^H^Hproblem is that we need some modifications +to the GNU source. For instance: we use gcc to compile FORTRAN via f2c, so +we need to add the rules for that to gcc.c. + +In case you have ever wondered about what "dark runes" was, this is that. + +Overview: +--------- +When a new release of GCC is to be brought into FreeBSD, this is what must +be done: + + - modify gnu2bsd.tcl as needed, until the resulting FreeBSD-tree + is compilable. It may not yet be correct, but it must be compilable. + - patch the GNU-tree as needed until the compiler generated from + the BSD-tree is correct. + +I think this will be the simplest way to do the second part: + + - Run a virgin GNU-gcc-(N) through gnu2bsd.tcl. + - Create a patch from this to the patched FreeBSD-gcc-(N). + - Run a virgin GNU-gcc-(N+a) through gnu2bsd.tcl + - Apply as much of the above patch as makes sense. + - Twiddle until it works. + - Submit the needed patches to the GNU people, to avoid + needless diversion from their base. + +It is of course clear from the above, that unless you feel that you are +sure why you need to do this, you shouldn't do it. There is some very +interesting ways this can hose your system. Don't tell me I didn't +warn you. + +Installation: +------------- + + 0. Needed ingredients: + ====================== + bison and tcl. + + 1. Create a emergency ready copy of your old gcc. + ================================================= + Move the old compiler to a safe place + mv /usr/src/gnu/usr.bin/cc /usr/src/gnu/usr.bin/cc.old + for instance. + + cd into the directory of the old compiler, and do: + find . -name 'obj' -exec rm -f {} \; + make clean all + + It is necessary to remove the 'obj' sym-links, as a make world + is likely to remove the stuff they point at. Doing it this way + you can, in case you hose the installed c-compiler, go down here + and do a + make install + and things should work for you again. + + 2. Create the foundations for a new gcc. + ======================================== + Create a new directory /usr/src/gnu/usr.bin/cc The name can + be anything you like actually, but some Makefiles "know" this place. + This directory is $BSDDIR in the rest of this instruction. + + Copy the usr.bin.cpp and usr.bin.f77 with contents to $BSDDIR from + somewhere, either they came with this stuff, or you can take it + from the old cc on your system. + + Copy Makefile and gnu2bsd.tcl also, and if any gcc???-freebsd.patch + files are there, you should copy those along too. This file (README) + will be nice to have too. + + 3. Install a GNU-release of GCC somewhere. + ========================================== + This can be anywhere you have the necesary disk-space. ($GNUDIR) + + Apply patches to the GNU-dist. If any of the gcc???-freebsd.patch + has the same version as the GCC you're installing, use that, if you + are installing a newer version of gcc, you're a bit on your own. Try + the most recent of the gcc???-freebsd.patch files, and prepare for + some work. + + 4. Create the BSD-tree from the GNU-tree + ======================================== + Edit gnu2bsd.tcl so that the various "TWEAKS" are right. If this is + a new version of GCC, all bets are off, and you might need to modify + in the main-part of the script too. + + And now, the great moment: + cd $GNUDIR + configure + make realclean + configure + cd $BSDDIR + tclsh gnu2bsd.tcl + + 5. Bootstrap the new compiler + ============================= + + cd $BSDDIR + make clean obj clean depend + make -k ; make -k install + # The first make might fail on libgcc for instance, + # install the bits which was OK. + make clean all install + # this should succeed. + make clean all install + # Now things should be A1-OK. + +History: +-------- + +199402272230 + Received blessed patch for the ((packed)) problem from GNU. + +199402211500 (v5): + + Got more patches from Richard to expmed.c, not quite right yet. + + Tried to make a patch from 245 to 258 (FreeBSD-style directories), + uncompressed size: 4.4 Mb (the whole 258 is 10Mb). This actually + resolves my doubts about the renaming of 'lib' to 'gcc_int' &c &c. + We save nothing really by trying to make a patch. + + I think that we should move from src/gnu/usr.bin/cc to + src/gnu/usr.bin/cc25 (and so on) to facilitate testing. + + People tell me that usr.bin.cpp usr.bin.f77 should stay as + subdirs of gcc. OK, I don't really care... + + Added %{Z} to gcc.c as per patch to -current. + + README rewritten. + +revision: 199402140030 (v4) + + Added the same patch to expmed.c for reading bit-fields. + + The patch in v3 to gcc was wrong, sorry. + +revision: 199402132300 (v3) + + Please notice that the both the patchfiles have changed. + + Please use -O2 as much as possible, we must try to stress this + bugger to the limit. If you want to change the global defaults + you should change CFLAGS in /usr/src/share/mk/sys.mk and do a + make (or directly in /usr/share/mk/sys.mk but make world will + loose that change then). I suggest -O2, and -m486 in case you + have one. Sideeffect is faster machine, you can insert wait- + states or disable cache-memory if this is a problem for you :-) + + cc1, abort(3)'s on this bit of code, modelled on + init386() in sys/i386/i386/machdep.c: + + extern union descriptor gdt[40]; + struct region_descriptor { + unsigned rd_limit:16; + unsigned rd_base:32 __attribute__ ((packed)); + }; + void foo() { + struct region_descriptor r_gdt; + r_gdt.rd_base = (unsigned) gdt; + } + + I got a new expmed.c from Richard, and had to fix a problem + in it. This is all in the gcc258-freebsd.patch.3 file. + + It seems that groff/grops chokes, but this could be libg++ which + should be updated. Nothing done about it for now. + + Richard Kenner said that there will probably never be a 2.5.9 and that + 2.6.0 should hit the ground between late March and May. I think that + if 1.2 is at 1st June, then we need to go ahead with 2.5.8, and + if 2.6.0 comes early, consider defecting to it. Comments invited. + +revision: 199402121100 (v2) + .size was -1 in /usr/src/lib/libc/errlst.o, this choked ld(1), which + went into a spin. Fixed by pulling in stuff from osfrose.h. As a + consequence the patch against the gnu-dist changed. + I have made the linked compier static for now, this is a temporary + measure to curtail havoc when things break. It works just as fine + when linked dynamic. + +revision: 199402111700 (v1) + First released version. + diff --git a/gnu/usr.bin/cc25/gcc258-freebsd.patch b/gnu/usr.bin/cc25/gcc258-freebsd.patch new file mode 100644 index 000000000000..bcc8ef2728bd --- /dev/null +++ b/gnu/usr.bin/cc25/gcc258-freebsd.patch @@ -0,0 +1,1188 @@ +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/config/i386/freebsd.h gcc-2.5.8/config/i386/freebsd.h +*** gcc-2.5.8.gnu/config/i386/freebsd.h Thu Jan 1 01:00:00 1970 +--- gcc-2.5.8/config/i386/freebsd.h Sun Feb 27 00:40:55 1994 +*************** +*** 0 **** +--- 1,341 ---- ++ /* Configuration for an i386 running FreeBSD as the target machine. ++ * ++ * 7th feb 1994, Poul-Henning Kamp <phk@login.dkuug.dk> ++ * Made to fit FreeBSD 1.1 and GCC 2.5.8 ++ */ ++ ++ /* This goes away when the math-emulator is fixed */ ++ #define TARGET_CPU_DEFAULT 0400 /* TARGET_NO_FANCY_MATH_387 */ ++ ++ /* Just in case. (Cross-compilations &c) */ ++ #ifndef __FreeBSD__ ++ #define __FreeBSD__ 1 ++ #endif ++ ++ /* This is tested by i386gas.h. */ ++ #define YES_UNDERSCORES ++ ++ #include "i386/gstabs.h" ++ ++ /* Get perform_* macros to build libgcc.a. */ ++ #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 INCLUDE_DEFAULTS { \ ++ { "/usr/include", 0 }, \ ++ { "/usr/include/g++", 1 }, \ ++ { 0, 0} \ ++ } ++ ++ /* Like the default, except no -lg. */ ++ #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" ++ ++ #undef SIZE_TYPE ++ #define SIZE_TYPE "unsigned int" ++ ++ #undef PTRDIFF_TYPE ++ #define PTRDIFF_TYPE "int" ++ ++ #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"); \ ++ } \ ++ } ++ ++ /* There are conflicting reports about whether this system uses ++ a different assembler syntax. wilson@cygnus.com says # is right. */ ++ #undef COMMENT_BEGIN ++ #define COMMENT_BEGIN "#" ++ ++ #undef ASM_APP_ON ++ #define ASM_APP_ON "#APP\n" ++ ++ #undef ASM_APP_OFF ++ #define ASM_APP_OFF "#NO_APP\n" ++ ++ /* The following macros are stolen from i386v4.h */ ++ /* These have to be defined to get PIC code correct */ ++ ++ /* This is how to output an element of a case-vector that is relative. ++ This is only used for PIC code. See comments by the `casesi' insn in ++ i386.md for an explanation of the expression this outputs. */ ++ ++ #undef ASM_OUTPUT_ADDR_DIFF_ELT ++ #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ ++ fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) ++ ++ /* Indicate that jump tables go in the text section. This is ++ necessary when compiling PIC code. */ ++ ++ #define JUMP_TABLES_IN_TEXT_SECTION ++ ++ /* Don't default to pcc-struct-return, because gcc is the only compiler, and ++ we want to retain compatibility with older gcc versions. */ ++ #define DEFAULT_PCC_STRUCT_RETURN 0 ++ ++ /* ++ * Some imports from svr4.h in support of shared libraries. ++ * Currently, we need the DECLARE_OBJECT_SIZE stuff. ++ */ ++ ++ /* Define the strings used for the special svr4 .type and .size directives. ++ These strings generally do not vary from one system running svr4 to ++ another, but if a given system (e.g. m88k running svr) needs to use ++ different pseudo-op names for these, they may be overridden in the ++ file which includes this one. */ ++ ++ #define TYPE_ASM_OP ".type" ++ #define SIZE_ASM_OP ".size" ++ #define WEAK_ASM_OP ".weak" ++ ++ /* The following macro defines the format used to output the second ++ operand of the .type assembler directive. Different svr4 assemblers ++ expect various different forms for this operand. The one given here ++ is just a default. You may need to override it in your machine- ++ specific tm.h file (depending upon the particulars of your assembler). */ ++ ++ #define TYPE_OPERAND_FMT "@%s" ++ ++ /* 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. */ ++ ++ #ifndef ASM_DECLARE_RESULT ++ #define ASM_DECLARE_RESULT(FILE, RESULT) ++ #endif ++ ++ /* 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 ++ the starting labels for the relevant functions/objects. */ ++ ++ /* Write the extra assembler code needed to declare a function properly. ++ Some svr4 assemblers need to also have something extra said about the ++ function's return value. We allow for that here. */ ++ ++ #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ ++ do { \ ++ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ ++ assemble_name (FILE, NAME); \ ++ putc (',', FILE); \ ++ fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ ++ putc ('\n', FILE); \ ++ ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ ++ ASM_OUTPUT_LABEL(FILE, NAME); \ ++ } while (0) ++ ++ /* Write the extra assembler code needed to declare an object properly. */ ++ ++ #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ ++ do { \ ++ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ ++ assemble_name (FILE, NAME); \ ++ putc (',', FILE); \ ++ fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ ++ putc ('\n', FILE); \ ++ size_directive_output = 0; \ ++ if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ ++ { \ ++ 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))); \ ++ } \ ++ ASM_OUTPUT_LABEL(FILE, NAME); \ ++ } while (0) ++ ++ /* Output the size directive for a decl in rest_of_decl_compilation ++ in the case where we did not do so before the initializer. ++ Once we find the error_mark_node, we know that the value of ++ size_directive_output was set ++ 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. */ ++ ++ #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ ++ do { \ ++ if (!flag_inhibit_size_directive) \ ++ { \ ++ char label[256]; \ ++ static int labelno; \ ++ labelno++; \ ++ ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ ++ ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ ++ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ ++ assemble_name (FILE, (FNAME)); \ ++ fprintf (FILE, ","); \ ++ assemble_name (FILE, label); \ ++ fprintf (FILE, "-"); \ ++ assemble_name (FILE, (FNAME)); \ ++ putc ('\n', FILE); \ ++ } \ ++ } while (0) ++ ++ #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}" ++ #define LINK_SPEC \ ++ "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}" ++ ++ #define CUSTOM_DEFAULT_COMPILERS \ ++ /***** ljo's Fortran rule *****/ \ ++ {".f", "@f2c"}, \ ++ {"@f2c", \ ++ "f2c %{checksubscripts:-C} %{I2} %{onetrip} %{honorcase:-U} %{u} %{w}\ ++ %{ANSIC:-A} %{a} %{C++}\ ++ %{c} %{E} %{ec} %{ext} %{f} %{72} %{g} %{h} %{i2} %{kr}\ ++ %{P} %{p} %{r} %{r8} %{s} %{w8} %{z} %{N*}\ ++ %i %{!pipe: -o %g.c} %{pipe:-o -}|\n", \ ++ "gcpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\ ++ %{C:%{!E:%eGNU C does not support -C without using -E}}\ ++ %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d}\ ++ -undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\ ++ %{!undef:%{!ansi:%p} %P} %{trigraphs} \ ++ %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\ ++ %{traditional-cpp:-traditional}\ ++ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*}\ ++ %{pipe:-} %{!pipe:%g.c} %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", \ ++ "%{!M:%{!MM:%{!E:gcc1 %{!pipe:%g.i} %1 \ ++ %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a}\ ++ %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ ++ %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\ ++ %{aux-info*}\ ++ %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ ++ %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ ++ %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\ ++ %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\ ++ %{!pipe:%g.s} %A\n }}}}"}, \ ++ /***** End of ljo's Fortran rule *****/ ++ ++ /* This section stolen from i386/osfrose.h */ ++ ++ /* A C statement or compound statement to output to FILE some ++ assembler code to initialize basic-block profiling for the current ++ object module. This code should call the subroutine ++ `__bb_init_func' once per object module, passing it as its sole ++ argument the address of a block allocated in the object module. ++ ++ The name of the block is a local symbol made with this statement: ++ ++ ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); ++ ++ Of course, since you are writing the definition of ++ `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you ++ can take a short cut in the definition of this macro and use the ++ name that you know will result. ++ ++ The first word of this block is a flag which will be nonzero if the ++ object module has already been initialized. So test this word ++ first, and do not call `__bb_init_func' if the flag is nonzero. */ ++ ++ #undef FUNCTION_BLOCK_PROFILER ++ #define FUNCTION_BLOCK_PROFILER(STREAM, LABELNO) \ ++ do \ ++ { \ ++ if (!flag_pic) \ ++ { \ ++ fprintf (STREAM, "\tcmpl $0,%sPBX0\n", LPREFIX); \ ++ fprintf (STREAM, "\tjne 0f\n"); \ ++ fprintf (STREAM, "\tpushl $%sPBX0\n", LPREFIX); \ ++ fprintf (STREAM, "\tcall ___bb_init_func\n"); \ ++ fprintf (STREAM, "0:\n"); \ ++ } \ ++ else \ ++ { \ ++ fprintf (STREAM, "\tpushl %eax\n"); \ ++ fprintf (STREAM, "\tmovl %sPBX0@GOT(%ebx),%eax\n"); \ ++ fprintf (STREAM, "\tcmpl $0,(%eax)\n"); \ ++ fprintf (STREAM, "\tjne 0f\n"); \ ++ fprintf (STREAM, "\tpushl %eax\n"); \ ++ fprintf (STREAM, "\tcall ___bb_init_func@PLT\n"); \ ++ fprintf (STREAM, "0:\n"); \ ++ fprintf (STREAM, "\tpopl %eax\n"); \ ++ } \ ++ } \ ++ while (0) ++ ++ /* A C statement or compound statement to increment the count ++ associated with the basic block number BLOCKNO. Basic blocks are ++ numbered separately from zero within each compilation. The count ++ associated with block number BLOCKNO is at index BLOCKNO in a ++ vector of words; the name of this array is a local symbol made ++ with this statement: ++ ++ ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2); ++ ++ Of course, since you are writing the definition of ++ `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you ++ can take a short cut in the definition of this macro and use the ++ name that you know will result. */ ++ ++ #undef BLOCK_PROFILER ++ #define BLOCK_PROFILER(STREAM, BLOCKNO) \ ++ do \ ++ { \ ++ if (!flag_pic) \ ++ fprintf (STREAM, "\tincl %sPBX2+%d\n", LPREFIX, (BLOCKNO)*4); \ ++ else \ ++ { \ ++ fprintf (STREAM, "\tpushl %eax\n"); \ ++ fprintf (STREAM, "\tmovl %sPBX2@GOT(%ebx),%eax\n", LPREFIX); \ ++ fprintf (STREAM, "\tincl %d(%eax)\n", (BLOCKNO)*4); \ ++ fprintf (STREAM, "\tpopl %eax\n"); \ ++ } \ ++ } \ ++ while (0) ++ ++ /* 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. ++ * XXX Do these right ++ */ ++ ++ #ifdef FREEBSD_NATIVE ++ ++ #undef MD_EXEC_PREFIX ++ #define MD_EXEC_PREFIX "/usr/libexec/" ++ ++ #undef STANDARD_STARTFILE_PREFIX ++ #define STANDARD_STARTFILE_PREFIX "/usr/lib" ++ ++ #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 /* FREEBSD_NATIVE */ +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/config/i386/i386.h gcc-2.5.8/config/i386/i386.h +*** gcc-2.5.8.gnu/config/i386/i386.h Wed Oct 13 07:02:27 1993 +--- gcc-2.5.8/config/i386/i386.h Sun Feb 27 00:40:56 1994 +*************** +*** 90,95 **** +--- 90,99 ---- + the 387 to be used, which is compatible with most calling conventions. */ + #define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & 0200) + ++ /* Disable generation of FP sin, cos and sqrt operations for 387. ++ This is because FreeBSD lacks these in the math-emulator-code */ ++ #define TARGET_NO_FANCY_MATH_387 (target_flags & 0400) ++ + /* Macro to define tables used to set the flags. + This is a list in braces of pairs in braces, + each pair being { "NAME", VALUE } +*************** +*** 114,119 **** +--- 118,125 ---- + { "no-ieee-fp", -0100}, \ + { "fp-ret-in-387", 0200}, \ + { "no-fp-ret-in-387", -0200}, \ ++ { "no-fancy-math-387", 0400}, \ ++ { "fancy-math-387", -0400}, \ + SUBTARGET_SWITCHES \ + { "", TARGET_DEFAULT | TARGET_CPU_DEFAULT}} + +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/config/i386/i386.md gcc-2.5.8/config/i386/i386.md +*** gcc-2.5.8.gnu/config/i386/i386.md Tue Oct 5 06:43:30 1993 +--- gcc-2.5.8/config/i386/i386.md Sun Feb 27 00:40:59 1994 +*************** +*** 2935,3012 **** + (define_insn "sqrtsf2" + [(set (match_operand:SF 0 "register_operand" "=f") + (sqrt:SF (match_operand:SF 1 "general_operand" "0")))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fsqrt") + + (define_insn "sqrtdf2" + [(set (match_operand:DF 0 "register_operand" "=f") + (sqrt:DF (match_operand:DF 1 "general_operand" "0")))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fsqrt") + + (define_insn "" + [(set (match_operand:DF 0 "register_operand" "=f") + (sqrt:DF (float_extend:DF + (match_operand:SF 1 "general_operand" "0"))))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fsqrt") + + (define_insn "sqrtxf2" + [(set (match_operand:XF 0 "register_operand" "=f") + (sqrt:XF (match_operand:XF 1 "general_operand" "0")))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fsqrt") + + (define_insn "" + [(set (match_operand:XF 0 "register_operand" "=f") + (sqrt:XF (float_extend:XF + (match_operand:DF 1 "general_operand" "0"))))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fsqrt") + + (define_insn "" + [(set (match_operand:XF 0 "register_operand" "=f") + (sqrt:XF (float_extend:XF + (match_operand:SF 1 "general_operand" "0"))))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fsqrt") + + (define_insn "sindf2" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 1))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fsin") + + (define_insn "sinsf2" + [(set (match_operand:SF 0 "register_operand" "=f") + (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 1))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fsin") + + (define_insn "" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(float_extend:DF + (match_operand:SF 1 "register_operand" "0"))] 1))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fsin") + + (define_insn "cosdf2" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 2))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fcos") + + (define_insn "cossf2" + [(set (match_operand:SF 0 "register_operand" "=f") + (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 2))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fcos") + + (define_insn "" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(float_extend:DF + (match_operand:SF 1 "register_operand" "0"))] 2))] +! "TARGET_80387 && (TARGET_IEEE_FP || flag_fast_math)" + "fcos") + + ;;- one complement instructions +--- 2935,3024 ---- + (define_insn "sqrtsf2" + [(set (match_operand:SF 0 "register_operand" "=f") + (sqrt:SF (match_operand:SF 1 "general_operand" "0")))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fsqrt") + + (define_insn "sqrtdf2" + [(set (match_operand:DF 0 "register_operand" "=f") + (sqrt:DF (match_operand:DF 1 "general_operand" "0")))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fsqrt") + + (define_insn "" + [(set (match_operand:DF 0 "register_operand" "=f") + (sqrt:DF (float_extend:DF + (match_operand:SF 1 "general_operand" "0"))))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fsqrt") + + (define_insn "sqrtxf2" + [(set (match_operand:XF 0 "register_operand" "=f") + (sqrt:XF (match_operand:XF 1 "general_operand" "0")))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fsqrt") + + (define_insn "" + [(set (match_operand:XF 0 "register_operand" "=f") + (sqrt:XF (float_extend:XF + (match_operand:DF 1 "general_operand" "0"))))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fsqrt") + + (define_insn "" + [(set (match_operand:XF 0 "register_operand" "=f") + (sqrt:XF (float_extend:XF + (match_operand:SF 1 "general_operand" "0"))))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fsqrt") + + (define_insn "sindf2" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 1))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fsin") + + (define_insn "sinsf2" + [(set (match_operand:SF 0 "register_operand" "=f") + (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 1))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fsin") + + (define_insn "" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(float_extend:DF + (match_operand:SF 1 "register_operand" "0"))] 1))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fsin") + + (define_insn "cosdf2" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 2))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fcos") + + (define_insn "cossf2" + [(set (match_operand:SF 0 "register_operand" "=f") + (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 2))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fcos") + + (define_insn "" + [(set (match_operand:DF 0 "register_operand" "=f") + (unspec:DF [(float_extend:DF + (match_operand:SF 1 "register_operand" "0"))] 2))] +! "(!TARGET_NO_FANCY_MATH_387) && TARGET_80387 && +! (TARGET_IEEE_FP || flag_fast_math) " + "fcos") + + ;;- one complement instructions +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/config.guess gcc-2.5.8/config.guess +*** gcc-2.5.8.gnu/config.guess Sun Dec 12 12:50:10 1993 +--- gcc-2.5.8/config.guess Sun Feb 27 00:41:00 1994 +*************** +*** 171,176 **** +--- 171,179 ---- + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; ++ i[34]86:FreeBSD:*:*) ++ echo ${UNAME_MACHINE}-unknown-freebsd ++ exit 0 ;; + i[34]86:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd${UNAME_RELEASE} + exit 0 ;; +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/config.sub gcc-2.5.8/config.sub +*** gcc-2.5.8.gnu/config.sub Thu Jan 13 11:43:23 1994 +--- gcc-2.5.8/config.sub Sun Feb 27 00:41:00 1994 +*************** +*** 534,540 **** + | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \ + | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \ + | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \ +! | -hiux* | -386bsd* | -netbsd* | -riscix* | -lynxos*) + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` +--- 534,540 ---- + | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \ + | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \ + | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \ +! | -hiux* | -386bsd* | -netbsd* | -riscix* | -lynxos* | -freebsd*) + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/configure gcc-2.5.8/configure +*** gcc-2.5.8.gnu/configure Fri Nov 19 22:44:16 1993 +--- gcc-2.5.8/configure Sun Feb 27 00:41:03 1994 +*************** +*** 385,390 **** +--- 385,394 ---- + tmake_file=i386/t-next + xmake_file=i386/x-next + ;; ++ i[34]86-*-freebsd*) ++ cpu_type=i386 ++ tm_file=i386/freebsd.h ++ ;; + i[34]86-*-bsd*) + cpu_type=i386 + tm_file=i386/386bsd.h +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/expmed.c gcc-2.5.8/expmed.c +*** gcc-2.5.8.gnu/expmed.c Sun Nov 14 04:50:40 1993 +--- gcc-2.5.8/expmed.c Sun Feb 27 22:17:01 1994 +*************** +*** 1,6 **** + /* Medium-level subroutines: convert bit-field store and extract + and shifts, multiplies and divides to rtl instructions. +! Copyright (C) 1987, 1988, 1989, 1992, 1993 Free Software Foundation, Inc. + + This file is part of GNU CC. + +--- 1,6 ---- + /* Medium-level subroutines: convert bit-field store and extract + and shifts, multiplies and divides to rtl instructions. +! Copyright (C) 1987, 88, 89, 92, 93, 1994 Free Software Foundation, Inc. + + This file is part of GNU CC. + +*************** +*** 421,427 **** + /* If xop0 is a register, we need it in MAXMODE + to make it acceptable to the format of insv. */ + if (GET_CODE (xop0) == SUBREG) +! PUT_MODE (xop0, maxmode); + if (GET_CODE (xop0) == REG && GET_MODE (xop0) != maxmode) + xop0 = gen_rtx (SUBREG, maxmode, xop0, 0); + +--- 421,429 ---- + /* If xop0 is a register, we need it in MAXMODE + to make it acceptable to the format of insv. */ + if (GET_CODE (xop0) == SUBREG) +! /* We can't just change the mode, because this might clobber op0, +! and we will need the original value of op0 if insv fails. */ +! xop0 = gen_rtx (SUBREG, maxmode, SUBREG_REG (xop0), SUBREG_WORD (xop0)); + if (GET_CODE (xop0) == REG && GET_MODE (xop0) != maxmode) + xop0 = gen_rtx (SUBREG, maxmode, xop0, 0); + +*************** +*** 556,561 **** +--- 558,573 ---- + + total_bits = GET_MODE_BITSIZE (mode); + ++ /* Make sure bitpos is valid for the chosen mode. Adjust BITPOS to ++ be be in the range 0 to total_bits-1, and put any excess bytes in ++ OFFSET. */ ++ if (bitpos >= total_bits) ++ { ++ offset += (bitpos / total_bits) * (total_bits / BITS_PER_UNIT); ++ bitpos -= ((bitpos / total_bits) * (total_bits / BITS_PER_UNIT) ++ * BITS_PER_UNIT); ++ } ++ + /* Get ref to an aligned byte, halfword, or word containing the field. + Adjust BITPOS to be position within a word, + and OFFSET to be the offset of that word. +*************** +*** 691,697 **** + { + rtx word = gen_lowpart_common (word_mode, value); + +! if (word) + value = word; + else + value = gen_lowpart_common (word_mode, +--- 703,709 ---- + { + rtx word = gen_lowpart_common (word_mode, value); + +! if (word && (value != word)) + value = word; + else + value = gen_lowpart_common (word_mode, +*************** +*** 721,731 **** + >> (bitsize - bitsdone - thissize)) + & (((HOST_WIDE_INT) 1 << thissize) - 1)); + else +! /* The args are chosen so that the last part +! includes the lsb. */ +! part = extract_fixed_bit_field (word_mode, value, 0, thissize, +! BITS_PER_WORD - bitsize + bitsdone, +! NULL_RTX, 1, align); + #else + /* Fetch successively more significant portions. */ + if (GET_CODE (value) == CONST_INT) +--- 733,751 ---- + >> (bitsize - bitsdone - thissize)) + & (((HOST_WIDE_INT) 1 << thissize) - 1)); + else +! { +! /* The args are chosen so that the last part +! includes the lsb. */ +! int bit_offset = 0; +! /* If the value isn't in memory, then it must be right aligned +! if a register, so skip past the padding on the left. If it +! is in memory, then there is no padding on the left. */ +! if (GET_CODE (value) != MEM) +! bit_offset = BITS_PER_WORD - bitsize; +! part = extract_fixed_bit_field (word_mode, value, 0, thissize, +! bit_offset + bitsdone, +! NULL_RTX, 1, align); +! } + #else + /* Fetch successively more significant portions. */ + if (GET_CODE (value) == CONST_INT) +*************** +*** 1592,1597 **** +--- 1612,1625 ---- + + op1 = expand_expr (amount, NULL_RTX, VOIDmode, 0); + ++ #if SHIFT_COUNT_TRUNCATED ++ if (SHIFT_COUNT_TRUNCATED ++ && GET_CODE (op1) == CONST_INT ++ && (unsigned HOST_WIDE_INT) INTVAL (op1) >= GET_MODE_BITSIZE (mode)) ++ op1 = GEN_INT ((unsigned HOST_WIDE_INT) INTVAL (op1) ++ % GET_MODE_BITSIZE (mode)); ++ #endif ++ + if (op1 == const0_rtx) + return shifted; + +*************** +*** 1843,1852 **** + int cost_limit; + { + int m; +! struct algorithm *best_alg +! = (struct algorithm *)alloca (sizeof (struct algorithm)); +! struct algorithm *alg_in +! = (struct algorithm *)alloca (sizeof (struct algorithm)); + unsigned int cost; + unsigned HOST_WIDE_INT q; + +--- 1871,1877 ---- + int cost_limit; + { + int m; +! struct algorithm *alg_in, *best_alg; + unsigned int cost; + unsigned HOST_WIDE_INT q; + +*************** +*** 1881,1886 **** +--- 1906,1916 ---- + } + } + ++ /* We'll be needing a couple extra algorithm structures now. */ ++ ++ alg_in = (struct algorithm *)alloca (sizeof (struct algorithm)); ++ best_alg = (struct algorithm *)alloca (sizeof (struct algorithm)); ++ + /* If we have a group of zero bits at the low-order part of T, try + multiplying by the remaining bits and then doing a shift. */ + +*************** +*** 2043,2058 **** + } + } + +- /* If we are getting a too long sequence for `struct algorithm' +- to record, make this search fail. */ +- if (best_alg->ops == MAX_BITS_PER_WORD) +- return; +- + /* If cost_limit has not decreased since we stored it in alg_out->cost, + we have not found any algorithm. */ + if (cost_limit == alg_out->cost) + return; + + /* Copy the algorithm from temporary space to the space at alg_out. + We avoid using structure assignment because the majority of + best_alg is normally undefined, and this is a critical function. */ +--- 2073,2088 ---- + } + } + + /* If cost_limit has not decreased since we stored it in alg_out->cost, + we have not found any algorithm. */ + if (cost_limit == alg_out->cost) + return; + ++ /* If we are getting a too long sequence for `struct algorithm' ++ to record, make this search fail. */ ++ if (best_alg->ops == MAX_BITS_PER_WORD) ++ return; ++ + /* Copy the algorithm from temporary space to the space at alg_out. + We avoid using structure assignment because the majority of + best_alg is normally undefined, and this is a critical function. */ +*************** +*** 2153,2161 **** + for (opno = 1; opno < alg.ops; opno++) + { + int log = alg.log[opno]; +! rtx shift_subtarget = preserve_subexpressions_p () ? 0 : accum; + rtx add_target = opno == alg.ops - 1 && target != 0 ? target : 0; +! + switch (alg.op[opno]) + { + case alg_shift: +--- 2183,2193 ---- + for (opno = 1; opno < alg.ops; opno++) + { + int log = alg.log[opno]; +! int preserve = preserve_subexpressions_p (); +! rtx shift_subtarget = preserve ? 0 : accum; + rtx add_target = opno == alg.ops - 1 && target != 0 ? target : 0; +! rtx accum_target = preserve ? 0 : accum; +! + switch (alg.op[opno]) + { + case alg_shift: +*************** +*** 2168,2174 **** + tem = expand_shift (LSHIFT_EXPR, mode, op0, + build_int_2 (log, 0), NULL_RTX, 0); + accum = force_operand (gen_rtx (PLUS, mode, accum, tem), +! add_target ? add_target : accum); + val_so_far += (HOST_WIDE_INT) 1 << log; + break; + +--- 2200,2206 ---- + tem = expand_shift (LSHIFT_EXPR, mode, op0, + build_int_2 (log, 0), NULL_RTX, 0); + accum = force_operand (gen_rtx (PLUS, mode, accum, tem), +! add_target ? add_target : accum_target); + val_so_far += (HOST_WIDE_INT) 1 << log; + break; + +*************** +*** 2176,2198 **** + tem = expand_shift (LSHIFT_EXPR, mode, op0, + build_int_2 (log, 0), NULL_RTX, 0); + accum = force_operand (gen_rtx (MINUS, mode, accum, tem), +! add_target ? add_target : accum); + val_so_far -= (HOST_WIDE_INT) 1 << log; + break; + + case alg_add_t2_m: + accum = expand_shift (LSHIFT_EXPR, mode, accum, +! build_int_2 (log, 0), accum, 0); + accum = force_operand (gen_rtx (PLUS, mode, accum, op0), +! add_target ? add_target : accum); + val_so_far = (val_so_far << log) + 1; + break; + + case alg_sub_t2_m: + accum = expand_shift (LSHIFT_EXPR, mode, accum, +! build_int_2 (log, 0), accum, 0); + accum = force_operand (gen_rtx (MINUS, mode, accum, op0), +! add_target ? add_target : accum); + val_so_far = (val_so_far << log) - 1; + break; + +--- 2208,2232 ---- + tem = expand_shift (LSHIFT_EXPR, mode, op0, + build_int_2 (log, 0), NULL_RTX, 0); + accum = force_operand (gen_rtx (MINUS, mode, accum, tem), +! add_target ? add_target : accum_target); + val_so_far -= (HOST_WIDE_INT) 1 << log; + break; + + case alg_add_t2_m: + accum = expand_shift (LSHIFT_EXPR, mode, accum, +! build_int_2 (log, 0), shift_subtarget, +! 0); + accum = force_operand (gen_rtx (PLUS, mode, accum, op0), +! add_target ? add_target : accum_target); + val_so_far = (val_so_far << log) + 1; + break; + + case alg_sub_t2_m: + accum = expand_shift (LSHIFT_EXPR, mode, accum, +! build_int_2 (log, 0), shift_subtarget, +! 0); + accum = force_operand (gen_rtx (MINUS, mode, accum, op0), +! add_target ? add_target : accum_target); + val_so_far = (val_so_far << log) - 1; + break; + +*************** +*** 2200,2206 **** + tem = expand_shift (LSHIFT_EXPR, mode, accum, + build_int_2 (log, 0), NULL_RTX, 0); + accum = force_operand (gen_rtx (PLUS, mode, accum, tem), +! add_target ? add_target : accum); + val_so_far += val_so_far << log; + break; + +--- 2234,2240 ---- + tem = expand_shift (LSHIFT_EXPR, mode, accum, + build_int_2 (log, 0), NULL_RTX, 0); + accum = force_operand (gen_rtx (PLUS, mode, accum, tem), +! add_target ? add_target : accum_target); + val_so_far += val_so_far << log; + break; + +*************** +*** 2208,2214 **** + tem = expand_shift (LSHIFT_EXPR, mode, accum, + build_int_2 (log, 0), NULL_RTX, 0); + accum = force_operand (gen_rtx (MINUS, mode, tem, accum), +! add_target ? add_target : tem); + val_so_far = (val_so_far << log) - val_so_far; + break; + +--- 2242,2249 ---- + tem = expand_shift (LSHIFT_EXPR, mode, accum, + build_int_2 (log, 0), NULL_RTX, 0); + accum = force_operand (gen_rtx (MINUS, mode, tem, accum), +! (add_target ? add_target +! : preserve ? 0 : tem)); + val_so_far = (val_so_far << log) - val_so_far; + break; + +*************** +*** 3196,3198 **** +--- 3231,3234 ---- + + return tem; + } ++ +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/gcc.c gcc-2.5.8/gcc.c +*** gcc-2.5.8.gnu/gcc.c Thu Dec 23 23:49:43 1993 +--- gcc-2.5.8/gcc.c Sun Feb 27 00:41:06 1994 +*************** +*** 586,591 **** +--- 586,594 ---- + "%{!S:%{!gnatc:%{!gnats:as %{R} %{j} %{J} %{h} %{d2} %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\ + %{!pipe:%g.s} %A\n}}} "}, ++ #ifdef CUSTOM_DEFAULT_COMPILERS ++ CUSTOM_DEFAULT_COMPILERS ++ #endif /* CUSTOM_DEFAULT_COMPILERS */ + /* Mark end of table */ + {0, 0} + }; +*************** +*** 608,614 **** + static char *link_command_spec = "\ + %{!fsyntax-only: \ + %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ +! %{r} %{s} %{t} %{u*} %{x} %{z}\ + %{!A:%{!nostartfiles:%{!nostdlib:%S}}} %{static:}\ + %{L*} %D %{T*} %o %{!nostdlib:libgcc.a%s %L libgcc.a%s %{!A:%E}}\n }}}}}}"; + #else +--- 611,617 ---- + static char *link_command_spec = "\ + %{!fsyntax-only: \ + %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ +! %{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\ + %{!A:%{!nostartfiles:%{!nostdlib:%S}}} %{static:}\ + %{L*} %D %{T*} %o %{!nostdlib:libgcc.a%s %L libgcc.a%s %{!A:%E}}\n }}}}}}"; + #else +*************** +*** 617,623 **** + static char *link_command_spec = "\ + %{!fsyntax-only: \ + %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ +! %{r} %{s} %{t} %{u*} %{x} %{z}\ + %{!A:%{!nostartfiles:%{!nostdlib:%S}}} %{static:}\ + %{L*} %{T*} %o %{!nostdlib:libgcc.a%s %L libgcc.a%s %{!A:%E}}\n }}}}}}"; + #else +--- 620,626 ---- + static char *link_command_spec = "\ + %{!fsyntax-only: \ + %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ +! %{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\ + %{!A:%{!nostartfiles:%{!nostdlib:%S}}} %{static:}\ + %{L*} %{T*} %o %{!nostdlib:libgcc.a%s %L libgcc.a%s %{!A:%E}}\n }}}}}}"; + #else +*************** +*** 625,631 **** + static char *link_command_spec = "\ + %{!fsyntax-only: \ + %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ +! %{r} %{s} %{t} %{u*} %{x} %{z}\ + %{!A:%{!nostartfiles:%{!nostdlib:%S}}} %{static:}\ + %{L*} %D %{T*} %o %{!nostdlib:-lgcc %L -lgcc %{!A:%E}}\n }}}}}}"; + #endif +--- 628,634 ---- + static char *link_command_spec = "\ + %{!fsyntax-only: \ + %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ +! %{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\ + %{!A:%{!nostartfiles:%{!nostdlib:%S}}} %{static:}\ + %{L*} %D %{T*} %o %{!nostdlib:-lgcc %L -lgcc %{!A:%E}}\n }}}}}}"; + #endif +*************** +*** 3202,3224 **** + { + if (! strncmp (y, "-D", 2)) + { +! *x++ = *y++; +! *x++ = *y++; + + if (strncmp (y, "__", 2)) + { + /* Stick __ at front of macro name. */ + *x++ = '_'; + *x++ = '_'; +- } +- +- /* Copy the macro name. */ +- while (*y && *y != '=' && *y != ' ' && *y != '\t') +- *x++ = *y++; + +! /* Copy the value given, if any. */ +! while (*y && *y != ' ' && *y != '\t') +! *x++ = *y++; + } + else if (*y == ' ' || *y == '\t') + /* Copy whitespace to the result. */ +--- 3205,3235 ---- + { + if (! strncmp (y, "-D", 2)) + { +! y++; +! y++; + + if (strncmp (y, "__", 2)) + { ++ *x++ = '-'; ++ *x++ = 'D'; + /* Stick __ at front of macro name. */ + *x++ = '_'; + *x++ = '_'; + +! /* Copy the macro name. */ +! while (*y && *y != '=' && *y != ' ' && *y != '\t') +! *x++ = *y++; +! +! /* Copy the value given, if any. */ +! while (*y && *y != ' ' && *y != '\t') +! *x++ = *y++; +! } +! else +! { +! /* Skip this one, we have done it once already */ +! while (*y && *y != ' ' && *y != '\t') +! y++; +! } + } + else if (*y == ' ' || *y == '\t') + /* Copy whitespace to the result. */ +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/gstdarg.h gcc-2.5.8/gstdarg.h +*** gcc-2.5.8.gnu/gstdarg.h Sat Nov 13 02:53:58 1993 +--- gcc-2.5.8/gstdarg.h Sun Feb 27 00:41:06 1994 +*************** +*** 136,148 **** + But on BSD NET2 we must not test or define or undef it. + (Note that the comments in NET 2's ansi.h + are incorrect for _VA_LIST_--see stdio.h!) */ +! #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) + /* The macro _VA_LIST is used in SCO Unix 3.2. */ + #ifndef _VA_LIST + /* The macro _VA_LIST_T_H is used in the Bull dpx2 */ + #ifndef _VA_LIST_T_H + #define _VA_LIST_T_H +! #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__)) + #define _VA_LIST_ + #endif + #define _VA_LIST +--- 136,148 ---- + But on BSD NET2 we must not test or define or undef it. + (Note that the comments in NET 2's ansi.h + are incorrect for _VA_LIST_--see stdio.h!) */ +! #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__FreeBSD__) + /* The macro _VA_LIST is used in SCO Unix 3.2. */ + #ifndef _VA_LIST + /* The macro _VA_LIST_T_H is used in the Bull dpx2 */ + #ifndef _VA_LIST_T_H + #define _VA_LIST_T_H +! #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__FreeBSD__)) + #define _VA_LIST_ + #endif + #define _VA_LIST +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/gstddef.h gcc-2.5.8/gstddef.h +*** gcc-2.5.8.gnu/gstddef.h Fri Dec 3 12:46:59 1993 +--- gcc-2.5.8/gstddef.h Sun Feb 27 00:41:07 1994 +*************** +*** 22,28 **** + + /* 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____) + #include <machine/ansi.h> + #endif + +--- 22,28 ---- + + /* 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__) + #include <machine/ansi.h> + #endif + +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/gvarargs.h gcc-2.5.8/gvarargs.h +*** gcc-2.5.8.gnu/gvarargs.h Sat Nov 13 09:33:23 1993 +--- gcc-2.5.8/gvarargs.h Sun Feb 27 00:41:07 1994 +*************** +*** 150,162 **** + /* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993: + Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to + use for va_list (``typedef _VA_LIST_ va_list'') */ +! #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) + /* The macro _VA_LIST is used in SCO Unix 3.2. */ + #ifndef _VA_LIST + /* The macro _VA_LIST_T_H is used in the Bull dpx2 */ + #ifndef _VA_LIST_T_H + #define _VA_LIST_T_H +! #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__)) + #define _VA_LIST_ + #endif + #define _VA_LIST +--- 150,162 ---- + /* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993: + Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to + use for va_list (``typedef _VA_LIST_ va_list'') */ +! #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) + /* The macro _VA_LIST is used in SCO Unix 3.2. */ + #ifndef _VA_LIST + /* The macro _VA_LIST_T_H is used in the Bull dpx2 */ + #ifndef _VA_LIST_T_H + #define _VA_LIST_T_H +! #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__)) + #define _VA_LIST_ + #endif + #define _VA_LIST +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/invoke.texi gcc-2.5.8/invoke.texi +*** gcc-2.5.8.gnu/invoke.texi Thu Nov 11 14:31:43 1993 +--- gcc-2.5.8/invoke.texi Sun Feb 27 00:41:10 1994 +*************** +*** 252,258 **** + + @emph{i386 Options} + -m486 -mno-486 -msoft-float -msvr3-shlib -mieee-fp +! -mno-fp-ret-in-387 + + @emph{HPPA Options} + -mpa-risc-1-0 +--- 252,258 ---- + + @emph{i386 Options} + -m486 -mno-486 -msoft-float -msvr3-shlib -mieee-fp +! -mno-fp-ret-in-387 -mno-fancy-math-387 + + @emph{HPPA Options} + -mpa-risc-1-0 +*************** +*** 3090,3095 **** +--- 3090,3103 ---- + + The option @samp{-mno-fp-ret-in-387} causes such values to be returned + in ordinary CPU registers instead. ++ ++ @item -mno-fancy-math-387 ++ Do not generate sin, cos and sqrt instructions to the 387. ++ ++ Some 387-emulators are less complete than one would expect, and usually ++ the hard parts are missing, this option fixes one such case for the ++ FreeBSD OS, where this option is set as default. ++ + @c FIXME!! What about these options listed in @node Option Summary ?? + @c -msvr3-shlib -mieee-fp + @end table +diff -C3 -r --unidirectional-new-file gcc-2.5.8.gnu/objc/objects.c gcc-2.5.8/objc/objects.c +*** gcc-2.5.8.gnu/objc/objects.c Thu Nov 18 09:07:33 1993 +--- gcc-2.5.8/objc/objects.c Sun Feb 27 00:41:11 1994 +*************** +*** 24,30 **** + however invalidate any other reasons why the executable file might be + covered by the GNU General Public License. */ + +! #include "../tconfig.h" /* include defs of bzero for target */ + #include "runtime.h" /* the kitchen sink */ + + id __objc_object_alloc(Class*); +--- 24,30 ---- + however invalidate any other reasons why the executable file might be + covered by the GNU General Public License. */ + +! #include "tconfig.h" /* include defs of bzero for target */ + #include "runtime.h" /* the kitchen sink */ + + id __objc_object_alloc(Class*); diff --git a/gnu/usr.bin/cc25/gnu2bsd.tcl b/gnu/usr.bin/cc25/gnu2bsd.tcl new file mode 100755 index 000000000000..66644f028e30 --- /dev/null +++ b/gnu/usr.bin/cc25/gnu2bsd.tcl @@ -0,0 +1,470 @@ +#!/usr/local/bin/tclsh +# +# This Tcl script tries to build a GCC-source in a BSD-structured tree from +# the GNU-structured one. This code isn't for people with faint hearts. +# +# "Med dens egne Vaaben skal jeg tugte Hoben, +# som med Skrig og Raaben bryder Byens Fred. +# Se engang til Taaben, +# som med Munden aaben glor paa mig med Maaben." +# +# Fra Carl Nielsens "Maskerade". +# +# To change something in gcc for FreeBSD use this plan: +# 1. modify the GNU-gcc distribution as needed. +# 2. modify this script as needed. +# 3. run this script +# 4. try the result, goto 1 until you got it right. +# 5. send a patch to the GNU people ! +# +# Written Jan/Feb 1994 by Poul-Henning Kamp <phk@login.dkuug.dk> +# For FreeBSD 1.0 and 1.1 versus GCC 2.5.8 +# Also seems to work for GCC.2.4.5 +# +# In case GNU changes the setup of their tree (again), this code will loose +# badly. I have parameterized as much as possible, but a lot of Makefiles +# get made inline in the code. Good luck. +############################################################################# +# Tweakable things, set for GCC 2.5.8, below they can be enabled for 2.4.5 + +# TWEAK: Which GCC version ? +set ver 2.5.8 + +# TWEAK: Where is the GNU-tree ? +set gnu /phk/tmp/gcc-2.5.8 + +# TWEAK: Where is the BSD-tree ? +set bsd . + +# TWEAK: Whats the names in the GNU Makefile of the programs. +set pgm {cc1 cc1plus cc1obj cccp xgcc g++} + +# TWEAK: Where should the programs be installed +set pgm_install(cc1) /usr/libexec/cc1 +set pgm_install(cc1plus) /usr/libexec/cc1plus +set pgm_install(cc1obj) /usr/libexec/cc1obj +set pgm_install(cccp) /usr/libexec/cpp +set pgm_install(xgcc) /usr/bin/gcc +set pgm_install(g++) /usr/bin/g++ + +# TWEAK: What links to make to each program +set pgm_link(xgcc) /usr/bin/cc +set pgm_link(g++) /usr/bin/c++ +set pgm_link(cccp) { /usr/libexec/gccp } + +# TWEAK: What is the man.1 file named in the GNU-dist +set pgm_man1(xgcc) gcc.1 +set pgm_man1(g++) g++.1 +set pgm_man1(cccp) cccp.1 + +# TWEAK: What names should the man-page be installed under +set pgm_dst1(xgcc) {gcc.1 cc.1} +set pgm_dst1(g++) {g++.1 c++.1} +set pgm_dst1(cccp) {cpp.1} + +# TWEAK: What files must be explicitly installed ? +set config {i386/gstabs.h i386/perform.h i386/gas.h i386/i386.h i386/bsd.h + i386/freebsd.h i386/unix.h cp-input.c bc-opcode.h bc-arity.h + config.status md insn-attr.h insn-flags.h insn-codes.h c-parse.h} + + +############################################################################ +# For gcc-2.4.5 we simply overwrite some of the tweaks... + +if {$ver == "2.4.5"} { + set gnu /usr/tmp/gcc-2.4.5 + set bsd cc245 + set pgm {cc1 cc1plus cc1obj cccp xgcc} + set config {i386/gstabs.h i386/perform.h i386/gas.h i386/i386.h i386/bsd.h + i386/386bsd.h i386/unix.h cp-input.c config.status md insn-attr.h + insn-flags.h insn-codes.h c-parse.h} +} + +############################################################################ + +# Try to make the GNU-Makefile produce a file for us. +proc makefile {name} { + global gnu + puts "------> Trying to make $name <-----" + flush stdout + catch {exec sh -c "cd $gnu ; make $name" >&@ stdout} +} + +# Locate a source file, possibly making it on the fly. +proc find_source {name} { + global gnu + set n1 $name + regsub {\.o$} $n1 {.c} n1 + if {[file exists $gnu/$n1]} {return $n1} + makefile $n1 + if {[file exists $gnu/$n1]} {return $n1} + makefile $name + if {[file exists $gnu/$n1]} {return $n1} + puts stderr " +find_source cannot locate or make a \"$n1\" for \"$name\" +" + exit 1 +} + +# Define a macro in a makefile, to contain MANY files. +proc write_names {fd mac lst {suf ""}} { + set lst [lsort $lst] + set a "$mac =\t" + for {set i 0} {$i < [llength $lst]} {} { + set j [lindex $lst $i]$suf + if {[string length $a]+[string length $j]+1 < 68} { + lappend a $j + incr i + continue; + } + puts $fd "$a \\" + set a "\t" + } + puts $fd "$a" +} + +############################################################################ +# +# "Som en Samson skal jeg samle +# Kraften i mit Styrkebaelte, +# jeg skal gaa til deres Telte, +# deres Stoetter skal jeg vaelte, +# deres Tag skal sammen ramle, +# om i Moerket skal de famle, +# deres Knokkelrad skal skramle, +# deres Rygmarv skal jeg smaelte, +# deres Hjerne skal jeg aelte !" +# +# Fra Carl Nielsens "Maskerade". + +puts "2bsd from $gnu to $bsd" + +puts "Remove old directories if any, and create new ones." + +# In case the BSD dir isn't there: +catch {exec mkdir $bsd} + +# Throw the BSD/gcc_int dir away, and make a fresh. +catch {exec sh -c "rm -rf $bsd/gcc_int ; mkdir $bsd/gcc_int $bsd/gcc_int/i386"} + +# Throw the BSD/libgcc dir away, and make a fresh. +catch {exec sh -c "rm -rf $bsd/libgcc ; mkdir $bsd/libgcc"} + +# Throw the BSD/libobjc dir away, and make a fresh. +catch {exec sh -c "rm -rf $bsd/libobjc ; mkdir $bsd/libobjc"} + +# Throw the BSD/$pgm dirs away too, and make some fresh. +foreach i $pgm {catch {exec sh -c "rm -rf $bsd/$i ; mkdir $bsd/$i"}} + +puts "Check that $gnu directory is configured." + +# configure makes this file, which we can use to check +if {![file exists $gnu/config.status]} { + puts stderr " +Please go to the $gnu directory and execute these two commands: + make distclean + configure +Then restart this program. +" + exit 1 +} + +if 1 { +# XXX +puts "Create $bsd/libgcc" + +# Make a temporary Makefile in the GNU-tree +exec cp $gnu/Makefile $gnu/2bsd.t02 + +# Add targets to tell us what we want to know +set fi [open $gnu/2bsd.t02 a] +puts $fi "\nFo1:\n\t@echo \$(LIB1FUNCS)" +puts $fi "\nFo2:\n\t@echo \$(LIB2FUNCS)" +close $fi + +# Try it out... +set t01 [exec sh -c "( cd $gnu ; make -f 2bsd.t02 Fo1)"] +set t02 [exec sh -c "( cd $gnu ; make -f 2bsd.t02 Fo2)"] + +# Remove it again +exec rm -f $gnu/2bsd.t02 + +# Copy the sources +exec cp $gnu/libgcc1.c $gnu/libgcc2.c $bsd/libgcc + +# Create the Makefile +set fo [open $bsd/libgcc/Makefile w] +puts $fo { +LIB = gcc +NOPROFILE = 1 +SHLIB_MAJOR= 1 +SHLIB_MINOR= 0 + +CFLAGS += -I$(.CURDIR)/../gcc_int -DFREEBSD_NATIVE +} + +write_names $fo LIB1OBJS $t01 .o +write_names $fo LIB2OBJS $t02 .o +puts $fo { +OBJS= ${LIB1OBJS} ${LIB2OBJS} +LIB1SOBJS=${LIB1OBJS:.o=.so} +LIB2SOBJS=${LIB2OBJS:.o=.so} + +${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 + +.include <bsd.lib.mk> +} + +close $fo + +# Try to find out which .o files goes into which programs. +foreach i $pgm { + + puts "Disecting $i." + + # Try to snatch the link-stmt from the GNU-Makefile + set t01 [exec grep " *-o *$i *" $gnu/Makefile] + + # Make a temporary Makefile in the GNU-tree + exec cp $gnu/Makefile $gnu/2bsd.t02 + + # Add a target to tell us what we want to know + set fi [open $gnu/2bsd.t02 a] + puts $fi "\nFoO:\n\t@echo $t01" + close $fi + + # Try it out... + set t02 [exec sh -c "( cd $gnu ; make -f 2bsd.t02 FoO)"] + + # Remove it again + exec rm -f $gnu/2bsd.t02 + + # Extract the .o files from it. + set o "" + foreach j $t02 { + if {[regexp {\.o$} $j]} { + lappend o $j + # count the number of times each is used. + if {[catch {incr t04($j)} x]} {set t04($j) 1} + } + # Save that goes into this program + set t05($i) $o + } +} + +# get a sorted list of all known objects +set l [lsort [array names t04]] + +puts "Copy source files to $bsd/gcc_int" + +# What goes into the libgcc_int ? +set lib "" +foreach i $l { + # Used more than once, and we take it. + if {$t04($i) > 1} { + set s [find_source $i] + lappend lib $s + # Copy the file + exec cp $gnu/$s $bsd/gcc_int + } +} + +puts "Creating Makefile in $bsd/gcc_int" +set fo [open $bsd/gcc_int/Makefile w] + +# Define SRCS to all the sourcefiles. +write_names $fo SRCS $lib + +# Put the rest in there. +set lv [split $ver .] + +# Shared-lib code-gen. Will not work without much coding. +#puts $fo "SHLIB_MAJOR = [format %d%02d [lindex $lv 0] [lindex $lv 1]]" +#puts $fo "SHLIB_MINOR = [lindex $lv 2]" +# REQ's patch to /usr/share/mk/bsd.lib.mk XXX +#puts $fo "NOSTATIC = 1" + +puts $fo { +LIB = gcc_int +NOPROFILE = 1 +CFLAGS += -I$(.CURDIR) -DFREEBSD_NATIVE + +install: + @true + +.include <bsd.lib.mk> + +} +close $fo + +# Now for each of the programs in turn +foreach i $pgm { + puts "Copy source files to $bsd/$i" + set o "" + foreach j $t05($i) { + if {$t04($j) == 1} { + set s [find_source $j] + lappend o $s + exec cp $gnu/$s $bsd/$i + } + } + + puts "Creating Makefile in $bsd/$i" + + set fo [open $bsd/$i/Makefile w] + write_names $fo SRCS $o + puts $fo "PROG =\t$i" + puts $fo { +.if exists($(.CURDIR)/../gcc_int/obj) +DPADD += $(.CURDIR)/../gcc_int/obj/libgcc_int.a +LDADD += -L$(.CURDIR)/../gcc_int/obj -lgcc_int +.else +DPADD += $(.CURDIR)/../gcc_int/libgcc_int.a +LDADD += -L$(.CURDIR)/../gcc_int -lgcc_int +.endif + +LDADD+= -lgnumalloc -static +DPADD+= ${LIBGNUMALLOC} + +CFLAGS += -I$(.CURDIR)/../gcc_int -DFREEBSD_NATIVE +} + + if {[catch {set pgm_install($i)} x]} { + puts stderr "Needs to know where to install $i, pgm_install wont tell us." + exit 1 + } + puts $fo "\ninstall: $i\n\t\install \$(COPY) -o \${BINOWN} -g \${BINGRP} -m \${BINMODE} $i \$(DESTDIR)$pgm_install($i)" + if {![catch {set pgm_link($i)} x]} { + foreach j $x { + puts $fo "\t@rm -f \$(DESTDIR)$j" + puts $fo "\t@ln -s `basename $pgm_install($i)` \$(DESTDIR)$j" + } + } + if {![catch {set pgm_man1($i)} x]} { + exec cp $gnu/$x $bsd/$i/$i.1 + if {[catch {set pgm_dst1($i)} x]} { + puts stderr "Needs to know where to install manpage for $i, pgm_dst1 wont tell us." + exit 1 + } + puts $fo "\t\install \$(COPY) -m \$(MANMODE) -o \$(MANOWN) -g \$(MANGRP) \$(.CURDIR)/$i.1 \$(DESTDIR)/usr/share/man/man1/[lindex $x 0]" + foreach j [lrange $x 1 end] { + puts $fo "\trm -f \$(DESTDIR)/usr/share/man/man1/$j" + puts $fo "\tln -s [lindex $x 0] \$(DESTDIR)/usr/share/man/man1/$j" + } + } + puts $fo "" + puts $fo {.include <bsd.prog.mk>} + + close $fo +} + +puts "Copy config files to $bsd/gcc_int" + +# Get everything ending in .h and .def +exec sh -c "cp $gnu/*.h $gnu/*.def $bsd/gcc_int" + +# Get anything still missing +foreach s $config { + # Try to copy right away + if {![catch {exec cp $gnu/$s $bsd/gcc_int/$s} x]} continue + # Try to copy from below the config subdir + if {![catch {exec cp $gnu/config/$s $bsd/gcc_int/$s} x]} continue + # Try to make the file then... + makefile $s + if {![catch {exec cp $gnu/$s $bsd/gcc_int/$s} x]} continue + # Too BAD. + puts stderr "I'm having troble finding the \"config\" file $s" + exit 1 +} +} + +puts "Create $bsd/libobjc" + +# Make a temporary Makefile in the GNU-tree +exec cp $gnu/objc/Makefile $gnu/objc/2bsd.t02 + +puts "Squeeze Makefile" + +# Add targets to tell us what we want to know +set fi [open $gnu/objc/2bsd.t02 a] +puts $fi "\nFo1:\n\t@echo \$(OBJC_O)" +puts $fi "\nFo2:\n\t@echo \$(OBJC_H)" +close $fi + +# Try it out... +set t01 [exec sh -c "( cd $gnu/objc ; make -f 2bsd.t02 Fo1)"] +set t02 [exec sh -c "( cd $gnu/objc ; make -f 2bsd.t02 Fo2)"] + +# Remove it again +exec rm -f $gnu/objc/2bsd.t02 + +puts "Copy sources" +set l "" +foreach i $t01 { + regsub {\.o} $i {} j + if {[file exists $gnu/objc/$j.m]} { + lappend l $j.m + exec cp $gnu/objc/$j.m $bsd/libobjc + } elseif {[file exists $gnu/objc/$j.c]} { + lappend l $j.c + exec cp $gnu/objc/$j.c $bsd/libobjc + } else { + puts stderr "Cannot locate source for objc/$i" + exit 1 + } +} + +puts "Copy includes" +exec sh -c "cp $gnu/objc/*.h $bsd/libobjc" + +# This is a trick to make #include <objc/...> work here. +exec sh -c "ln -s . $bsd/libobjc/objc" + +puts "Create Makefile" +set fo [open $bsd/libobjc/Makefile w] +puts $fo { + +LIB = objc +} +write_names $fo SRCS $l +write_names $fo HDRS $t02 +puts $fo { +CFLAGS += -I${.CURDIR} -I${.CURDIR}/../gcc_int + +.include <bsd.lib.mk> + +.SUFFIXES: .m + +.m.o: + $(CC) -fgnu-runtime -c $(CFLAGS) $< + @${LD} -x -r ${.TARGET} + @mv a.out ${.TARGET} + +.m.po: + $(CC) -p -fgnu-runtime -c $(CFLAGS) -o ${.TARGET} $< + @${LD} -x -r ${.TARGET} + @mv a.out ${.TARGET} + +afterinstall: + rm -rf /usr/include/objc + mkdir /usr/include/objc + cd $(.CURDIR) ; install $(COPY) -o ${BINOWN} -g ${BINGRP} -m 444 $(HDRS) $(DESTDIR)/usr/include/objc +} + +close $fo diff --git a/gnu/usr.bin/cc25/usr.bin.cpp/Makefile b/gnu/usr.bin/cc25/usr.bin.cpp/Makefile new file mode 100644 index 000000000000..eac1bec4dae0 --- /dev/null +++ b/gnu/usr.bin/cc25/usr.bin.cpp/Makefile @@ -0,0 +1,10 @@ + +install: + install -c -o $(BINOWN) -g $(BINGRP) -m $(BINMODE) \ + $(.CURDIR)/cpp.script $(DESTDIR)/usr/bin/cpp + @/bin/rm -rf $(DESTDIR)/usr/bin/gcpp + @cd $(DESTDIR)/usr/bin; ln -s cpp gcpp + @echo $(DESTDIR)/usr/bin/gcpp -\> $(DESTDIR)/usr/bin/cpp + + +.include <bsd.prog.mk> diff --git a/gnu/usr.bin/cc25/usr.bin.cpp/cpp.script b/gnu/usr.bin/cc25/usr.bin.cpp/cpp.script new file mode 100644 index 000000000000..b95b36fde8cc --- /dev/null +++ b/gnu/usr.bin/cc25/usr.bin.cpp/cpp.script @@ -0,0 +1,91 @@ +#!/bin/sh +# +# Copyright (c) 1990 The Regents of the University of California. +# All rights reserved. +# +# This code is derived from software contributed to Berkeley by +# the Systems Programming Group of the University of Utah Computer +# Science Department. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the University of +# California, Berkeley and its contributors. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# @(#)usr.bin.cpp.sh 6.5 (Berkeley) 4/1/91 +# +# Transitional front end to CCCP to make it behave like (Reiser) CCP: +# specifies -traditional +# doesn't search gcc-include +# +PATH=/usr/bin:/bin +CPP=/usr/libexec/cpp +ALST="-traditional -D__GNUC__ -$ " +NSI=no +OPTS="" +INCS="-nostdinc" +FOUNDFILES=no + +for A +do + case $A in + -nostdinc) + NSI=yes + ;; + -traditional) + ;; + -I*) + INCS="$INCS $A" + ;; + -U__GNUC__) + ALST=`echo $ALST | sed -e 's/-D__GNUC__//'` + ;; + -*) + OPTS="$OPTS '$A'" + ;; + *) + FOUNDFILES=yes + if [ $NSI = "no" ] + then + INCS="$INCS -I/usr/include" + NSI=skip + fi + eval $CPP $ALST $INCS $LIBS $CSU $OPTS $A || exit $? + ;; + esac +done + +if [ $FOUNDFILES = "no" ] +then + # read standard input + if [ $NSI = "no" ] + then + INCS="$INCS -I/usr/include" + fi + eval exec $CPP $ALST $INCS $LIBS $CSU $OPTS +fi + +exit 0 diff --git a/gnu/usr.bin/cc25/usr.bin.f77/Makefile b/gnu/usr.bin/cc25/usr.bin.f77/Makefile new file mode 100644 index 000000000000..9b5117d7b380 --- /dev/null +++ b/gnu/usr.bin/cc25/usr.bin.f77/Makefile @@ -0,0 +1,7 @@ + +install: + install -c -o $(BINOWN) -g $(BINGRP) -m $(BINMODE) \ + $(.CURDIR)/f77.script $(DESTDIR)/usr/bin/f77 + + +.include <bsd.prog.mk> diff --git a/gnu/usr.bin/cc25/usr.bin.f77/f77.script b/gnu/usr.bin/cc25/usr.bin.f77/f77.script new file mode 100644 index 000000000000..f218a03d9625 --- /dev/null +++ b/gnu/usr.bin/cc25/usr.bin.f77/f77.script @@ -0,0 +1,114 @@ +#!/bin/sh +# Compile Fortran code, adding -lf2c. +# This is a slightly modified g++ script. + +: || exec /bin/sh -f $0 $argv:q + +# The compiler name might be different when doing cross-compilation +# (this should be configured) +gcc_name=gcc +speclang=-xnone + +# replace the command name by the name of the new command +progname=`basename $0` +case "$0" in + */*) + gcc=`echo $0 | sed -e "s;/[^/]*$;;"`/$gcc_name + ;; + *) + gcc=$gcc_name + ;; +esac + +# $first is yes for first arg, no afterwards. +first=yes +# If next arg is the argument of an option, $quote is non-empty. +# More precisely, it is the option that wants an argument. +quote= +# $library is made empty to disable use of libf2c. +#library=-lF77 -lI77 -lm +library="-lf2c -lm" +numargs=$# + +# ash requires the newline before `do'. +for arg +do + if [ $first = yes ] + then + # Need some 1st arg to `set' which does not begin with `-'. + # We get rid of it after the loop ends. + set gcc + first=no + fi + # If you have to ask what this does, you should not edit this file. :-) + # The ``S'' at the start is so that echo -nostdinc does not eat the + # -nostdinc. + arg=`echo "S$arg" | sed "s/^S//; s/'/'\\\\\\\\''/g"` + if [ x$quote != x ] + then + quote= + else + quote= + case $arg in + -nostdlib) + # Inhibit linking with -lf2c. + library= + ;; + -lm | -lmath) + # Because libf2c uses things from the math library, make sure it + # always comes before the math library. We recognize both -lm + # and -lmath, since on some systems (e.g. m88k SVR3), it + # doesn't call it libm.a for some reason. + #set "$@" $library + #library="" + ;; + -[bBVDUoeTuIYmLiA] | -Tdata) + # these switches take following word as argument, + # so don't treat it as a file name. + quote=$arg + ;; + -[cSEM] | -MM) + # Don't specify libraries if we won't link, + # since that would cause a warning. + library= + ;; + -x*) + speclang=$arg + ;; + -v) + # catch `f77 -v' + if [ $numargs = 1 ] ; then library="" ; fi + ;; + -*) + # Pass other options through; they don't need -x and aren't inputs. + ;; + *) + # If file ends in .i, put options around it. + # But not if a specified -x option is currently active. + case "$speclang $arg" in -xnone\ *.i) + set "$@" -xf2c "'$arg'" -xnone + continue + esac + ;; + esac + fi + set "$@" "'$arg'" +done + +# Get rid of that initial 1st arg +if [ $first = no ]; then + shift +else + echo "$0: No input files specified." + exit 1 +fi + +if [ x$quote != x ] +then + echo "$0: argument to \`$quote' missing" + exit 1 +fi + +eval $gcc "$@" $library + + |
