1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-31 21:57:12 +00:00
freebsd-ports/lang/TenDRA/files/patch-ah
1998-09-29 13:13:25 +00:00

482 lines
11 KiB
Plaintext

--- 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