Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gcc-2.7.2-cdk.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates build-essential gcc gcc-multilib wget byacc

WORKDIR /work
RUN wget https://github.com/ser-pounce/cdk-gcc/archive/refs/tags/b18.tar.gz
RUN wget https://github.com/decompals/old-gcc/releases/download/0.14/b18.tar.gz
RUN tar xzf b18.tar.gz

WORKDIR /work/cdk-gcc-b18
Expand All @@ -13,9 +13,10 @@ COPY patches /work/patches
RUN patch -u -p1 Makefile.in -i ../patches/Makefile-2.7.2-cdk.in.patch
RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2-cdk.h.patch
RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.7-cdk.patch
RUN patch -su -p1 < ../patches/psx-2.7.2-cdk.patch

RUN ./configure \
--target=mips-linux-gnu \
--target=mips-sony-psx \
--prefix=/opt/cross \
--with-endian-little \
--with-gnu-as \
Expand Down
11 changes: 10 additions & 1 deletion patches/Makefile-2.7.2-cdk.in.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Makefile.in b/Makefile.in
index 15739a5..27045d2 100644
index 15739a5..24ff26a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1339,7 +1339,7 @@ convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
Expand All @@ -11,6 +11,15 @@ index 15739a5..27045d2 100644
# END CYGNUS LOCAL
print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) flags.h function.h
@@ -1348,7 +1348,7 @@ toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) bytecode.h bc-emit.h \
flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
$(lang_options_files)
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
- -DTARGET_NAME=\"$(target_alias)\" \
+ -DTARGET_NAME=\"SonyPSX\" \
-c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`

rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
@@ -1385,7 +1385,7 @@ dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h except.h \
Expand Down
194 changes: 194 additions & 0 deletions patches/psx-2.7.2-cdk.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
diff --color -ruN -p1 gcc-2.6.3/config/mips/psx.h gcc-2.6.3-psx/config/mips/psx.h
--- gcc-2.6.3/config/mips/psx.h 1970-01-01 01:00:00.000000000 +0100
+++ gcc-2.6.3-psx/config/mips/psx.h 2023-03-26 13:52:13.400875920 +0100
@@ -0,0 +1,108 @@
+/* Definitions of target machine for GNU compiler. Iris version.
+ Copyright (C) 1991, 1993, 1995, 1996 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, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+
+/* Definitions by GIL for PSX */
+
+#define TARGET_DEFAULT (MASK_GAS+MASK_SOFT_FLOAT)
+
+#define CPP_PREDEFINES "-Dmips -DMIPSEL"
+
+#define STARTFILE_SPEC "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
+
+#define CPP_SPEC "\
+%{!ansi:-D__EXTENSIONS__} -D_MIPSEL \
+%{.S: -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
+%{.s: -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
+%{.cc: -D_LANGUAGE_C_PLUS_PLUS} \
+%{.cxx: -D_LANGUAGE_C_PLUS_PLUS} \
+%{.C: -D_LANGUAGE_C_PLUS_PLUS} \
+%{.m: -D_LANGUAGE_OBJECTIVE_C} \
+%{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} \
+%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
+%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
+%{mips3:-U__mips -D__mips=3}"
+
+#define LIB_SPEC \
+ "%{!p:%{!pg:%{!static:%{!g*:-lc_s}} -lc}}%{p:-lc_p}%{pg:-lc_p} crtn.o%s"
+
+#define MACHINE_TYPE "Sony Playstation"
+
+#define TARGET_ENDIAN_DEFAULT 0
+
+/* A C statement to output something to the assembler file to switch to section
+ NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
+ NULL_TREE. Some target formats do not support arbitrary sections. Do not
+ define this macro in such cases. */
+
+#define ASM_OUTPUT_SECTION_NAME(FILE, NAME) \
+ fprintf (FILE, "\t.section %s,\"aw\",@progbits\n", (NAME))
+
+/* GIL: R3000 machine supports ISA 1 */
+#define MIPS_ISA_DEFAULT 1
+/* GIL: set to r3000 */
+#define MIPS_CPU_STRING_DEFAULT "3000"
+
+/* End of GIL for PSX */
+
+
+#define SGI_TARGET 1 /* inform other mips files this is SGI */
+
+/* Always use 1 for .file number. I [meissner@osf.org] wonder why
+ IRIS needs this. */
+
+#define SET_FILE_NUMBER() ++num_source_filenames
+
+/* Put out a label after a .loc. I [meissner@osf.org] wonder why
+ IRIS needs this. */
+
+#define LABEL_AFTER_LOC(STREAM) fprintf (STREAM, "LM%d:\n", ++sym_lineno)
+
+#define STACK_ARGS_ADJUST(SIZE) \
+{ \
+ SIZE.constant += 4; \
+ if (SIZE.constant < 32) \
+ SIZE.constant = 32; \
+}
+
+/* Do not allow `$' in identifiers. */
+
+#define DOLLARS_IN_IDENTIFIERS 0
+
+/* Tell G++ not to create constructors or destructors with $'s in them. */
+
+#define NO_DOLLAR_IN_LABEL 1
+
+/* Specify wchar_t type. */
+#define WCHAR_TYPE "unsigned char"
+#define WCHAR_TYPE_SIZE BITS_PER_UNIT
+
+/* Generate calls to memcpy, etc., not bcopy, etc. */
+#define TARGET_MEM_FUNCTIONS
+
+/* Xeeynamo: force to use little-endian */
+#define MIPSEL
+#define BYTES_BIG_ENDIAN 0
+#define WORDS_BIG_ENDIAN 0
+
+/* Plain char is unsigned in the SGI compiler. */
+#define DEFAULT_SIGNED_CHAR 0
+
+#include "mips/mips.h"
diff --color -ruN -p1 gcc-2.6.3/config/mips/xm-psx.h gcc-2.6.3-psx/config/mips/xm-psx.h
--- gcc-2.6.3/config/mips/xm-psx.h 1970-01-01 01:00:00.000000000 +0100
+++ gcc-2.6.3-psx/config/mips/xm-psx.h 2023-03-26 13:52:13.402875923 +0100
@@ -0,0 +1,12 @@
+#define USG
+
+#include "mips/xm-mips.h"
+
+#define USG
+#define HAVE_VPRINTF
+
+/*
+#define bcopy(a,b,c) memcpy (b,a,c)
+#define bzero(a,b) memset (a,0,b)
+#define bcmp(a,b,c) memcmp (a,b,c)
+*/
\ No newline at end of file
diff --color -ruN -p1 gcc-2.6.3/config.sub gcc-2.6.3-psx/config.sub
--- gcc-2.6.3/config.sub 1994-10-26 18:23:05.000000000 +0000
+++ gcc-2.6.3-psx/config.sub 2023-03-26 13:53:36.046989327 +0100
@@ -420,2 +420,6 @@ case $basic_machine in
;;
+ psx)
+ basic_machine=mips-sony
+ os=-psx
+ ;;
rtpc | rtpc-*)
@@ -636,2 +640,5 @@ case $os in
;;
+ -psx)
+ os=-psx
+ ;;
-none)
diff --color -ruN -p1 gcc-2.6.3/configure gcc-2.6.3-psx/configure
--- gcc-2.6.3/configure 1994-11-23 22:26:27.000000000 +0000
+++ gcc-2.6.3-psx/configure 2023-03-26 13:54:03.941012094 +0100
@@ -1471,2 +1471,20 @@ for machine in $canon_build $canon_host
;;
+ mips-sony-psx*) # Sony Playstation
+ tm_file=mips/psx.h
+ xm_file=mips/xm-psx.h
+ elf=yes
+ gnu_ld=yes
+ gas=yes
+ DEFS=-Dpsx -D__psx__ -D__psx
+ if [ x$gas = xyes ]
+ then
+ tmake_file=mips/t-mips-gas
+ else
+ extra_passes="mips-tfile mips-tdump"
+ fi
+ if [ x$gnu_ld != xyes ]
+ then
+ use_collect2=yes
+ fi
+ ;;
mips-sony-sysv*) # Sony NEWS 3800 with NEWSOS5.0.
diff --color -ruN -p1 gcc-2.7.2/version.c gcc-2.7.2-psx/version.c
--- gcc-2.7.2/version.c 1994-11-23 22:26:27.000000000 +0000
+++ gcc-2.7.2-psx/version.c 2023-03-26 13:54:03.941012094 +0100
@@ -1,1 +1,1 @@
-char *version_string = "cygnus-2.7.2-970404";
+char *version_string = "cygnus-2.7.2-970404 SN32.3.7.0004";
diff --git a/toplev.c b/toplev.c
index 48722cb..c579f66 100644
--- a/toplev.c
+++ b/toplev.c
@@ -4675,14 +4675,7 @@ print_version (file, indent)
#endif
/* END CYGNUS LOCAL -- Haifa scheduler */
fprintf (file, " (%s)", TARGET_NAME);
-#ifdef __GNUC__
-#ifndef __VERSION__
-#define __VERSION__ "[unknown]"
-#endif
- fprintf (file, " compiled by GNU C version %s.\n", __VERSION__);
-#else
fprintf (file, " compiled by CC.\n");
-#endif
}

/* Print an option value and return the adjusted position in the line.
Loading