diff -cr gcc-2.7/cccp.c \emx\gnu\gcc-2.7/cccp.c
*** gcc-2.7/cccp.c	Thu Oct 26 23:07:26 1995
--- \emx\gnu\gcc-2.7/cccp.c	Tue Aug 20 19:25:38 1996
***************
*** 1,3 ****
--- 1,4 ----
+ /* cccp.c -- changed for emx by Eberhard Mattes -- Aug 1996 */
  /* C Compatible Compiler Preprocessor (CCCP)
     Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
     Written by Paul Rubin, June 1986
***************
*** 383,388 ****
--- 384,397 ----
  
  static int print_deps_missing_files = 0;
  
+ #ifdef EMX
+ /* Nonzero means use .obj instead of .o for target file when printing
+    dependencies. */
+ 
+ static int omf = 0;
+ 
+ #endif /* EMX */
+ 
  /* Nonzero means print names of header files (-H).  */
  
  static int print_include_names = 0;
***************
*** 1344,1349 ****
--- 1353,1362 ----
    }
  #endif
  
+ #ifdef __EMX__
+   _emxload_env ("GCCLOAD");
+ #endif /* __EMX__ */
+ 
    in_fname = NULL;
    out_fname = NULL;
  
***************
*** 1794,1799 ****
--- 1807,1824 ----
  	inhibit_predefs = 1;
  	break;
  
+ #ifdef EMX
+       case 'Z':
+         if (!strcmp (argv[i], "-Zomf"))
+           omf = 1;
+         else if (!strcmp (argv[i], "-Zc++-comments")
+                  || !strcmp (argv[i], "-ZC++-comments"))
+           cplusplus_comments = 1;
+         else
+           fatal ("Invalid option `%s'", argv[i]);
+         break;
+ #endif /* EMX */
+ 
        case '\0': /* JF handle '-' as file name meaning stdin or stdout */
  	if (in_fname == NULL) {
  	  in_fname = "";
***************
*** 2207,2213 ****
--- 2232,2242 ----
  
        /* Supply our own suffix.  */
  #ifndef VMS
+ #ifndef EMX
        strcpy (q, ".o");
+ #else /* EMX */
+       strcpy (q, omf ? ".obj" : ".o");
+ #endif /* EMX */
  #else
        strcpy (q, ".obj");
  #endif
***************
*** 4483,4488 ****
--- 4512,4520 ----
  #ifdef DIR_SEPARATOR
        || *fbeg == DIR_SEPARATOR
  #endif
+ #ifdef __EMX__
+       || _fngetdrive (fbeg) != 0
+ #endif /* __EMX__ */
        ) {
      strncpy (fname, (char *) fbeg, flen);
      fname[flen] = 0;
diff -cr gcc-2.7/config/i386/i386.c \emx\gnu\gcc-2.7/config/i386/i386.c
*** gcc-2.7/config/i386/i386.c	Sun Oct 22 12:13:20 1995
--- \emx\gnu\gcc-2.7/config/i386/i386.c	Tue Aug 20 17:47:28 1996
***************
*** 1,3 ****
--- 1,4 ----
+ /* i386.c -- changed for emx by Eberhard Mattes -- Aug 1996 */
  /* Subroutines for insn-output.c for Intel X86.
     Copyright (C) 1988, 1992, 1994, 1995 Free Software Foundation, Inc.
  
***************
*** 44,49 ****
--- 45,54 ----
     even if the conditional was untrue.  */
  #endif
  
+ #ifdef EMX
+ extern char *current_function_fnname;
+ #endif /* EMX */
+ 
  #define AT_BP(mode) (gen_rtx (MEM, (mode), frame_pointer_rtx))
  
  extern FILE *asm_out_file;
***************
*** 1471,1476 ****
--- 1476,1513 ----
        output_asm_insn (AS2 (mov%L0,%0,%1), xops);
      }
  
+ #ifdef EMX
+   if (size >= PROBE_SIZE && TARGET_PROBE)
+     {
+       rtx emxops[2];
+ 
+       if (size <= PROBE_MAX_INLINE)
+ 	{
+ 	  int i, j;
+ 
+ 	  emxops[0] = const0_rtx;
+ 	  i = size; j = 0;
+           while (i >= PROBE_SIZE)
+             {
+               i -= PROBE_SIZE; j += PROBE_SIZE;
+ 	      emxops[1] = gen_rtx (MEM, QImode,
+ 				   gen_rtx (PLUS, Pmode,
+ 					    stack_pointer_rtx),
+ 				   gen_rtx (CONST_INT, SImode, -j));
+ 	      output_asm_insn (AS2 (test%B1,%0,%1), emxops);
+ 	    }
+ 	}
+       else
+ 	{
+ 	  emxops[0] = GEN_INT (size);
+ 	  emxops[1] = gen_rtx (MEM, QImode,
+ 			       gen_rtx (SYMBOL_REF, Pmode, "__probe"));
+ 	  output_asm_insn (AS1 (push%L0,%0), emxops);
+ 	  output_asm_insn (AS1 (call,%P1), emxops);
+ 	}
+     }
+ #endif /* EMX */
+ 
    if (size)
      output_asm_insn (AS2 (sub%L0,%2,%0), xops);
  
***************
*** 1524,1529 ****
--- 1561,1571 ----
    int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
  				  || current_function_uses_const_pool);
  
+ #ifdef EMX
+   if (TARGET_EPILOGUE)
+     return 0;
+ #endif /* EMX */
+ 
  #ifdef NON_SAVING_SETJMP
    if (NON_SAVING_SETJMP && current_function_calls_setjmp)
      return 0;
***************
*** 1556,1561 ****
--- 1598,1613 ----
    rtx xops[3];
    int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
  				  || current_function_uses_const_pool);
+ 
+ #ifdef EMX
+   if (TARGET_EPILOGUE)
+     {
+       char *lbl = alloca (strlen (current_function_fnname) + 8);
+       strcpy (lbl, "__POST$");
+       strcat (lbl, current_function_fnname);
+       ASM_OUTPUT_LABEL (asm_out_file, lbl);
+     }
+ #endif /* EMX */
  
    /* Compute the number of registers to pop */
  
diff -cr gcc-2.7/cplus-de.c \emx\gnu\gcc-2.7/cplus-de.c
*** gcc-2.7/cplus-de.c	Mon Aug 28 11:22:34 1995
--- \emx\gnu\gcc-2.7/cplus-de.c	Tue Aug 20 19:25:38 1996
***************
*** 1,3 ****
--- 1,4 ----
+ /* cplus-de.c -- changed for emx by Eberhard Mattes -- Aug 1996 */
  /* Demangler for GNU C++ 
     Copyright 1989, 1991, 1994, 1995 Free Software Foundation, Inc.
     Written by James Clark (jjc@jclark.uucp)
***************
*** 216,222 ****
  #endif
  
  static int
! demangle_template PARAMS ((struct work_stuff *work, const char **, string *,
  			   string *));
  
  static int
--- 217,223 ----
  #endif
  
  static int
! demangle_template PARAMS ((struct work_stuff *, const char **, string *,
  			   string *));
  
  static int
diff -cr gcc-2.7/explow.c \emx\gnu\gcc-2.7/explow.c
*** gcc-2.7/explow.c	Thu Jun 15 12:30:10 1995
--- \emx\gnu\gcc-2.7/explow.c	Tue Aug 20 19:25:38 1996
***************
*** 1,3 ****
--- 1,4 ----
+ /* explow.c -- changed for emx by Eberhard Mattes -- Aug 1996 */
  /* Subroutines for manipulating rtx's in semantically interesting ways.
     Copyright (C) 1987, 1991, 1994, 1995 Free Software Foundation, Inc.
  
***************
*** 773,778 ****
--- 774,816 ----
    if (adjust == const0_rtx)
      return;
  
+ #ifdef EMX
+   if (TARGET_PROBE &&
+           (GET_CODE (adjust) != CONST_INT || INTVAL (adjust) >= PROBE_SIZE))
+     {
+       int i, j;
+ 
+       if (GET_CODE (adjust) == CONST_INT && INTVAL (adjust) <= PROBE_MAX_INLINE)
+         {
+           i = INTVAL (adjust); j = 0;
+           while (i >= PROBE_SIZE)
+             {
+               i -= PROBE_SIZE; j += PROBE_SIZE;
+ /* (set (cc0) (and:QI (mem:QI (plus:SI (reg:SI 7 %esp) (const_int -j))
+                       (const_int 0)))) */
+               emit_insn (gen_rtx (SET, VOIDmode,
+                            cc0_rtx,
+                            gen_rtx (AND, QImode,
+                              gen_rtx (MEM, QImode,
+                                gen_rtx (PLUS, Pmode,
+                                  stack_pointer_rtx,
+                                  gen_rtx (CONST_INT, SImode, -j))),
+                              const0_rtx)));
+ /* (use (cc0)) */
+               emit_insn (gen_rtx (USE, VOIDmode, cc0_rtx));
+             }
+         }
+       else
+         {
+           emit_push_insn (adjust, SImode, 0, 0, 0, 0, 0, 0, 0, 0);
+ /* (call (mem:QI (symbol_ref:SI ("__probe"))) (const_int 1)) */
+           emit_insn (gen_rtx (CALL, VOIDmode,
+                        gen_rtx (MEM, QImode,
+                          gen_rtx (SYMBOL_REF, Pmode, "__probe")),
+                        const1_rtx));
+         }
+     }
+ #endif /* EMX */
    temp = expand_binop (Pmode,
  #ifdef STACK_GROWS_DOWNWARD
  		       sub_optab,
diff -cr gcc-2.7/gcc.c \emx\gnu\gcc-2.7/gcc.c
*** gcc-2.7/gcc.c	Tue Sep  3 20:27:36 1996
--- \emx\gnu\gcc-2.7/gcc.c	Tue Sep  3 20:15:52 1996
***************
*** 1,3 ****
--- 1,4 ----
+ /* gcc.c -- changed for emx by Eberhard Mattes -- Sep 1996 */
  /* Compiler driver program that can handle many languages.
     Copyright (C) 1987, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
  
***************
*** 120,125 ****
--- 121,132 ----
  #define NULL_PTR ((GENERIC_PTR)0)
  #endif
  
+ #ifdef __EMX__
+ #include <process.h>
+ #include <stdlib.h>
+ extern char *_getname();
+ #endif /* __EMX__ */
+ 
  #ifdef USG
  #define vfork fork
  #endif /* USG */
***************
*** 175,181 ****
--- 182,190 ----
  extern int errno;
  #endif
  
+ #ifndef __EMX__
  extern int sys_nerr;
+ #endif /* __EMX__ */
  #ifndef HAVE_STRERROR
  #if defined(bsd4_4)
  extern const char *const sys_errlist[];
***************
*** 267,272 ****
--- 276,292 ----
  /* Forward declaration for prototypes.  */
  struct path_prefix;
  
+ #ifdef EMX
+ /* Nonzero means create .obj files instead of .o files.  */
+ static int omf;
+ 
+ /* Nonzero means pipes are supported.  */
+ static int pipes_supported;
+ 
+ /* Name of first input file, for defaulting the output file. */
+ static char *first_infile;
+ #endif /* EMX */
+ 
  static void set_spec		PROTO((char *, char *));
  static struct compiler *lookup_compiler PROTO((char *, int, char *));
  static char *build_search_list	PROTO((struct path_prefix *, char *, int));
***************
*** 732,737 ****
--- 752,758 ----
  			%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\n }}}}}}";
  #else
  /* Use -L.  */
+ #ifndef EMX
  static char *link_command_spec = "\
  %{!fsyntax-only: \
   %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
***************
*** 741,746 ****
--- 762,786 ----
                          %{fbounds-checking:libcheck.a%s} \
  			%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
  			%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\n }}}}}}";
+ #else /* EMX */
+ static char *link_command_spec = "\
+ %{!fsyntax-only: \
+  %{!c:%{!M:%{!MM:%{!E:%{!S:%{!Zomf:ld}%{Zomf:emxomfld}\
+ 			%l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
+ 			%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\
+ 			%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+ 			%{static:} %{L*} %D %{T*} %o\
+                         %{fbounds-checking:-lcheck} \
+ 			%{!nostdlib:%{!nodefaultlibs:\
+ 			  -lc_alias \
+ 			  %{Zcrtdll=*:-lc_static -l%* -los2%{pg:_p} -lemx2}\
+ 			  %{!Zcrtdll:%{!Zcrtdll=*:%G %L %G\
+ 			     %{Zno-rte:-los2%{pg:_p}}\
+ 			     %{!Zno-rte:%{Zsys:-lsys -los2}\
+ 					%{!Zsys:-lemx -los2%{pg:_p} -lemx2}}}}\
+ 			  %{Zomf:-lend}}}\
+ 			%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\n }}}}}}";
+ #endif /* EMX */
  #endif
  
  /* A vector of options to give to the linker.
***************
*** 974,979 ****
--- 1014,1041 ----
  	  i++;
  	}
  
+ #ifdef EMX
+       /* Handle abbreviations.  Note that no abbreviation must expand
+          to more than two options.  */
+       else if (!strcmp (argv[i], "-Zmts"))
+ 	{
+ 	  newv[newindex++] = "-Zmt";
+ 	  newv[newindex++] = "-static";
+ 	  i++;
+ 	}
+       else if (!strcmp (argv[i], "-Zmtd"))
+ 	{
+ 	  newv[newindex++] = "-Zmt";
+ 	  newv[newindex++] = "-Zcrtdll=c_import";
+ 	  i++;
+ 	}
+       else if (!strcmp (argv[i], "-Zcrtdll"))
+ 	{
+ 	  newv[newindex++] = "-Zcrtdll=c_import";
+ 	  i++;
+ 	}
+ #endif /* EMX */
+ 
        /* Handle old-fashioned options--just copy them through,
  	 with their arguments.  */
        else if (argv[i][0] == '-')
***************
*** 991,996 ****
--- 1053,1062 ----
  	    nskip += 1;
  	  else if (! strcmp (p, "Xlinker"))
  	    nskip += 1;
+ #ifdef EMX
+ 	  else if (! strcmp (p, "Zlinker"))
+ 	    nskip += 1;
+ #endif /* EMX */
  
  	  /* Watch out for an option at the end of the command line that
  	     is missing arguments, and avoid skipping past the end of the
***************
*** 2026,2031 ****
--- 2092,2159 ----
  
  #endif
  
+ #ifdef __EMX__
+ 
+ static int
+ pexecute (search_flag, program, argv, not_last)
+      int search_flag;
+      char *program;
+      char *argv[];
+      int not_last;
+ {
+   int pid;
+   int pdes[2], org_stdin, org_stdout;
+   int input_desc = last_pipe_input;
+   int output_desc = STDOUT_FILE_NO;
+ 
+   /* If this isn't the last process, make a pipe for its output,
+      and record it as waiting to be the input to the next process.  */
+ 
+   if (not_last)
+     {
+       if (pipe (pdes) < 0)
+ 	pfatal_with_name ("pipe");
+       output_desc = pdes[WRITE_PORT];
+       last_pipe_input = pdes[READ_PORT];
+     }
+   else
+     last_pipe_input = STDIN_FILE_NO;
+ 
+   if (pipes_supported && input_desc != STDIN_FILE_NO)
+     {
+       org_stdin = dup (STDIN_FILE_NO);
+       dup2 (input_desc, STDIN_FILE_NO);
+       close (input_desc); 
+     }
+   if (pipes_supported && output_desc != STDOUT_FILE_NO)
+     {
+       org_stdout = dup (STDOUT_FILE_NO);
+       dup2 (output_desc, STDOUT_FILE_NO);
+       close (output_desc);
+     }
+   pid = (search_flag ? spawnv : spawnvp) (P_NOWAIT, program, argv);
+   if (pipes_supported && input_desc != STDIN_FILE_NO)
+     {
+       dup2 (org_stdin, STDIN_FILE_NO);
+       close (org_stdin);
+     }
+   if (pipes_supported && output_desc != STDOUT_FILE_NO)
+     {
+       dup2 (org_stdout, STDOUT_FILE_NO);
+       close (org_stdout);
+     }
+ 
+   if (pid == -1)
+     {
+       perror_exec (program);
+       exit (-1);
+     }
+ 
+   return pid;
+ }
+ 
+ #else /* not __EMX__ */
+ 
  #if !defined(__MSDOS__) && !defined(OS2) && !defined(_WIN32)
  
  static int
***************
*** 2118,2123 ****
--- 2246,2253 ----
  
  #endif /* not __MSDOS__ and not OS2 and not _WIN32 */
  
+ #endif /* not __EMX__ */
+ 
  #if defined(OS2)
  
  static int
***************
*** 2191,2196 ****
--- 2321,2330 ----
  #ifdef __MSDOS__
          fatal ("-pipe not supported under MS-DOS");
  #endif
+ #ifdef __EMX__
+         if (!pipes_supported)
+           fatal ("-pipe not supported under MS-DOS");
+ #endif /* __EMX__ */
  	argbuf[i] = 0;	/* termination of command args.  */
  	commands[n_commands].prog = argbuf[i + 1];
  	commands[n_commands].argv = &argbuf[i + 1];
***************
*** 2272,2277 ****
--- 2406,2415 ----
  	pid = wait (&status);
  #endif
  #endif
+ #ifdef __EMX__
+ 	while (pid < 0 && errno == EINTR)
+ 	  pid = wait (&status);
+ #endif /* __EMX__ */
  	if (pid < 0)
  	  abort ();
  
***************
*** 2441,2446 ****
--- 2579,2585 ----
  	}
      }
  
+ #ifndef __EMX__
    /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
    temp = getenv ("LPATH");
    if (temp && ! cross_compile)
***************
*** 2472,2477 ****
--- 2611,2617 ----
  	    endp++;
  	}
      }
+ #endif /* not __EMX__ */
  
    /* Convert new-style -- options to old-style.  */
    translate_options (&argc, &argv);
***************
*** 2602,2607 ****
--- 2742,2757 ----
  	  n_infiles++;
  	  i++;
  	}
+ #ifdef EMX
+       else if (strcmp (argv[i], "-Zlinker") == 0)
+ 	{
+ 	  if (i + 1 == argc)
+ 	    fatal ("argument to `-Zlinker' is missing");
+ 
+ 	  n_infiles += 2;
+ 	  i++;
+ 	}
+ #endif /* EMX */
        else if (strncmp (argv[i], "-l", 2) == 0)
  	n_infiles++;
        else if (argv[i][0] == '-' && argv[i][1] != 0)
***************
*** 2695,2700 ****
--- 2845,2854 ----
  		i += SWITCH_TAKES_ARG (c) - (p[1] != 0);
  	      else if (WORD_SWITCH_TAKES_ARG (p))
  		i += WORD_SWITCH_TAKES_ARG (p);
+ #ifdef EMX
+ 	      if (!strcmp (p, "Zomf"))
+ 		omf = 1;
+ #endif /* EMX */
  	    }
  	}
        else
***************
*** 2707,2712 ****
--- 2861,2877 ----
       (such as cpp) rather than those of the host system.  */
    /* Use 2 as fourth arg meaning try just the machine as a suffix,
       as well as trying the machine and the version.  */
+ #ifdef __EMX__
+   {
+     char exe[270], *name;
+ 
+     if (_execname (exe, sizeof (exe)) == 0 && (name = _getname (exe)) != exe)
+       {
+         *name = 0;
+         add_prefix (&exec_prefixes, exe, 1, 0, NULL_PTR);
+       }
+   }
+ #else /* not __EMX__ */
  #ifndef OS2
    add_prefix (&exec_prefixes, standard_exec_prefix, 0, 2, NULL_PTR);
    add_prefix (&exec_prefixes, standard_exec_prefix_1, 0, 2, NULL_PTR);
***************
*** 2754,2759 ****
--- 2919,2925 ----
    add_prefix (&startfile_prefixes,
  	      concat3 (tooldir_prefix, "lib", dir_separator_str),
  	      0, 0, NULL_PTR);
+ #endif /* not __EMX__ */
  
    /* More prefixes are enabled in main, after we read the specs file
       and determine whether this is cross-compilation or not.  */
***************
*** 2826,2831 ****
--- 2992,3006 ----
  	  infiles[n_infiles].language = 0;
  	  infiles[n_infiles++].name = argv[++i];
  	}
+ #ifdef EMX
+       else if (strcmp (argv[i], "-Zlinker") == 0)
+ 	{
+ 	  infiles[n_infiles].language = 0;
+ 	  infiles[n_infiles++].name = "-O";
+ 	  infiles[n_infiles].language = 0;
+ 	  infiles[n_infiles++].name = argv[++i];
+ 	}
+ #endif /* EMX */
        else if (strncmp (argv[i], "-l", 2) == 0)
  	{
  	  infiles[n_infiles].language = 0;
***************
*** 2930,2935 ****
--- 3105,3114 ----
  	    {
  	      infiles[n_infiles].language = spec_lang;
  	      infiles[n_infiles++].name = argv[i];
+ #ifdef EMX
+ 	      if (!first_infile)
+ 		first_infile = argv[i];
+ #endif /* EMX */
  	    }
  	}
      }
***************
*** 3367,3373 ****
--- 3546,3559 ----
  	    break;
  
  	  case 'O':
+ #ifdef EMX
+             if (omf)
+               obstack_grow (&obstack, ".obj", 4);
+             else
+               obstack_grow (&obstack, ".o", 2);
+ #else /* not EMX */
  	    obstack_grow (&obstack, OBJECT_SUFFIX, strlen (OBJECT_SUFFIX));
+ #endif /* not EMX */
  	    arg_going = 1;
  	    break;
  
***************
*** 4219,4224 ****
--- 4405,4420 ----
    while (p != argv[0] && p[-1] != '/' && p[-1] != DIR_SEPARATOR) --p;
    programname = p;
  
+ #ifdef __EMX__
+   _emxload_env ("GCCLOAD");
+   _envargs (&argc, &argv, "GCCOPT");
+   _response (&argc, &argv);
+   _wildcard (&argc, &argv);
+ 
+   /* pipe() is supported under OS/2 and by RSX.  */
+   pipes_supported = _osmode != DOS_MODE || (_emx_env & 0x1000);
+ #endif /* __EMX__ */
+ 
    if (signal (SIGINT, SIG_IGN) != SIG_IGN)
      signal (SIGINT, fatal_error);
  #ifdef SIGHUP
***************
*** 4552,4557 ****
--- 4748,4771 ----
  	}
        obstack_grow (&collect_obstack, "\0", 1);
        putenv (obstack_finish (&collect_obstack));
+ 
+ #ifdef EMX
+       /* Substitute the basename of the first input file for %b in
+ 	 link_command_spec. */
+ 
+       input_basename = first_infile;
+       for (p = input_basename; *p; p++)
+ 	if (*p == '/')
+ 	  input_basename = p + 1;
+ 
+       /* Find a suffix starting with the last period,
+ 	 and set basename_length to exclude that suffix.  */
+       basename_length = strlen (input_basename);
+       p = input_basename + basename_length;
+       while (p != input_basename && *p != '.') --p;
+       if (*p == '.' && p != input_basename)
+ 	basename_length = p - input_basename;
+ #endif /* EMX */
  
        value = do_spec (link_command_spec);
        if (value < 0)
diff -cr gcc-2.7/real.c \emx\gnu\gcc-2.7/real.c
*** gcc-2.7/real.c	Tue Aug 15 22:57:18 1995
--- \emx\gnu\gcc-2.7/real.c	Tue Sep  3 13:20:10 1996
***************
*** 1,3 ****
--- 1,4 ----
+ /* real.c -- changed for emx by Eberhard Mattes -- Sep 1996 */
  /* real.c - implementation of REAL_ARITHMETIC, REAL_VALUE_ATOF,
     and support for XFmode IEEE extended real floating point arithmetic.
     Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
***************
*** 2987,2993 ****
--- 2988,2998 ----
  #ifdef INFINITY
    /* Point to the exponent field and check max exponent cases.  */
    p = &yy[NE - 1];
+ #ifdef __EMX__
+   if ((*p & 0x7fff) == 0x7fff)
+ #else /* not __EMX__ */
    if (*p == 0x7fff)
+ #endif /* not __EMX__ */
      {
  #ifdef NANS
        if (! REAL_WORDS_BIG_ENDIAN)
diff -cr gcc-2.7/toplev.c \emx\gnu\gcc-2.7/toplev.c
*** gcc-2.7/toplev.c	Tue Sep  3 20:27:40 1996
--- \emx\gnu\gcc-2.7/toplev.c	Tue Aug 20 17:47:30 1996
***************
*** 1,3 ****
--- 1,4 ----
+ /* toplev.c -- changed for emx by Eberhard Mattes -- Aug 1996 */
  /* Top level of GNU C compiler
     Copyright (C) 1987, 88, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
  
***************
*** 1981,1986 ****
--- 1982,1996 ----
  
    if (dump_base_name == 0)
      dump_base_name = name ? name : "gccdump";
+ #ifdef __EMX__
+   {
+     int len = strlen (dump_base_name);
+     char *tem = (char *) xmalloc (len + 1);
+     strcpy (tem, dump_base_name);
+     strip_off_ending (tem, len);
+     dump_base_name = tem;
+   }
+ #endif /* __EMX__ */
  
    parse_time = 0;
    varconst_time = 0;
***************
*** 2056,2102 ****
--- 2066,2156 ----
  
    /* If jump_opt dump desired, open the output file.  */
    if (jump_opt_dump)
+ #ifndef __EMX__
      jump_opt_dump_file = open_dump_file (dump_base_name, ".jump");
+ #else /* __EMX__ */
+     jump_opt_dump_file = open_dump_file (dump_base_name, ".jp1");
+ #endif /* __EMX__ */
  
    /* If cse dump desired, open the output file.  */
    if (cse_dump)
+ #ifndef __EMX__
      cse_dump_file = open_dump_file (dump_base_name, ".cse");
+ #else /* __EMX__ */
+     cse_dump_file = open_dump_file (dump_base_name, ".cs1");
+ #endif /* __EMX__ */
  
    /* If loop dump desired, open the output file.  */
    if (loop_dump)
+ #ifndef __EMX__
      loop_dump_file = open_dump_file (dump_base_name, ".loop");
+ #else /* __EMX__ */
+     loop_dump_file = open_dump_file (dump_base_name, ".loo");
+ #endif /* __EMX__ */
  
    /* If cse2 dump desired, open the output file.  */
    if (cse2_dump)
+ #ifndef __EMX__
      cse2_dump_file = open_dump_file (dump_base_name, ".cse2");
+ #else /* __EMX__ */
+     cse2_dump_file = open_dump_file (dump_base_name, ".cs2");
+ #endif /* __EMX__ */
  
    /* If flow dump desired, open the output file.  */
    if (flow_dump)
+ #ifndef __EMX__
      flow_dump_file = open_dump_file (dump_base_name, ".flow");
+ #else /* __EMX__ */
+     flow_dump_file = open_dump_file (dump_base_name, ".flo");
+ #endif /* __EMX__ */
  
    /* If combine dump desired, open the output file.  */
    if (combine_dump)
+ #ifndef __EMX__
      combine_dump_file = open_dump_file (dump_base_name, ".combine");
+ #else /* __EMX__ */
+     combine_dump_file = open_dump_file (dump_base_name, ".cmb");
+ #endif /* __EMX__ */
  
    /* If scheduling dump desired, open the output file.  */
    if (sched_dump)
+ #ifndef __EMX__
      sched_dump_file = open_dump_file (dump_base_name, ".sched");
+ #else /* __EMX__ */
+     sched_dump_file = open_dump_file (dump_base_name, ".sd1");
+ #endif /* __EMX__ */
  
    /* If local_reg dump desired, open the output file.  */
    if (local_reg_dump)
+ #ifndef __EMX__
      local_reg_dump_file = open_dump_file (dump_base_name, ".lreg");
+ #else /* __EMX__ */
+     local_reg_dump_file = open_dump_file (dump_base_name, ".lre");
+ #endif /* __EMX__ */
  
    /* If global_reg dump desired, open the output file.  */
    if (global_reg_dump)
+ #ifndef __EMX__
      global_reg_dump_file = open_dump_file (dump_base_name, ".greg");
+ #else /* __EMX__ */
+     global_reg_dump_file = open_dump_file (dump_base_name, ".gre");
+ #endif /* __EMX__ */
  
    /* If 2nd scheduling dump desired, open the output file.  */
    if (sched2_dump)
+ #ifndef __EMX__
      sched2_dump_file = open_dump_file (dump_base_name, ".sched2");
+ #else /* __EMX__ */
+     sched2_dump_file = open_dump_file (dump_base_name, ".sd2");
+ #endif /* __EMX__ */
  
    /* If jump2_opt dump desired, open the output file.  */
    if (jump2_opt_dump)
+ #ifndef __EMX__
      jump2_opt_dump_file = open_dump_file (dump_base_name, ".jump2");
+ #else /* __EMX__ */
+     jump2_opt_dump_file = open_dump_file (dump_base_name, ".jp2");
+ #endif /* __EMX__ */
  
    /* If dbr_sched dump desired, open the output file.  */
    if (dbr_sched_dump)
***************
*** 2106,2112 ****
--- 2160,2170 ----
  
    /* If stack_reg dump desired, open the output file.  */
    if (stack_reg_dump)
+ #ifndef __EMX__
      stack_reg_dump_file = open_dump_file (dump_base_name, ".stack");
+ #else /* __EMX__ */
+     stack_reg_dump_file = open_dump_file (dump_base_name, ".stk");
+ #endif /* __EMX__ */
  
  #endif
  
***************
*** 3311,3316 ****
--- 3369,3378 ----
    int version_flag = 0;
    char *p;
  
+ #ifdef __EMX__
+   _emxload_env ("GCCLOAD");
+ #endif /* __EMX__ */
+ 
    /* save in case md file wants to emit args as a comment.  */
    save_argc = argc;
    save_argv = argv;
***************
*** 3926,3936 ****
--- 3988,4000 ----
  	       lim - (char *) &environ);
        fflush (stderr);
  
+ #ifndef __EMX__
  #ifdef USG
        system ("ps -l 1>&2");
  #else /* not USG */
        system ("ps v");
  #endif /* not USG */
+ #endif /* not __EMX__ */
      }
  #endif /* not OS2 and not VMS and not _WIN32 */
  
diff -cr gcc-2.7/varasm.c \emx\gnu\gcc-2.7/varasm.c
*** gcc-2.7/varasm.c	Tue Sep  3 20:27:40 1996
--- \emx\gnu\gcc-2.7/varasm.c	Tue Aug 20 17:47:30 1996
***************
*** 1,3 ****
--- 1,4 ----
+ /* varasm.c -- changed for emx by Eberhard Mattes -- Aug 1996 */
  /* Output variables, constants and external declarations, for GNU compiler.
     Copyright (C) 1987, 88, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
  
***************
*** 112,117 ****
--- 113,122 ----
  static struct weak_syms *weak_decls;
  #endif
  
+ #ifdef EMX
+ char *current_function_fnname;
+ #endif /* EMX */
+ 
  /* Nonzero if at least one function definition has been seen.  */
  
  static int function_defined;
***************
*** 866,871 ****
--- 871,877 ----
    function_section (decl);
  
    /* Tell assembler to move to target machine's alignment for functions.  */
+ #ifndef EMX
    align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT);
    if (align > 0)
      {
***************
*** 874,879 ****
--- 880,896 ----
        else
  	ASM_OUTPUT_ALIGN (asm_out_file, align);
      }
+ #else /* EMX */
+   current_function_fnname = fnname;
+   if (output_bytecode)
+     {
+       align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT);
+       if (align > 0)
+ 	BC_OUTPUT_ALIGN (asm_out_file, align);
+     }
+   else
+     ASM_OUTPUT_ALIGN_CODE (asm_out_file);
+ #endif /* EMX */
  
  #ifdef ASM_OUTPUT_FUNCTION_PREFIX
    ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file, fnname);
***************
*** 1886,1892 ****
--- 1903,1911 ----
  {
    char label[256];
    char *name;
+ #ifndef EMX
    int align;
+ #endif /* EMX */
  
    /* Shouldn't get here */
    if (output_bytecode)
***************
*** 1901,1909 ****
--- 1920,1932 ----
  #endif
  
    /* Write the assembler code to define one.  */
+ #ifndef EMX
    align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT);
    if (align > 0)
      ASM_OUTPUT_ALIGN (asm_out_file, align);
+ #else /* EMX */
+   ASM_OUTPUT_ALIGN_CODE (asm_out_file);
+ #endif /* EMX */
  
    ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LTRAMP", 0);
    TRAMPOLINE_TEMPLATE (asm_out_file);
