Applied 'gcc-2.8.1-with-naked.diff'

This commit is contained in:
Ethan Roseman 2020-09-21 09:09:56 -04:00
parent 57261bd1c1
commit 253149a88a
27 changed files with 4336 additions and 3305 deletions

View File

@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#include "machmode.h"
#include "rtl.h"

View File

@ -1406,7 +1406,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
char *errmsg = 0;
if (TREE_CODE_CLASS (TREE_CODE (olddecl)) == 'd')
DECL_MACHINE_ATTRIBUTES (newdecl) = DECL_MACHINE_ATTRIBUTES (olddecl);
DECL_MACHINE_ATTRIBUTES (newdecl) = merge_attributes(DECL_MACHINE_ATTRIBUTES (olddecl), DECL_MACHINE_ATTRIBUTES (newdecl));
if (TREE_CODE (newtype) == ERROR_MARK
|| TREE_CODE (oldtype) == ERROR_MARK)

View File

@ -165,7 +165,7 @@ static struct resword wordlist[] =
#ifdef __GNUC__
inline
#endif
struct resword *
static struct resword *
is_reserved_word (str, len)
register char *str;
register unsigned int len;

View File

@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#include "insn-flags.h"

133
cccp.c
View File

@ -109,7 +109,7 @@ extern char *getenv ();
# define PRINTF_DCL(msg)
# define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
#else
# include <varargs.h>
# include <stdarg.h>
# define PRINTF_ALIST(msg) msg, va_alist
# define PRINTF_DCL(msg) char *msg; va_dcl
# define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
@ -1163,6 +1163,42 @@ safe_read (desc, ptr, len)
retrying if necessary, and treating any real error as fatal.
If MAX_WRITE_LEN is defined, write at most that many bytes at a time. */
#ifdef NU64
enum { KANJI_OFF = 0, KANJI_SJIS, KANJI_EUC };
static n64kanji_flag = KANJI_OFF; /* by default, KANJI OFF mode */
#define KANJIENV "N64GCC_KANJI"
static void
kanjienv_check ()
{
char *n64kanji_env;
n64kanji_env = getenv("N64GCC_KANJI");
if ( !strcasecmp( n64kanji_env, "SJIS" ) ) {
n64kanji_flag = KANJI_SJIS;
} else if ( !strcasecmp( n64kanji_env, "EUC" ) ) {
n64kanji_flag = KANJI_EUC;
} else if ( !strcasecmp( n64kanji_env, "OFF" ) ) {
n64kanji_flag = KANJI_OFF;
}
}
static int
iskanji1( c )
U_CHAR c;
{
switch ( n64kanji_flag ) {
case KANJI_OFF:
return 0;
case KANJI_EUC:
return (c >= 0xa1 && c <= 0xfe);
case KANJI_SJIS:
default:
return (c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc);
}
}
#endif /* NU64 */
static void
safe_write (desc, ptr, len)
int desc;
@ -1171,6 +1207,39 @@ safe_write (desc, ptr, len)
{
int wcount, written;
#ifdef NU64
U_CHAR *rptr, *wbuf, *wptr;
int tlen, rlen = len;
if(n64kanji_flag != KANJI_OFF) {
rptr = ptr, wptr = NULL;
while(rlen--) {
U_CHAR c = *rptr++;
if (wptr) {
int wlen = wptr - wbuf;
if (tlen <= wlen + 8) {
wbuf = (char *)realloc(wbuf, tlen += 0x1000);
wptr = wbuf + wlen;
}
}
if ( iskanji1( c ) ) {
if (!wptr) {
wbuf = (char *)malloc(tlen = len + 0x1000);
memcpy(wbuf, ptr, len - rlen -1);
wptr = wbuf + len - rlen - 1;
}
sprintf(wptr, "\\%03o", c), wptr += 4;
if (rlen--) sprintf(wptr, "\\%03o", *rptr++), wptr += 4;
} else {
if (wptr) *wptr++ = c;
}
}
if (wptr) {
ptr = wbuf;
len = wptr - wbuf;
}
}
#endif
while (len > 0) {
wcount = len;
#ifdef MAX_WRITE_LEN
@ -1191,6 +1260,31 @@ safe_write (desc, ptr, len)
}
}
#ifdef NU64
void
nu64cutcr(bufp, lenp)
char **bufp;
int *lenp;
{
char *wptr, *rptr, *n64cutcr_env;
int wsize = *lenp;
static n64cutcr_flag = -1;
if (n64cutcr_flag == -1) {
n64cutcr_env = getenv("N64GCC_CUTCR");
n64cutcr_flag = (n64cutcr_env && !strcasecmp(n64cutcr_env, "ON") ? 1:0);
}
if (n64cutcr_flag) {
wptr = rptr = *bufp;
while(wsize--) {
if (*rptr == 0x0d && rptr[1] == 0x0a && wsize) rptr++, wsize--, (*lenp)--;
*wptr++ = *rptr++;
}
if ((*bufp)[(*lenp)-1] == 0x1a) (*bufp)[--(*lenp)] = '\0';
}
}
#endif
int
main (argc, argv)
int argc;
@ -1876,6 +1970,10 @@ main (argc, argv)
}
}
#ifdef NU64
kanjienv_check();
#endif
append_include_chain (before_system, last_before_system);
first_system_include = before_system;
@ -2107,6 +2205,9 @@ main (argc, argv)
fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);
}
fp->length = size;
#ifdef NU64
nu64cutcr(&fp->buf, &fp->length);
#endif
} else {
/* Read a file whose size we can determine in advance.
For the sake of VMS, st.st_size is just an upper bound. */
@ -2116,6 +2217,9 @@ main (argc, argv)
fp->buf = (U_CHAR *) xmalloc (s + 2);
fp->length = safe_read (f, (char *) fp->buf, s);
if (fp->length < 0) goto perror;
#ifdef NU64
nu64cutcr(&fp->buf, &fp->length);
#endif
}
fp->bufp = fp->buf;
fp->if_stack = if_stack;
@ -2788,6 +2892,12 @@ do { ip = &instack[indepth]; \
break;
}
*obp++ = *ibp;
#ifdef NU64
if ( iskanji1(*ibp) ) {
ibp++, *obp++ = *ibp++;
continue;
}
#endif
switch (*ibp++) {
case '\n':
++ip->lineno;
@ -2870,7 +2980,11 @@ do { ip = &instack[indepth]; \
while (++ibp < limit) {
if (*ibp == '\n') {
#ifdef NU64
if (ibp[-1] != '\\' || iskanji1( ibp[-2] )) {
#else
if (ibp[-1] != '\\') {
#endif
if (put_out_comments) {
bcopy ((char *) before_bp, (char *) obp, ibp - before_bp);
obp += ibp - before_bp;
@ -3352,7 +3466,12 @@ randomchar:
} else if (! traditional) {
*obp++ = ' ';
}
#ifdef NU64
for (ibp += 2; *ibp != '\n' || ibp[-1] == '\\' ||
!iskanji1( ibp[-2] ); ibp++)
#else
for (ibp += 2; *ibp != '\n' || ibp[-1] == '\\'; ibp++)
#endif
if (put_out_comments)
*obp++ = *ibp;
} else
@ -5057,6 +5176,9 @@ finclude (f, inc, op, system_header_p, dirptr)
on the number of bytes we can read. */
fp->length = safe_read (f, (char *) fp->buf, s);
if (fp->length < 0) goto nope;
#ifdef NU64
nu64cutcr(&fp->buf, &fp->length);
#endif
}
else if (S_ISDIR (inc->st.st_mode)) {
error ("directory `%s' specified in #include", fname);
@ -5084,6 +5206,9 @@ finclude (f, inc, op, system_header_p, dirptr)
}
fp->bufp = fp->buf;
fp->length = st_size;
#ifdef NU64
nu64cutcr(&fp->buf, &fp->length);
#endif
}
if ((fp->length > 0 && fp->buf[fp->length - 1] != '\n')
@ -5177,6 +5302,9 @@ check_precompiled (pcf, st, fname, limit)
length = safe_read (pcf, buf, s);
if (length < 0)
goto nope;
#ifdef NU64
nu64cutcr(&buf, &length);
#endif
}
else
abort ();
@ -7645,6 +7773,9 @@ skip_to_end_of_comment (ip, line_counter, nowarn)
if (*bp == '\n') {
if (bp[-1] != '\\')
break;
#ifdef NU64
if ( iskanji1( bp[-2] ) ) break;
#endif
if (!nowarn && warn_comments)
warning ("multiline `//' comment");
if (line_counter)

2646
cexp.c

File diff suppressed because it is too large Load Diff

2
cexp.y
View File

@ -128,7 +128,7 @@ struct arglist {
# define PRINTF_DCL(msg)
# define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
#else
# include <varargs.h>
# include <stdarg.h>
# define VA_START(va_list, var) va_start (va_list)
# define PRINTF_ALIST(msg) msg, va_alist
# define PRINTF_DCL(msg) char *msg; va_dcl

View File

@ -78,7 +78,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
/* Must precede rtl.h for FFS. */

10
config.sub vendored
View File

@ -616,6 +616,10 @@ case $basic_machine in
xps | xps100)
basic_machine=xps100-honeywell
;;
nu64)
basic_machine=mips-nintendo
os=-nu64
;;
none)
basic_machine=none-none
os=-none
@ -775,6 +779,9 @@ case $os in
-xenix)
os=-xenix
;;
-nu64)
os=-nu64
;;
-none)
;;
*)
@ -893,6 +900,9 @@ case $basic_machine in
f301-fujitsu)
os=-uxpv
;;
*-nu64)
os=-nu64
;;
*)
os=-none
;;

View File

@ -139,7 +139,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define MD_STARTFILE_PREFIX "/usr/lib/"
/* Macros to be automatically defined.
__CLASSIFY_TYPE__ is used in the <varargs.h> and <stdarg.h> header
__CLASSIFY_TYPE__ is used in the <stdarg.h> and <stdarg.h> header
files with DG/UX revision 5.40 and later. This allows GNU CC to
operate without installing the header files. */

View File

@ -70,7 +70,7 @@ Boston, MA 02111-1307, USA. */
#define CPU_DEFAULT MASK_88000
/* Macros to be automatically defined. __svr4__ is our extension.
__CLASSIFY_TYPE__ is used in the <varargs.h> and <stdarg.h> header
__CLASSIFY_TYPE__ is used in the <stdarg.h> and <stdarg.h> header
files with DG/UX revision 5.40 and later. This allows GNU CC to
operate without installing the header files. */

File diff suppressed because it is too large Load Diff

View File

@ -3514,6 +3514,12 @@ while (0)
See mips.c for the MIPS specific codes. */
/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
is a valid machine specific attribute for DECL.
The attributes in ATTRIBUTES have previously been assigned to DECL. */
#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
mips_valid_machine_decl_attribute(DECL, ATTRIBUTES, IDENTIFIER, ARGS)
#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
/* A C expression which evaluates to true if CODE is a valid

132
config/mips/nu64.h Normal file
View File

@ -0,0 +1,132 @@
/* Definitions of target machine for GNU compiler. MIPS GNU Hurd version.
Copyright (C) 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. */
#include <mips/gnu.h>
#include <dbx.h>
#define MIPS_ISA_DEFAULT 3
#define MIPS_CPU_STRING_DEFAULT "4300"
#undef TARGET_DEFAULT
#define TARGET_DEFAULT ( MASK_GAS | MASK_4300_MUL_FIX )
#undef CPP_PREDEFINES
#define CPP_PREDEFINES GNU_CPP_PREDEFINES("mips") \
" -DMIPSEB -DR4000 -DR4300 -D_MIPSEB -D_R4000 -D_R4300 \
-D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32"
#undef LOCAL_LABEL_PREFIX
#define LOCAL_LABEL_PREFIX "."
/* Enable debugging. */
#undef ASM_FILE_END
#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
#undef DWARF_DEBUGGING_INFO
#define DBX_DEBUGGING_INFO
#if 0
#define SDB_DEBUGGING_INFO
#define MIPS_DEBUGGING_INFO
/* GNU as does handle DWARF2 directives. */
#undef DWARF2_UNWIND_INFO
#define DWARF2_UNWIND_INFO 1
#undef ASM_OUTPUT_SOURCE_LINE
#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
mips_output_lineno (STREAM, LINE)
#endif
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_sdata
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
CONST_SECTION_FUNCTION \
CTORS_SECTION_FUNCTION \
DTORS_SECTION_FUNCTION \
SDATA_SECTION_FUNCTION
#define SDATA_SECTION_FUNCTION \
void \
sdata_section () \
{ \
if (in_section != in_sdata) \
{ \
fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
in_section = in_sdata; \
} \
}
/* ASM_SPEC is the set of arguments to pass to the assembler. */
#undef ASM_SPEC
#define ASM_SPEC "\
%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
%(subtarget_asm_optimizing_spec) \
%(subtarget_asm_debugging_spec) \
%{membedded-pic} \
%{mabi=32:-32}%{mabi=o32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \
%(target_asm_spec) \
%(subtarget_asm_spec)"
#undef LINK_SPEC
#define LINK_SPEC ""
#undef CC1_SPEC
#define CC1_SPEC "\
%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
%{mips1:-mfp32 -mgp32} %{mips2:-mfp32 -mgp32} %{mips3:-mfp32 -mgp32} \
%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \
%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \
%{m4650:-mcpu=r4650} \
%{m3900:-mips1 -mcpu=r3900 -mfp32 -mgp32} \
%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \
%{pic-none: -mno-half-pic} \
%{pic-lib: -mhalf-pic} \
%{pic-extern: -mhalf-pic} \
%{pic-calls: -mhalf-pic} \
%{save-temps: } \
%(subtarget_cc1_spec) "
#undef CPP_SPEC
#define CPP_SPEC "\
%{.cc: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
%{.cxx: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
%{.C: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
%{.m: -D__LANGUAGE_OBJECTIVE_C -D_LANGUAGE_OBJECTIVE_C -D__LANGUAGE_C -D_LANGUAGE_C} \
%{.S: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
%{.s: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
%{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D__LANGUAGE_C -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} \
%(subtarget_cpp_size_spec) \
%{mips3:-U__mips -D__mips=3} \
%{mips4:-U__mips -D__mips=4 -D__mips64} \
%{mgp32:-U__mips64} %{mgp64:-D__mips64} \
%{msingle-float:%{!msoft-float:-D__mips_single_float}} \
%{m4650:%{!msoft-float:-D__mips_single_float}} \
%{msoft-float:-D__mips_soft_float} \
%{mabi=eabi:-D__mips_eabi} \
%{EB:-UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__ -D_MIPSEB -D__MIPSEB -D__MIPSEB__ %{!ansi:-DMIPSEB}} \
%{EL:-UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__ -D_MIPSEL -D__MIPSEL -D__MIPSEL__ %{!ansi:-DMIPSEL}} \
%(long_max_spec) \
%(subtarget_cpp_spec) "

13
configure vendored
View File

@ -67,6 +67,7 @@ mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
DEFS=
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
@ -4483,6 +4484,16 @@ for machine in $build $host $target; do
;;
mips-*-gnu*)
;;
mips-nintendo-nu64) # Nintendo NU64
xm_file=mips/xm-sysv.h
tm_file=mips/nu64.h
elf=yes
gnu_ld=yes
gas=yes
xmake_file=mips/x-sysv
tmake_file=mips/t-mips-gas
DEFS=-DNU64
;;
mipsel-*-ecoff*)
tm_file=mips/ecoffl.h
if [ x$stabs = xyes ]; then
@ -5810,7 +5821,7 @@ fi
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
DEFS=-DHAVE_CONFIG_H
DEFS="-DHAVE_CONFIG_H $DEFS"
# Without the "./", some shells look in PATH for config.status.
: ${CONFIG_STATUS=./config.status}

View File

@ -29,7 +29,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#ifdef HAVE_STDLIB_H

View File

@ -39,7 +39,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#include "rtl.h"
#include "tree.h"

View File

@ -48,7 +48,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#include <stdio.h>
#include <ctype.h>

View File

@ -1416,7 +1416,7 @@ if [ -r ${INPUT}/$file ]; then
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#endif /* _SYS_VARARGS_H */

2
gcc.c
View File

@ -49,7 +49,7 @@ compilation is specified by a string called a "spec". */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#include <stdio.h>

View File

@ -100,7 +100,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#include <stdio.h>
#include "rtl.h"

View File

@ -603,7 +603,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#include <stdio.h>

View File

@ -418,7 +418,8 @@ __extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (void *)); \
*((void **)__o->next_free)++ = ((void *)datum); \
*((void **)__o->next_free) = ((void *)datum); \
__o->next_free += sizeof (void *); \
(void) 0; })
# define obstack_int_grow(OBSTACK,datum) \

View File

@ -68,7 +68,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#ifdef _WIN32
@ -80,7 +80,7 @@ static char *translate_name PROTO((char *));
static char *concat PVPROTO((char *, ...));
static char *save_string PROTO((char *, int));
#ifdef _WIN32
#if (defined(_WIN32) && !defined(__CYGWIN32__))
static char *lookup_key PROTO((char *));
static HKEY reg_key = (HKEY) INVALID_HANDLE_VALUE;
#endif
@ -95,7 +95,7 @@ get_key_value (key)
{
char *prefix = 0;
#ifdef _WIN32
#if (defined(_WIN32) && !defined(__CYGWIN32__))
prefix = lookup_key (key);
#endif
@ -175,7 +175,7 @@ save_string (s, len)
return result;
}
#ifdef _WIN32
#if (defined(_WIN32) && !defined(__CYGWIN32__))
/* Look up "key" in the registry, as above. */

View File

@ -57,7 +57,7 @@ Boston, MA 02111-1307, USA. */
#define _POSIX_SOURCE
#endif
#include <varargs.h>
#include <stdarg.h>
/* On some systems stdio.h includes stdarg.h;
we must bring in varargs.h first. */
#include <stdio.h>

View File

@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#include <stdio.h>
#include <signal.h>

2
tree.c
View File

@ -43,7 +43,7 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#include <stdarg.h>
#endif
#include <stdio.h>