Skip to content

Instantly share code, notes, and snippets.

@uyjulian
Created September 27, 2019 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uyjulian/78f1234f82ad429ce43d4db00bd3b574 to your computer and use it in GitHub Desktop.
Save uyjulian/78f1234f82ad429ce43d4db00bd3b574 to your computer and use it in GitHub Desktop.
diff -burN gcc-2.7.2.3.orig/COMPILE.gcc.aux gcc-2.7.2.3/COMPILE.gcc.aux
--- gcc-2.7.2.3.orig/COMPILE.gcc.aux 1969-12-31 18:00:00.000000000 -0600
+++ gcc-2.7.2.3/COMPILE.gcc.aux 1995-11-20 06:12:34.000000000 -0600
@@ -0,0 +1,26 @@
+#!/bin/ksh
+#
+# Just compile gcc
+#
+./configure --prefix=/usr/local/Gnu aux
+make CC=$GNU/gcc
+print " "
+print "======================"
+print "= Doing stage2 build ="
+print "======================"
+make stage1
+ln as stage1/as
+make CC="stage1/xgcc -Bstage1/"
+print " "
+print "======================"
+print "= Doing stage3 build ="
+print "======================"
+make stage2
+ln as stage2/as
+make CC="stage2/xgcc -Bstage2/"
+print " "
+print "======================"
+print "= Doing gcc compare ="
+print "======================"
+make CC="stage2/xgcc -Bstage2/" compare
+exit
diff -burN gcc-2.7.2.3.orig/Makefile.in gcc-2.7.2.3/Makefile.in
--- gcc-2.7.2.3.orig/Makefile.in 1997-08-08 10:58:17.000000000 -0500
+++ gcc-2.7.2.3/Makefile.in 2019-09-27 12:50:32.534507292 -0500
@@ -47,8 +47,8 @@
# to the stage2 and stage3 compilations
# XCFLAGS is used for most compilations but not when using the GCC just built.
XCFLAGS =
-CFLAGS = -g
-BOOT_CFLAGS = -O $(CFLAGS)
+CFLAGS = -O2
+BOOT_CFLAGS = -O2 $(CFLAGS)
# These exists to be overridden by the x-* and t-* files, respectively.
X_CFLAGS =
T_CFLAGS =
@@ -181,7 +181,7 @@
srcdir = .
# Common prefix for installation directories.
# NOTE: This directory must exist when you start installation.
-prefix = /usr/local
+prefix = /usr/local/Gnu
# Directory in which to put localized header files. On the systems with
# gcc as the native cc, `local_prefix' may not be `prefix' which is
# `/usr'.
@@ -190,11 +190,11 @@
# Directory in which to put host dependent programs and libraries
exec_prefix = $(prefix)
# Directory in which to put the executable for the command `gcc'
-bindir = $(exec_prefix)/bin
+bindir = $(exec_prefix)
# Directory in which to put the directories used by the compiler.
libdir = $(exec_prefix)/lib
# Directory in which the compiler finds executables, libraries, etc.
-libsubdir = $(libdir)/gcc-lib/$(target)/$(version)
+libsubdir = $(libdir)/gcc/$(target)/$(version)
# Directory in which the compiler finds g++ includes.
gxx_include_dir= $(libdir)/g++-include
# Directory to search for site-specific includes.
@@ -887,9 +887,12 @@
for file in .. $(LIB2FUNCS_EXTRA); \
do \
if [ x$${file} != x.. ]; then \
- name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
+ name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//' -e 's/\$(objext)$$//'`; \
oname=` echo $${name} | sed -e 's,.*/,,'`; \
echo $${name}; \
+ if [ $${name}$(objext) = $${file} ]; then \
+ $(AR) $(AR_FLAGS) tmplibgcc2.a $${file}; \
+ else \
if [ $${name}.asm = $${file} ]; then \
cp $${file} $${name}.s || exit 1; file=$${name}.s; \
else true; fi; \
@@ -897,6 +900,7 @@
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
$(AR) $(AR_FLAGS) tmplibgcc2.a $${oname}$(objext); \
rm -f $${name}.s $${oname}$(objext); \
+ fi; \
else true; \
fi; \
done
@@ -1135,7 +1139,7 @@
gcc.o: gcc.c $(CONFIG_H) multilib.h config.status $(lang_specs_files)
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
- -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
+ -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
-DDEFAULT_TARGET_VERSION=\"$(version)\" \
-DDEFAULT_TARGET_MACHINE=\"$(target)\" \
-DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" \
@@ -2048,12 +2052,12 @@
# Create the installation directory.
install-dir:
-if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
- -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
+ -if [ -d $(libdir)/gcc ] ; then true ; else mkdir $(libdir)/gcc ; chmod a+rx $(libdir)/gcc ; fi
# This dir isn't currently searched by cpp.
-# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
- -if [ -d $(libdir)/gcc-lib/$(target) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target) ; chmod a+rx $(libdir)/gcc-lib/$(target) ; fi
- -if [ -d $(libdir)/gcc-lib/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version) ; chmod a+rx $(libdir)/gcc-lib/$(target)/$(version) ; fi
- -if [ -d $(libdir)/gcc-lib/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version)/include ; chmod a+rx $(libdir)/gcc-lib/$(target)/$(version)/include ; fi
+# -if [ -d $(libdir)/gcc/include ] ; then true ; else mkdir $(libdir)/gcc/include ; chmod a+rx $(libdir)/gcc/include ; fi
+ -if [ -d $(libdir)/gcc/$(target) ] ; then true ; else mkdir $(libdir)/gcc/$(target) ; chmod a+rx $(libdir)/gcc/$(target) ; fi
+ -if [ -d $(libdir)/gcc/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc/$(target)/$(version) ; chmod a+rx $(libdir)/gcc/$(target)/$(version) ; fi
+ -if [ -d $(libdir)/gcc/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc/$(target)/$(version)/include ; chmod a+rx $(libdir)/gcc/$(target)/$(version)/include ; fi
-if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
-if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
-if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
diff -burN gcc-2.7.2.3.orig/README.AUX gcc-2.7.2.3/README.AUX
--- gcc-2.7.2.3.orig/README.AUX 1969-12-31 18:00:00.000000000 -0600
+++ gcc-2.7.2.3/README.AUX 1995-12-05 08:41:49.000000000 -0600
@@ -0,0 +1,75 @@
+This file details the diffs, patches and new files needed to allow GNU gcc
+to support A/UX. Most of these are required due to the hybrid nature of
+A/UX (UNIX and MacOS) and some are simply to describe A/UX itself. Builds
+of gcc for A/UX require 'gas' (at least 1.38.1) and a previously built
+version of 'gcc'. Check the A/UX FAQ for sites that carry these.
+
+ * Makefile.in (libgcc2.a): Allow object files in LIB2FUNCS_EXTRA
+ so that objects needing special processing can be added.
+
+ * c-lex.c (readescape, yylex): Provide support for the pascal
+ strings used by Mac programmers.
+ * c-lex.c (yylex): Conditionally do not produce a warning for
+ multi-character constants under A/UX.
+
+ * m68k/aux-exit.c: New file. Provides _exithk() stub for MacOS
+ * m68k/aux-crtfix.c: New file. Provide tool to patch MacOS mcrt files
+ * m68k/aux-mcount.asm: New file. Hook into A/UX profiling.
+ * m68k/aux.h, m68k/x-aux, m68k/xm-aux.h: New files.
+
+ * m68k/m68k.c (use_return_insn): A/UX returns pointers in %a0 --
+ don't use return insn when returning a pointer.
+
+ * gcc.c (process_command): A/UX's 'ld' requires a space
+ between after '-o' but no space after '-L'
+
+ * libgcc2.c: Add in _exithk() stub to exit() call.
+
+ * configure, config.guess, config.sub: Recognize A/UX.
+
+ * fixincludes: Fix A/UX's <sys/param.h>.
+
+ * aux-fixcrts: New file. Uses aux-crtfix to fix MacOS mcrt files.
+
+These patches follow the tradition of placing the gcc executable in
+'/usr/local/Gnu' and the support files in '/usr/local/Gnu/lib/gcc/aux'
+
+To build A/UX the procedure is quite easy and follows the general 'gcc'
+methods. However, the previously built version of 'gas' must be placed
+at the top-level source directory and called 'as'. If you're kinda lazy,
+you do this in the top-level directory of the gcc-2.7.2 source tree:
+
+ % cp <gas's home>gas as
+ % patch < gcc4aux.diffs
+ % ./configure --prefix=/usr/local/Gnu aux
+ % make CC="<pathname to gcc>"
+ % make stage1
+ % make CC="stage1/xgcc -Bstage1/"
+ % make stage2
+ % make CC="stage2/xgcc -Bstage2/"
+ % make CC="stage2/xgcc -Bstage2/" compare
+ % make CC="stage2/xgcc -Bstage2/" install
+ % make CC="stage2/xgcc -Bstage2/" objc-runtime
+ % make CC="stage2/xgcc -Bstage2/" install-libobjc
+
+Finally, when built, it is recommended that you run 'aux-fixcrts' to
+patch the MacOS mcrt files to work under 'gcc' if you will be creating
+MacOS-hybrid programs. The command-line is:
+
+ % sh aux-fixcrts /usr/local/Gnu/lib/gcc/aux/2.7.2
+
+Enjoy!
+
+NOTE: These patches are the result of work of a lot of contributors including:
+
+ David W. Berry (formerly @ Apple)
+ John Coolidge (@ Apple)
+ Richard Henderson
+ Jim Jagielski
+
+--
+#include <std/disclaimer.h>
+ | Jim Jagielski | jim@jagubox.gsfc.nasa.gov | V: 301 286-5964 |
+ | NASA/GSFC, Code 734.4 | Greenbelt, MD 20771 | F: 301 286-1719 |
+ << This sig is a figment of your imagination; SEEK MENTAL HELP !! >>
+
diff -burN gcc-2.7.2.3.orig/aux-crtfix.c gcc-2.7.2.3/aux-crtfix.c
--- gcc-2.7.2.3.orig/aux-crtfix.c 1969-12-31 18:00:00.000000000 -0600
+++ gcc-2.7.2.3/aux-crtfix.c 1995-11-20 06:13:48.000000000 -0600
@@ -0,0 +1,86 @@
+/*
+ Copyright (C) 1995 Free Software Foundation, Inc.
+
+ This file is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ In addition to the permissions in the GNU General Public License, the
+ Free Software Foundation gives you unlimited permission to link the
+ compiled version of this file with other programs, and to distribute
+ those programs without any restriction coming from the use of this
+ file. (The General Public License restrictions do apply in other
+ respects; for example, they cover modification of the file, and
+ distribution when not linked into another program.)
+
+ This file is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with GCC to produce an executable, this does not cause
+ the resulting executable to be covered by the GNU General Public License.
+ This exception does not however invalidate any other reasons why
+ the executable file might be covered by the GNU General Public License.
+*/
+
+/*
+ Specifically for A/UX-MacOS Compatibility:
+ Replace exit with _exithk in crt files. The idea is that we want to
+ override exit and do additional things while being able to call the
+ original exit function as well.
+*/
+
+#include <filehdr.h>
+#include <syms.h>
+#include <stdio.h>
+
+main(int argc, char ** argv)
+{
+ struct filehdr hdr;
+ struct syment cursym;
+ FILE* targetfile;
+ int curpos, symnum;
+ int readb;
+
+ if( argc != 2 ) {
+ printf("argc = %d\n", argc);
+ printf("usage: crtfix [crt file]\n");
+ exit(1);
+ }
+
+ targetfile = fopen(argv[1], "r+");
+ if( !targetfile )
+ perror("opening file");
+
+ fread(&hdr, sizeof(struct filehdr), 1, targetfile);
+
+ readb = fseek(targetfile, hdr.f_symptr, SEEK_SET);
+
+ for(symnum=0; symnum < hdr.f_nsyms; symnum++)
+ {
+ curpos = ftell(targetfile);
+ readb = fread(&cursym, sizeof(struct syment), 1, targetfile);
+
+ if(cursym.n_zeroes != 0)
+ {
+ if((!strcmp(cursym.n_name, "exit")) &&
+ (cursym.n_scnum == 1))
+ {
+ fseek(targetfile, curpos, SEEK_SET);
+ strcpy(cursym.n_name, "_exithk");
+ fwrite(&cursym, sizeof(struct syment),
+ 1, targetfile);
+ break;
+ }
+ }
+ }
+ fclose(targetfile);
+}
diff -burN gcc-2.7.2.3.orig/aux-exit.c gcc-2.7.2.3/aux-exit.c
--- gcc-2.7.2.3.orig/aux-exit.c 1969-12-31 18:00:00.000000000 -0600
+++ gcc-2.7.2.3/aux-exit.c 1995-11-20 06:13:48.000000000 -0600
@@ -0,0 +1,4 @@
+/* Used under A/UX to perform cleanup for various programs. This is a
+ dummy version used when the mac libs aren't used */
+
+void _exithk(){ }
diff -burN gcc-2.7.2.3.orig/aux-fixcrts gcc-2.7.2.3/aux-fixcrts
--- gcc-2.7.2.3.orig/aux-fixcrts 1969-12-31 18:00:00.000000000 -0600
+++ gcc-2.7.2.3/aux-fixcrts 1995-12-05 08:41:36.000000000 -0600
@@ -0,0 +1,18 @@
+#! /bin/sh
+
+CRTDIR=${1-${CRTDIR-/usr/local/Gnu/lib/gcc/aux/2.7.2}}
+
+files=`echo /lib/*crt*.o /usr/lib/*crt*.o`
+
+cp $files $CRTDIR
+
+for file in $files; do
+ lfile=$CRTDIR/`basename $file`
+ ./aux-crtfix $lfile
+ fixout=`cmp $file $lfile`
+ if [ $? = 0 ]; then
+ rm $lfile
+ else
+ echo Fixed `basename $file`
+ fi
+done
diff -burN gcc-2.7.2.3.orig/aux-mcount.asm gcc-2.7.2.3/aux-mcount.asm
--- gcc-2.7.2.3.orig/aux-mcount.asm 1969-12-31 18:00:00.000000000 -0600
+++ gcc-2.7.2.3/aux-mcount.asm 1995-11-20 06:13:49.000000000 -0600
@@ -0,0 +1,11 @@
+#
+# Simple glue routine that handles the
+# fact that A/UXs profiling routine calls
+# 'mcount%' which gas can't handle, due to
+# the "%" sign...
+#
+# Must be assembled by A/UX's native 'as'
+#
+ global __mcount
+__mcount:
+ jmp mcount%
diff -burN gcc-2.7.2.3.orig/aux.h gcc-2.7.2.3/aux.h
--- gcc-2.7.2.3.orig/aux.h 1969-12-31 18:00:00.000000000 -0600
+++ gcc-2.7.2.3/aux.h 1995-11-20 06:13:49.000000000 -0600
@@ -0,0 +1,199 @@
+/* Definitions for Motorola 680x0 running A/UX and using GAS
+ Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#define TARGET_DEFAULT 7 /* 68020, 68881 */
+
+#include "m68k/m68k.h"
+
+#define CPP_PREDEFINES \
+"-Dunix -Dm68k -DAUX -DmacII \
+-Asystem(unix) -Asystem(AUX) \
+-Acpu(m68k) -Acpu(mc68000) \
+-Amachine(m68k) -Amachine(macII)"
+
+#define CPP_SPEC \
+"%{!msoft-float:%{!ansi:-Dmc68881 }-D__HAVE_68881__ }\
+-D__mc68000__ %{!ansi:-Dmc68000 }\
+%{!mc68000:%{!m68000:-Acpu(mc68020) -D__mc68020__ %{!ansi:-Dmc68020 }}}\
+%{m68030:-Acpu(mc68030) -D__mc68030__ %{!ansi:-Dmc68030 }}\
+%{m68040:-Acpu(mc68040) -D__mc68040__ %{!ansi:-Dmc68040 }}\
+%{!ansi:%{!traditional:-D__STDC__=2 }}\
+%{sbsd:-D_BSD_SOURCE -DBSD }%{ZB:-D_BSD_SOURCE -DBSD }\
+%{ssysv:-D_SYSV_SOURCE -DSYSV -DUSG }%{ZS:-D_SYSV_SOURCE -DSYSV -DUSG }\
+%{sposix:-D_POSIX_SOURCE -DPOSIX }%{ZP:-D_POSIX_SOURCE -DPOSIX }\
+%{saux:-D_AUX_SOURCE }%{ZA:-D_AUX_SOURCE }\
+%{!sbsd:%{!ZB:%{!ssysv:%{!ZS:%{!sposix:%{!ZP:%{!snone:\
+-D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE }}}}}}}"
+
+/* For /bin/ld */
+#define LINK_SPEC \
+"%{p:-L/lib/libp -L/usr/lib/libp }%{pg:-L/lib/libp -L/usr/lib/libp }\
+%{smac:low.ld%s }%{!smac:shlib.ld%s }"
+
+#define LIB_SPEC \
+"%{sbsd:-lbsd }%{ZB:-lbsd }\
+%{ssysv:-lsvid }%{ZS:-lsvid }\
+%{sposix:-lposix }%{ZP:-lposix }\
+%{static:%{smac:-lmac -lat -lld -lmr }-lc }\
+%{!static:%{smac:-lmac_s -lat -lld -lmr }-lc_s }"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
+"%{pg:mcrt0.o%s }%{!pg:%{p:mcrt0.o%s }\
+%{!p:%{smac:maccrt0.o%s low.o%s }%{!smac:crt1.o%s }}}\
+crt2.o%s "
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtn.o%s "
+
+
+/*===================================================================*/
+
+/* No we need to use collect2... gld and A/UX has problems */
+#define NM_FLAGS ""
+#define OBJECT_FORMAT_COFF
+#define MY_ISCOFF(magic) ((magic) == MC68MAGIC)
+
+#define NO_SYS_SIGLIST
+
+/* Provide support for pascal strings */
+#define AUX_PASCAL_STRINGS
+
+/* Resize standard types */
+#undef SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "unsigned int"
+
+/* Every structure or union's size must be a multiple of 2 bytes. */
+#define STRUCTURE_SIZE_BOUNDARY 16
+
+/* Generate calls to memcpy, memcmp and memset, as opposed to bcopy, bcmp,
+ and bzero */
+#define TARGET_MEM_FUNCTIONS
+
+/* We call a different function for profiling (__mcount, which is actually
+ a glue routine which calls A/UX's mcount%, which gas cannot generate). */
+
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+ asm_fprintf (FILE, "\tlea %LLP%d,%Ra0\n\tjbsr __mcount\n", (LABELNO))
+
+/* Define how to generate (in the callee) the output value of a function
+ and how to find (in the caller) the value returned by a function. VALTYPE
+ is the data type of the value (as a tree). If the precise function being
+ called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0.
+ For A/UX generate the result in d0, a0, or fp0 as appropriate. */
+
+#undef FUNCTION_VALUE
+#define FUNCTION_VALUE(VALTYPE, FUNC) \
+ (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
+ ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
+ : (TREE_CODE (VALTYPE) == POINTER_TYPE \
+ ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
+ : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
+
+#undef LIBCALL_VALUE
+#define LIBCALL_VALUE(MODE) \
+ gen_rtx (REG, (MODE), ((TARGET_68881 && ((MODE) == SFmode || (MODE) == DFmode)) ? 16 : 0))
+
+/* 1 if N is a possible register number for a function value.
+ For A/UX allow d0, a0, or fp0 as return registers, for integral,
+ pointer, or floating types, respectively. Reject fp0 if not using a
+ 68881 coprocessor. */
+
+#undef FUNCTION_VALUE_REGNO_P
+#define FUNCTION_VALUE_REGNO_P(N) \
+ ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
+
+/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
+ more than one register. */
+
+#undef NEEDS_UNTYPED_CALL
+#define NEEDS_UNTYPED_CALL 1
+
+/* For compatibility with the large body of existing code which does not
+ always properly declare external functions returning pointer types, the
+ A/UX convention is to copy the value returned for pointer functions
+ from a0 to d0 in the function epilogue, so that callers that have
+ neglected to properly declare the callee can still find the correct return
+ value. */
+
+#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
+{ extern int current_function_returns_pointer; \
+ if ((current_function_returns_pointer) && \
+ ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
+ asm_fprintf (FILE, "\tmovl %Ra0,%Rd0\n"); \
+}
+
+#undef ASM_FILE_START
+#define ASM_FILE_START(FILE) \
+do { fprintf((FILE), "#NO_APP\n"); \
+ output_file_directive ((FILE), main_input_filename); \
+ } while (0)
+
+/*
+ The below are taken from m68k/coff.h. We don't just include
+ the file since we'd need to undefine stuff from there.
+ It's a toss-up
+ */
+
+#undef DBX_DEBUGGING_INFO
+#define SDB_DEBUGGING_INFO
+
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
+
+/* COFF symbols don't start with an underscore. */
+
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX ""
+
+/* Use a prefix for local labels, just to be on the save side. */
+
+#undef LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX "."
+
+/* Use a register prefix to avoid clashes with external symbols (classic
+ example: `extern char PC;' in termcap). */
+
+#undef REGISTER_PREFIX
+#define REGISTER_PREFIX "%"
+
+/* In the machine description we can't use %R, because it will not be seen
+ by ASM_FPRINTF. (Isn't that a design bug?). */
+
+#undef REGISTER_PREFIX_MD
+#define REGISTER_PREFIX_MD "%%"
+
+/* config/m68k.md has an explicit reference to the program counter,
+ prefix this by the register prefix. */
+
+#define ASM_RETURN_CASE_JUMP return "jmp %%pc@(2,%0:w)"
+
+/* Here are the new register names. */
+
+#undef REGISTER_NAMES
+#define REGISTER_NAMES \
+{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
+ "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
+ "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" }
+
diff -burN gcc-2.7.2.3.orig/c-lex.c gcc-2.7.2.3/c-lex.c
--- gcc-2.7.2.3.orig/c-lex.c 1995-06-15 06:11:39.000000000 -0500
+++ gcc-2.7.2.3/c-lex.c 1995-11-20 06:13:38.000000000 -0600
@@ -848,6 +848,14 @@
if (pedantic)
pedwarn ("non-ANSI escape sequence `\\%c'", c);
return c;
+#ifdef AUX_PASCAL_STRINGS
+ /* Return a special code so that the string constructor can leave a
+ hole and patch in the string length later */
+ case 'p':
+ if (pedantic)
+ pedwarn ("non-ANSI escape sequence `\\p'");
+ return -2;
+#endif
}
if (c >= 040 && c < 0177)
pedwarn ("unknown escape sequence `\\%c'", c);
@@ -1729,8 +1737,10 @@
num_chars = max_chars;
error ("character constant too long");
}
+#ifndef AUX /* Many Mac programs use multi-character constants */
else if (num_chars != 1 && ! flag_traditional)
warning ("multi-character character constant");
+#endif
/* If char type is signed, sign-extend the constant. */
if (! wide_flag)
@@ -1781,6 +1791,9 @@
case '"':
string_constant:
{
+#ifdef AUX_PASCAL_STRINGS
+ int pascalstring = FALSE;
+#endif
c = getc (finput);
p = token_buffer + 1;
@@ -1792,6 +1805,19 @@
c = readescape (&ignore);
if (ignore)
goto skipnewline;
+#ifdef AUX_PASCAL_STRINGS
+ /* readescape() returns -2 to indicate "\p" */
+ if (c == -2)
+ {
+ if (p == token_buffer + 1)
+ pascalstring = TRUE, c = '\0';
+ else
+ {
+ warning ("ignoring pascal string flag (`\\p') not at beginning of string");
+ c = 'p';
+ }
+ }
+#endif
if (!wide_flag
&& TYPE_PRECISION (char_type_node) < HOST_BITS_PER_INT
&& c >= (1 << TYPE_PRECISION (char_type_node)))
@@ -1816,6 +1842,16 @@
if (c < 0)
error ("Unterminated string constant");
+#ifdef AUX_PASCAL_STRINGS
+ if (pascalstring)
+ {
+ int len;
+ token_buffer[1] = len = p - token_buffer - 2;
+ if (len >= (1 << BITS_PER_UNIT))
+ warning ("Pascal string too long");
+ }
+#endif
+
/* We have read the entire constant.
Construct a STRING_CST for the result. */
diff -burN gcc-2.7.2.3.orig/config/m68k/m68k.c gcc-2.7.2.3/config/m68k/m68k.c
--- gcc-2.7.2.3.orig/config/m68k/m68k.c 1995-09-28 13:00:17.000000000 -0500
+++ gcc-2.7.2.3/config/m68k/m68k.c 1995-11-20 06:13:50.000000000 -0600
@@ -256,7 +256,11 @@
{
int regno;
- if (!reload_completed || frame_pointer_needed || get_frame_size () != 0)
+ if (!reload_completed || frame_pointer_needed || get_frame_size () != 0
+#ifdef AUX
+ || current_function_returns_pointer
+#endif
+ )
return 0;
/* Copied from output_function_epilogue (). We should probably create a
diff -burN gcc-2.7.2.3.orig/config.guess gcc-2.7.2.3/config.guess
--- gcc-2.7.2.3.orig/config.guess 1997-06-24 13:42:50.000000000 -0500
+++ gcc-2.7.2.3/config.guess 2019-09-27 12:50:32.544455789 -0500
@@ -434,6 +434,9 @@
echo ns32k-sni-sysv
fi
exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
diff -burN gcc-2.7.2.3.orig/config.sub gcc-2.7.2.3/config.sub
--- gcc-2.7.2.3.orig/config.sub 1997-06-24 13:42:50.000000000 -0500
+++ gcc-2.7.2.3/config.sub 2019-09-27 12:50:32.546154418 -0500
@@ -91,7 +91,8 @@
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
os=
basic_machine=$1
;;
@@ -200,6 +201,10 @@
basic_machine=m68k-apollo
os=-sysv
;;
+ apple | aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
balance)
basic_machine=ns32k-sequent
os=-dynix
@@ -651,7 +656,7 @@
| -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* )
+ | -udi* | -eabi* | -lites* | -aux* )
# Remember, each alternative MUST END IN *, to match a version number.
;;
-sunos5*)
@@ -731,6 +736,9 @@
*-acorn)
os=-riscix1.2
;;
+ m68*-apple)
+ os=-aux
+ ;;
arm*-semi)
os=-aout
;;
@@ -869,6 +877,9 @@
-vxworks*)
vendor=wrs
;;
+ -aux*)
+ vendor=apple
+ ;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
diff -burN gcc-2.7.2.3.orig/configure gcc-2.7.2.3/configure
--- gcc-2.7.2.3.orig/configure 1997-08-13 12:23:24.000000000 -0500
+++ gcc-2.7.2.3/configure 2019-09-27 12:50:32.548521184 -0500
@@ -1566,6 +1566,15 @@
# we want them from GCC.
extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
;;
+ m68k-apple-aux*) # Apple Macintosh running A/UX
+ xm_file=m68k/xm-aux.h
+ tm_file=m68k/aux.h
+ xmake_file=m68k/x-aux
+ broken_install=yes
+ use_collect2=yes
+ install_headers_dir=install-headers-cpio
+ extra_headers=math-68881.h
+ ;;
m88k-dg-dgux*)
case $machine in
m88k-dg-dguxbcs*)
diff -burN gcc-2.7.2.3.orig/fixincludes gcc-2.7.2.3/fixincludes
--- gcc-2.7.2.3.orig/fixincludes 1996-06-29 11:26:49.000000000 -0500
+++ gcc-2.7.2.3/fixincludes 2019-09-27 12:50:32.550360121 -0500
@@ -2492,6 +2492,24 @@
fi
fi
+# This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89; gcc
+# doesn't understand it.
+file=sys/param.h
+if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
+ cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
+ chmod +w ${LIB}/$file 2>/dev/null
+ chmod a+r ${LIB}/$file 2>/dev/null
+fi
+
+if [ -r ${LIB}/$file ]; then
+ echo "Fixing __asm directive in sys/param.h"
+ sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
+ ${LIB}/$file > ${LIB}/${file}.sed
+ rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+ if cmp $file ${LIB}/$file >/dev/null 2>&1; then
+ rm -f ${LIB}/$file
+ fi
+fi
# This loop does not appear to do anything, because it uses file
# rather than $file when setting target. It also appears to be
diff -burN gcc-2.7.2.3.orig/gcc.c gcc-2.7.2.3/gcc.c
--- gcc-2.7.2.3.orig/gcc.c 1997-06-24 13:42:50.000000000 -0500
+++ gcc-2.7.2.3/gcc.c 2019-09-27 12:50:32.552781417 -0500
@@ -2878,11 +2878,19 @@
/* Null-terminate the vector. */
switches[n_switches].args[j] = 0;
}
+#ifdef AUX
+ else if (c == 'o')
+ {
+ /* On A/UX, ld cannot handle -o without space.
+ So split the -o from its argument. */
+ switches[n_switches].part1 = "o";
+#else
else if (*switches_need_spaces != 0 && (c == 'o' || c == 'L'))
{
/* On some systems, ld cannot handle -o or -L without space.
So split the -o or -L from its argument. */
switches[n_switches].part1 = (c == 'o' ? "o" : "L");
+#endif
switches[n_switches].args = (char **) xmalloc (2 * sizeof (char *));
switches[n_switches].args[0] = xmalloc (strlen (p));
strcpy (switches[n_switches].args[0], &p[1]);
diff -burN gcc-2.7.2.3.orig/libgcc2.c gcc-2.7.2.3/libgcc2.c
--- gcc-2.7.2.3.orig/libgcc2.c 1995-11-26 13:39:21.000000000 -0600
+++ gcc-2.7.2.3/libgcc2.c 1995-12-05 08:34:40.000000000 -0600
@@ -2190,6 +2190,10 @@
extern void __do_global_dtors ();
extern void _cleanup ();
extern void _exit () __attribute__ ((noreturn));
+#ifdef AUX
+extern void _exithk ();
+#endif
+
void
exit (status)
@@ -2202,6 +2206,9 @@
EXIT_BODY;
#else
_cleanup ();
+#ifdef AUX
+ _exithk();
+#endif
#endif
_exit (status);
}
diff -burN gcc-2.7.2.3.orig/x-aux gcc-2.7.2.3/x-aux
--- gcc-2.7.2.3.orig/x-aux 1969-12-31 18:00:00.000000000 -0600
+++ gcc-2.7.2.3/x-aux 1995-11-20 06:13:50.000000000 -0600
@@ -0,0 +1,21 @@
+# Makefile additions for A/UX
+
+LIB2FUNCS_EXTRA=aux-mcount.o aux-exit.c
+FIXPROTO_DEFINES = -D_POSIX_SOURCE
+EXTRA_PASSES=ld aux-crtfix
+CLIB=-lld # needed for collect2
+INSTALL=cp
+
+# needed to support builds for multiple versions of A/UX
+LDFLAGS=-static
+
+aux-mcount.o: $(srcdir)/config/m68k/aux-mcount.asm $(GCC_PASSES)
+ /bin/as -o aux-mcount.o $(srcdir)/config/m68k/aux-mcount.asm
+
+aux-exit.c: $(srcdir)/config/m68k/aux-exit.c
+ cp $(srcdir)/config/m68k/aux-exit.c aux-exit.c
+
+aux-crtfix: $(srcdir)/config/m68k/aux-crtfix.c
+ $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(srcdir)/config/m68k/aux-crtfix.c \
+ $(LIBS) -o aux-crtfix
+
diff -burN gcc-2.7.2.3.orig/xm-aux.h gcc-2.7.2.3/xm-aux.h
--- gcc-2.7.2.3.orig/xm-aux.h 1969-12-31 18:00:00.000000000 -0600
+++ gcc-2.7.2.3/xm-aux.h 1995-11-20 06:13:50.000000000 -0600
@@ -0,0 +1,9 @@
+#ifndef USG
+#define USG
+#endif
+
+#ifndef AUX
+#define AUX
+#endif
+
+#include "m68k/xm-m68k.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment