summaryrefslogtreecommitdiff
path: root/lang/TenDRA
diff options
context:
space:
mode:
authorRobert Nordier <rnordier@FreeBSD.org>1998-09-29 13:13:25 +0000
committerRobert Nordier <rnordier@FreeBSD.org>1998-09-29 13:13:25 +0000
commitf6a8fafdaf4da36f0d3d242d0b81d0c669919f8e (patch)
tree3a425dc6fd31b448507e485f3b1859a1cffbc10d /lang/TenDRA
parentMake this compile on -current. (diff)
TenDRA does ELF Part I
Notes
Notes: svn path=/head/; revision=13537
Diffstat (limited to 'lang/TenDRA')
-rw-r--r--lang/TenDRA/files/patch-af10
-rw-r--r--lang/TenDRA/files/patch-ag59
-rw-r--r--lang/TenDRA/files/patch-ah481
-rw-r--r--lang/TenDRA/scripts/configure192
4 files changed, 738 insertions, 4 deletions
diff --git a/lang/TenDRA/files/patch-af b/lang/TenDRA/files/patch-af
new file mode 100644
index 000000000000..28b5392d9328
--- /dev/null
+++ b/lang/TenDRA/files/patch-af
@@ -0,0 +1,10 @@
+--- src/utilities/tuname/tuname.c.orig Mon Mar 16 13:26:37 1998
++++ src/utilities/tuname/tuname.c Tue Sep 29 01:17:55 1998
+@@ -286,6 +286,7 @@
+
+ } else if ( strcmp ( sysname, "freebsd" ) == 0 ) {
+ machine = find_linux_machine ( machine ) ;
++ execform = find_linux_format ( argv [0] ) ;
+
+ } else if ( strcmp ( sysname, "hp-ux" ) == 0 ) {
+ sysname = "hpux" ;
diff --git a/lang/TenDRA/files/patch-ag b/lang/TenDRA/files/patch-ag
new file mode 100644
index 000000000000..fe46438a2a88
--- /dev/null
+++ b/lang/TenDRA/files/patch-ag
@@ -0,0 +1,59 @@
+--- src/installers/80x86/common/assembler.h.orig Mon Mar 16 13:25:20 1998
++++ src/installers/80x86/common/assembler.h Mon Sep 28 23:46:57 1998
+@@ -97,6 +97,9 @@
+ #if islinux
+ extern void set_linux_format PROTO_S ((int elf)); /* machine.c */
+ #endif
++#if isfreebsd
++extern void set_freebsd_format PROTO_S ((int elf)); /* machine.c */
++#endif
+ extern void out_main_prelude PROTO_S ((void));
+ extern void out_main_postlude PROTO_S ((void));
+ #endif
+--- src/installers/80x86/common/cproc.c.orig Mon Mar 16 13:25:21 1998
++++ src/installers/80x86/common/cproc.c Mon Sep 28 23:48:05 1998
+@@ -687,6 +687,9 @@
+ #if islinux
+ !linux_elf &&
+ #endif
++#if isfreebsd
++ !freebsd_elf &&
++#endif
+ pname[0] != local_prefix[0] &&
+ !strcmp (pname+prefix_length, "main")) {
+ out_main_prelude();
+@@ -1003,6 +1006,9 @@
+ if (
+ #if islinux
+ !linux_elf &&
++#endif
++#if isfreebsd
++ !freebsd_elf &&
+ #endif
+ pname[0] != local_prefix[0] &&
+ !strcmp (pname+prefix_length, "main")) {
+--- src/installers/80x86/common/trans.c.orig Wed Mar 11 13:03:06 1998
++++ src/installers/80x86/common/trans.c Mon Sep 28 23:49:29 1998
+@@ -387,6 +387,11 @@
+ set_linux_format (s[2] == '1');
+ break;
+ #endif
++#if isfreebsd
++ case 'k':
++ set_freebsd_format (s[2] == '1');
++ break;
++#endif
+ #if issco
+ case 's':
+ sco_gas = 1;
+@@ -402,6 +407,10 @@
+ #if islinux
+ if (gcc_compatible < 0)
+ gcc_compatible = ! linux_elf;
++#endif
++#if isfreebsd
++ if (gcc_compatible < 0)
++ gcc_compatible = ! freebsd_elf;
+ #endif
+
+ if (i == argc)
diff --git a/lang/TenDRA/files/patch-ah b/lang/TenDRA/files/patch-ah
new file mode 100644
index 000000000000..b522d5a621b7
--- /dev/null
+++ b/lang/TenDRA/files/patch-ah
@@ -0,0 +1,481 @@
+--- src/installers/80x86/freebsd/Makefile.orig Mon Mar 16 12:38:37 1998
++++ src/installers/80x86/freebsd/Makefile Mon Sep 28 16:28:42 1998
+@@ -1,8 +1,7 @@
+ # Automatically generated by make_mf version 1.1
+
+ # Standard directories and files
+-#BASE=/u/g/release/Source
+-BASE=/usr/local/src/TenDRA-4.1.1
++BASE=/u/g/release/Source
+ INST=${BASE}/src/installers
+ SRC=${INST}/80x86/freebsd
+ SRC1=${INST}/80x86/common
+@@ -15,8 +14,8 @@
+
+ # Standard variables
+
+-CC=gcc
+-#TCCOPTS=-Xc -Y32bit -Yansi
++CC=tcc
++TCCOPTS=-Xc -Y32bit -Yansi
+ CCOPTS=${TCCOPTS} -I${SRC} -I${SRC1} -I${SRC2} -I${SRC3} -I${SRC5}\
+ -I${SRC6}
+ MAIN_CC=${CC} ${CCOPTS} -c
+@@ -65,9 +64,11 @@
+ ${SRC6}/ossg_api.h
+ ${MAIN_CC} ${SRC2}/aldefs.c
+
+-assembler.o : ${SRC}/assembler.c ${SRC6}/basicread.h ${SRC1}/coder.h\
+- ${SRC6}/common_types.h ${SRC}/config.h ${SRC1}/expmacs.h\
+- ${SRC1}/localflags.h ${SRC2}/machine.h ${SRC1}/operand.h ${SRC1}/out.h\
++assembler.o : ${SRC}/assembler.c ${SRC1}/assembler.h ${SRC6}/basicread.h\
++ ${SRC1}/coder.h ${SRC6}/common_types.h ${SRC}/config.h ${SRC2}/exp.h\
++ ${SRC1}/expmacs.h ${SRC2}/flags.h ${SRC2}/install_fns.h ${SRC1}/instr.h\
++ ${SRC1}/instr386.h ${SRC1}/localflags.h ${SRC2}/machine.h\
++ ${SRC1}/operand.h ${SRC1}/out.h ${SRC2}/shapemacs.h ${SRC6}/xalloc.h\
+ ${SRC6}/codetypes.h ${SRC3}/dg_first.h ${SRC3}/dg_types.h\
+ ${SRC}/diag_config.h ${SRC3}/diaginfo.h ${SRC3}/diagtypes.h\
+ ${SRC1}/exptypes.h ${SRC2}/installtypes.h ${SRC5}/li_types.h\
+--- src/installers/80x86/freebsd/assembler.c.orig Mon Mar 16 12:38:37 1998
++++ src/installers/80x86/freebsd/assembler.c Mon Sep 28 22:04:51 1998
+@@ -34,11 +34,21 @@
+ #include "common_types.h"
+ #include "out.h"
+ #include "expmacs.h"
++#include "exp.h"
++#include "localflags.h"
++#include "shapemacs.h"
+ #include "operand.h"
+ #include "machine.h"
+-#include "localflags.h"
++#include "flags.h"
+ #include "basicread.h"
+ #include "coder.h"
++#include "assembler.h"
++#include "instr.h"
++#include "instr386.h"
++#include "xalloc.h"
++#include "install_fns.h"
++#include <string.h>
++
+
+
+ /* PROCEDURES */
+@@ -47,6 +57,10 @@
+ PROTO_N ( (n) )
+ PROTO_T ( int n )
+ {
++ if (freebsd_elf) {
++ outs(".align "); outn((long)n); outnl();
++ return;
++ }
+ if (n == 1)
+ return;
+ outs(".align ");
+@@ -60,6 +74,7 @@
+ default:
+ n = 1; break;
+ };
++
+ outn((long)n); outnl();
+ return;
+ }
+@@ -90,34 +105,67 @@
+ PROTO_N ( (f, jr) )
+ PROTO_T ( int f X exp jr )
+ {
+- if (is80486 && !is80586 && ptno(jr) != last_jump_label) {
+- if (f == 1) /* repeat jump */
+- outs(".align 3,0x90");
+- if (f == 2) /* preceded by a jmp or ret */
+- outs(".align 4,0x90");
+- if (f == 3)
+- outs(".align 2,0x90");
+- outs("\n");
+- };
+- if (is80586 && ptno(jr) != last_jump_label) {
+- if (f >= 1 && f <= 3)
+- outs(".align 2,0x90\n");
+- };
+- return;
++ if (freebsd_elf) {
++ if (is80486 && !is80586 && ptno(jr) != last_jump_label) {
++/* forward jump and continued into
++ if (f==0)
++ outs(".align 8");
++*/
++ if (f == 1) /* repeat jump */
++ outs(".align 4");
++ if (f == 2) /* preceded by a jmp or ret */
++ outs(".align 16");
++ outs("\n");
++ };
++ return;
++ }
++ else {
++ if (is80486 && !is80586 && ptno(jr) != last_jump_label) {
++/* forward jump and continued into
++ if (f==0)
++ outs(".align 16,7,1");
++*/
++ if (f == 1) /* repeat jump */
++ outs(".align 3,0x90");
++ if (f == 2) /* preceded by a jmp or ret */
++ outs(".align 4,0x90");
++ if (f == 3)
++ outs(".align 2,0x90");
++ outs("\n");
++ };
++ if (is80586 && ptno(jr) != last_jump_label) {
++ if (f >= 1 && f <= 3)
++ outs(".align 2,0x90\n");
++ };
++ return;
++ }
+ }
+
+ void eval_postlude
+ PROTO_N ( (s, c) )
+ PROTO_T ( char * s X exp c )
+ {
+- UNUSED(s); UNUSED(c);
++ if (!freebsd_elf)
++ return;
++ outs(".size ");
++ outs (s);
++ outs (",");
++ outn((long)(shape_size(sh(c))+7)/8);
++ outnl();
++ outs(".type ");
++ outs (s);
++ outs (",@object");
++ outnl();
+ return;
+ }
+
+ void out_readonly_section
+ PROTO_Z ()
+ {
+- outs (".text");
++ if (freebsd_elf)
++ outs (".section .rodata");
++ else
++ outs (".text");
+ return;
+ }
+
+@@ -125,11 +173,12 @@
+ PROTO_N ( (id, sha) )
+ PROTO_T ( char * id X shape sha )
+ {
+- outs (".comm ");
+- outs (id);
+- outs (",");
+- outn ((long)((( shape_size(sha)/ 8) + 3) / 4) * 4);
+- outnl ();
++ outs (".comm ");
++ outs (id);
++ outs (",");
++ outn ((long)((( shape_size(sha)/ 8) + 3) / 4) * 4);
++
++ outnl ();
+ return;
+ }
+
+@@ -137,11 +186,12 @@
+ PROTO_N ( (id, sha) )
+ PROTO_T ( char * id X shape sha )
+ {
+- outs (".lcomm ");
+- outs (id);
+- outs (",");
+- outn ((long)((( shape_size(sha)/ 8) + 3) / 4) * 4);
+- outnl ();
++ outs (".lcomm ");
++ outs (id);
++ outs (",");
++ outn ((long)((( shape_size(sha)/ 8) + 3) / 4) * 4);
++
++ outnl ();
+ return;
+ }
+
+@@ -149,17 +199,27 @@
+ PROTO_N ( (id, sha) )
+ PROTO_T ( char * id X shape sha )
+ {
+- outs (".bss ");
+- outs (id);
+- outs (",");
+- outn ((long)((( shape_size(sha)/ 8) + 3) / 4) * 4);
+- outnl ();
++ outs (".bss ");
++ outs (id);
++ outs (",");
++ outn ((long)((( shape_size(sha)/ 8) + 3) / 4) * 4);
++
++ outnl ();
+ return;
+ }
+
++static int pic_label;
++
+ void pic_prelude
+ PROTO_Z ()
+ {
++ int n = next_lab();
++ pic_label = n;
++ outs(" call "); outs(local_prefix); outn((long)n); outnl();
++ outs(local_prefix); outn((long)n); outs(":"); outnl();
++ outs(" popl %ebx"); outnl();
++ outs(" addl $_GLOBAL_OFFSET_TABLE_+[.-"); outs(local_prefix); outn((long)n); outs("],%ebx");
++ outnl();
+ return;
+ }
+
+@@ -175,16 +235,47 @@
+ PROTO_N ( (tab, a, min) )
+ PROTO_T ( int tab X where a X int min )
+ {
+- outs (" jmp *");
+- outs(local_prefix);
+- outn((long)tab);
+- outs("-");
+- outn((long)(4 * min));
+- outs ("(,");
+- operand (32, a, 1, 0);
+- outs (",4)");
+- outnl ();
+- return;
++ if (PIC_code) {
++ if (min != 0) {
++ sub (slongsh, mw(zeroe,min), a, reg0);
++ a = reg0;
++ }
++ if (eq_where (a, reg0)) {
++ outs (" movl ");
++ }
++ else {
++ outs (" movl %ebx,%eax");
++ outnl();
++ outs (" subl ");
++ }
++ outs(local_prefix);
++ outn((long)tab);
++ outs("@GOTOFF(%ebx,");
++ operand (32, a, 1, 0);
++ outs(",4),%eax");
++ outnl();
++ if (eq_where (a, reg0)) {
++ outs (" subl %ebx,%eax");
++ outnl();
++ outs (" negl %eax");
++ outnl();
++ }
++ outs(" jmp *%eax");
++ outnl();
++ return;
++ }
++ else {
++ outs (" jmp *");
++ outs(local_prefix);
++ outn((long)tab);
++ outs("-");
++ outn((long)(4 * min));
++ outs ("(,");
++ operand (32, a, 1, 0);
++ outs (",4)");
++ outnl ();
++ return;
++ };
+ }
+
+ void out_switch_table
+@@ -204,15 +295,31 @@
+ for (i = min; i <= max; ++i) {
+ outs (".long ");
+ if (v[i - min] != -1) {
+- outs(local_prefix);
+- outn ((long)v[i - min]);
++ if (PIC_code) {
++ outs(" _GLOBAL_OFFSET_TABLE_+[.-");
++ outs(local_prefix);
++ outn ((long)v[i - min]);
++ outs("]");
++ }
++ else {
++ outs(local_prefix);
++ outn ((long)v[i - min]);
++ }
+ }
+ else {
+ if (absent == -1)
+ outn ((long)0);
+ else {
+- outs(local_prefix);
+- outn ((long)absent);
++ if (PIC_code) {
++ outs(" _GLOBAL_OFFSET_TABLE_+[.-");
++ outs(local_prefix);
++ outn ((long)absent);
++ outs("]");
++ }
++ else {
++ outs(local_prefix);
++ outn ((long)absent);
++ }
+ };
+ };
+ outnl ();
+@@ -248,7 +355,7 @@
+
+ void outend
+ PROTO_Z ()
+-{
++{ /* close the output */
+ int st;
+ outs(".text");
+ outnl();
+@@ -287,8 +394,18 @@
+ PROTO_N ( (id) )
+ PROTO_T ( char* id )
+ {
+- outs(".stabs \"___TDFI_LIST__\",22,0,0,");
++ if (!freebsd_elf) {
++ outs(".stabs \"___TDFI_LIST__\",22,0,0,");
++ outs (id);
++ outnl ();
++ outnl ();
++ return;
++ }
++ outs (".section .init\n");
++ outs (" call ");
+ outs (id);
++ if (PIC_code)
++ outs ("@PLT");
+ outnl ();
+ outnl ();
+ return;
+@@ -296,7 +413,7 @@
+
+
+ void out_main_prelude
+- PROTO_Z ()
++ PROTO_Z () /* if (!freebsd_elf) */
+ {
+ int nl1 = next_lab ();
+ int nl2 = next_lab ();
+@@ -318,7 +435,7 @@
+ }
+
+ void out_main_postlude
+- PROTO_Z ()
++ PROTO_Z () /* if (!freebsd_elf) */
+ {
+ char * sdummy = "Idummy";
+ char * pdummy = (char *) xcalloc (((int)strlen(local_prefix) +
+@@ -332,3 +449,4 @@
+ out_initialiser(pdummy);
+ return;
+ }
++
+--- src/installers/80x86/freebsd/config.h.orig Mon Mar 16 13:25:23 1998
++++ src/installers/80x86/freebsd/config.h Mon Sep 28 22:08:24 1998
+@@ -57,7 +57,7 @@
+ #define issol86 0
+ #define islinux 0
+ #define isfreebsd 1
+-#define remove_struct_ref 1
++#define remove_struct_ref (!freebsd_elf)
+
+ #define has_setcc 1
+ #define little_end 1
+@@ -84,7 +84,7 @@
+ #define do_case_transforms 1
+ #define substitute_complex 1
+ #define has_rotate 1
+-#define GCC_STRUCTS 1
++#define GCC_STRUCTS -1 /* (freebsd_elf ? 0 : 1) */
+
+
+ #define maxmin_implemented 1
+@@ -96,7 +96,8 @@
+ #define value_of_null 0
+ #define no_trap_on_nil_contents 1
+
+-#define prefix_length 1 /* strlen(name_prefix) */
++extern int freebsd_elf; /* machine.c */
++#define prefix_length (freebsd_elf ? 0 : 1) /* strlen(name_prefix) */
+ #define AVOID_INTOV 0 /* No software interrupts */
+ #define normal_fpucon 0x1272
+
+--- src/installers/80x86/freebsd/diag_out.c.orig Fri Mar 27 11:47:50 1998
++++ src/installers/80x86/freebsd/diag_out.c Mon Sep 28 22:12:37 1998
+@@ -248,13 +248,17 @@
+
+ if (seg != 0) /* 0 suppresses always */
+ {
+- if (seg < 0)
++ if (seg < 0 && !freebsd_elf)
+ seg = - seg;
+ if (seg > 0) /* -ve line nos are put out in the stabs */
+ {
+ i = next_lab () ;
+ fprintf ( dg_file, "%sL.%ld:\n", local_prefix, i ) ;
+ fprintf ( dg_file, "\t.stabn\t0x%x,0,%ld,%sL.%ld",seg, lno, local_prefix, i ) ;
++ if (freebsd_elf && in_proc) {
++ outs ("-");
++ out_procname ();
++ }
+ outnl ();
+ }
+ }
+--- src/installers/80x86/freebsd/machine.c.orig Mon Mar 16 12:38:37 1998
++++ src/installers/80x86/freebsd/machine.c Mon Sep 28 22:14:25 1998
+@@ -40,13 +40,33 @@
+ #include "szs_als.h"
+
+ /* VARIABLES */
++/* All variables are initialised, jmf */
+
+-char * local_prefix = "L";
+-char * name_prefix = "_";
++int freebsd_elf = 1;
++
++char * local_prefix = ".L";
++char * name_prefix = "";
+
+
+
+ /* PROCEDURES */
++
++void set_freebsd_format
++ PROTO_N ( (elf) )
++ PROTO_T ( int elf )
++{
++ freebsd_elf = elf;
++ if (elf) {
++ local_prefix = ".L";
++ name_prefix = "";
++ }
++ else {
++ local_prefix = "L";
++ name_prefix = "_";
++ }
++ return;
++}
++
+
+ /* is the result of a procedure delivering
+ this shape produced in registers. */
+--- src/installers/80x86/freebsd/trans.1.orig Mon Mar 16 12:38:37 1998
++++ src/installers/80x86/freebsd/trans.1 Mon Mar 16 13:25:24 1998
+@@ -94,7 +94,7 @@
+ .IP \fB-K\fIstr\fR
+ Causes \fBtrans386\fR to optimise its code for a particular processor
+ model, determined by \fIstr\fR. The available values of \fIstr\fR are
+-3 for the 80386, 4 for the 80486 (the default) and 5 for the Pentium.
++3 for the 80386, 4 for the 80486 and 5 for the Pentium (the default).
+ So \fB-K3\fR means optimise for the 80386 etc.
+ .\" ----------------------------------------------------------------------
+ .IP \fB-M\fIswitch\fR
diff --git a/lang/TenDRA/scripts/configure b/lang/TenDRA/scripts/configure
index fec628250c2f..70474840d5c5 100644
--- a/lang/TenDRA/scripts/configure
+++ b/lang/TenDRA/scripts/configure
@@ -1,12 +1,12 @@
#!/bin/sh
-# Look for *crt0.o in /usr/lib or /usr/lib/aout
olib=/usr/lib
nlib=/usr/lib/aout
-dir=$WRKSRC/src/lib/env/freebsd/common/80x86
fixlib()
{
+ dir=$1
+ shift
crt=$1
shift
if [ ! -f $olib/$crt ]; then
@@ -23,5 +23,189 @@ fixlib()
fi
}
-fixlib crt0.o default.extra tcc_diag
-fixlib gcrt0.o tcc_prof
+#
+# Create tcc aout environment.
+#
+
+mkdir $WRKSRC/src/lib/env/freebsd/aout
+mkdir $WRKSRC/src/lib/env/freebsd/aout/80x86
+
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-P5
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-P5 <<EOF
++FLAG_TRANS "-K5"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-PIC
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-PIC <<EOF
+/* empty */
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-frame
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-frame <<EOF
++FLAG_TRANS "-a"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-i386
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-i386 <<EOF
++FLAG_TRANS "-K3"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-i486
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-i486 <<EOF
++FLAG_TRANS "-K4"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-noframe
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-noframe <<EOF
+/* This is default */
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p <<EOF
++FLAG_TRANS "-Z1"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p1
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p1 <<EOF
++FLAG_TRANS "-Z1"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p2
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p2 <<EOF
++FLAG_TRANS "-Z2"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p4
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p4 <<EOF
++FLAG_TRANS "-Z4"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/default.extra
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/default.extra <<EOF
++MACHINE "freebsd-*-80x86"
++TRANS "-BINDIR-/trans -k0"
++AS "/usr/bin/as"
++LD "/usr/bin/ld -e start -dc -dp"
++CC "/usr/bin/cc"
++CRT0 "/usr/lib/crt0.o"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/tcc_diag
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/tcc_diag <<EOF
+/* TCC ENVIRONMENT : DIAGNOSTICS FOR FreeBSD */
+
++CRT0 "/usr/lib/crt0.o"
+<LINK "-L-LIBDIR-/diag"
+>SYS_LIB "-static -lg"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/tcc_prof
+cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/tcc_prof <<EOF
+/* TCC ENVIRONMENT : PROFILING FOR FreeBSD */
+
++CRT0 "/usr/lib/gcrt0.o"
+<SYS_LINK "-static -lgmon -lc_p"
++FLAG_TRANS "-P"
++LINE_START "#pragma@preserve@*"
+EOF
+
+#
+# Create tcc elf environment.
+#
+
+mkdir $WRKSRC/src/lib/env/freebsd/elf
+mkdir $WRKSRC/src/lib/env/freebsd/elf/80x86
+
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-P5
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-P5 <<EOF
++FLAG_TRANS "-K5"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-aout
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-aout <<EOF
+/* TCC ENVIRONMENT : producing old "a.out" for FreeBSD */
+
++FLAG_TRANS "-k0"
++AS "/usr/libexec/aout/as"
++LD "/usr/libexec/aout/ld"
++CRT0 "/usr/lib/aout/crt0.o"
++CRT1 ""
++CRTN ""
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-frame
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-frame <<EOF
++FLAG_TRANS "-a"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-i386
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-i386 <<EOF
++FLAG_TRANS "-K3"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-i486
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-i486 <<EOF
++FLAG_TRANS "-K4"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-noframe
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-noframe <<EOF
+/* This is default */
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p <<EOF
++FLAG_TRANS "-Z1"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p1
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p1 <<EOF
++FLAG_TRANS "-Z1"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p2
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p2 <<EOF
++FLAG_TRANS "-Z2"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p4
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p4 <<EOF
++FLAG_TRANS "-Z4"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/default.extra
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/default.extra <<EOF
++MACHINE "freebsd-*-80x86"
++AS "/usr/bin/as"
++LD "/usr/bin/ld -m elf_i386"
++CC "/usr/bin/cc"
++CRT0 "-dynamic-linker /usr/libexec/ld-elf.so.1 /usr/lib/crt1.o"
++CRT1 "/usr/lib/crti.o /usr/lib/crtbegin.o"
++CRTN "/usr/lib/crtend.o /usr/lib/crtn.o"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/system
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/system <<EOF
+/* tcc environment for system headers on unknown machine */
+
++INCL "-Nsystem1:-MACHDIR-/include -Nsystem:/usr/include"
++FLAG "-D__FREEBSD_USE_ELF"
++FLAG "-f-MACHDIR-/startup/system.h"
++FLAG "-Y32bit"
++FLAG_TRANS "-B0"
++API_NAME "-Asystem1 -Asystem"
++INFO "System@Headers"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/system+
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/system+ <<EOF
+/* tcc environment for system headers on unknown machine */
+
+>INCL "-Nsystem1:-MACHDIR-/include -Nsystem:/usr/include"
++FLAG "-D__FREEBSD_USE_ELF"
++FLAG "-f-MACHDIR-/startup/system.h"
++FLAG "-Y32bit"
++FLAG_TRANS "-B0"
+>API_NAME "-Asystem1 -Asystem"
+>INFO "System@Headers"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/tcc_prof
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/tcc_prof <<EOF
+/* TCC ENVIRONMENT : PROFILING FOR FreeBSD */
+
++CRT0 "-dynamic-linker /usr/libexec/ld-elf.so.1 /usr/lib/gcrt1.o"
+<SYS_LINK "-lgmon"
++FLAG_TRANS "-P"
++LINE_START "#pragma@preserve@*"
+EOF
+# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/tdf_ext
+cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/tdf_ext <<EOF
+/* tcc environment for the TDF Spec 4.0 extensions */
+
+<LIB "-ltarget_tok"
++FLAG_INSTALL "-Ytdf_ext"
+>INFO "XANDF@Preliminary@Specification@(DRA-005@proposal)"
+EOF
+
+#
+# Fix aout environment for /usr/lib or /usr/lib/aout.
+#
+
+fixlib $WRKSRC/src/lib/env/freebsd/aout/80x86 crt0.o default.extra tcc_diag
+fixlib $WRKSRC/src/lib/env/freebsd/aout/80x86 gcrt0.o tcc_prof