diff -cr gcc-2.8/bounds/lib/bounds-l.h \emx\gnu\gcc-2.8/bounds/lib/bounds-l.h
*** gcc-2.8/bounds/lib/bounds-l.h	Tue Jun 23 17:27:22 1998
--- \emx\gnu\gcc-2.8/bounds/lib/bounds-l.h	Mon Nov  2 00:16:28 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* bounds-l.h -- changed for emx by Eberhard Mattes -- Nov 1998 */
  /*----------------------------------------------------------------------*
   * Bounds Checking for GCC.						*
   * Copyright (C) 1995 Richard W.M. Jones <rjones@orchestream.com>.	*
***************
*** 56,62 ****
  /* Constants.
   */
  #define ILLEGAL		((void *)-2)	/* Bad ptr. arithmetic returns this. */
! #define COLLECT_STATS	1		/* Collect statistics on call freq. */
  #define USE_CACHE	0		/* Cache object lookups (don't use). */
  #define DEBUG_FEATURES	1		/* Various extra features. */
  
--- 57,63 ----
  /* Constants.
   */
  #define ILLEGAL		((void *)-2)	/* Bad ptr. arithmetic returns this. */
! #define COLLECT_STATS	0		/* Collect statistics on call freq. */
  #define USE_CACHE	0		/* Cache object lookups (don't use). */
  #define DEBUG_FEATURES	1		/* Various extra features. */
  
diff -cr gcc-2.8/bounds/lib/string.c \emx\gnu\gcc-2.8/bounds/lib/string.c
*** gcc-2.8/bounds/lib/string.c	Tue Jun 23 17:28:18 1998
--- \emx\gnu\gcc-2.8/bounds/lib/string.c	Mon Nov  2 00:16:10 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* string.c -- changed for emx by Eberhard Mattes -- Nov 1998 */
  /*----------------------------------------------------------------------*
   * Bounds Checking for GCC.						*
   * Copyright (C) 1995 Richard W.M. Jones <rjones@orchestream.com>.	*
***************
*** 150,159 ****
  /*----------------------------------------------------------------------
   *	Check for overlapping objects in functions (such as memcpy, strcpy)
   *	where this is not permitted.
-  *	The original code is disabled because there is a lot of code
-  *	that uses:
-  *		 memcpy(&data[0],&data[1],3);
-  *	This valid code would otherwise fail.
   *----------------------------------------------------------------------*/
  
  static inline void
--- 151,156 ----
***************
*** 161,179 ****
  	       void *p1, size_t n1,
  	       void *p2, size_t n2, char *function_name)
  {
- #if 0
-   void *p1e = (void *) ((char *) p1 + n1 - 1);
-   void *p2e = (void *) ((char *) p2 + n2 - 1);
- 
-   if ((p1 <= p2 && p1e >= p2) ||	/* p1----p2====p1e----p2e */
-       (p2 <= p1 && p2e >= p1) ||	/* p2----p1====p2e----p1e */
-       (p1 >= p2 && p1e <= p2e) ||	/* p2----p1====p1e----p2e */
-       (p2 >= p1 && p2e <= p1e))		/* p1----p2====p2e----p1e */
- #else
    void *p2e = (void *) ((char *) p2 + n2 - 1);
  
    if (p1 > p2 && p1 <= p2e)
- #endif
      __bounds_errorf (filename, line, p1, NULL,
  		     "in %s, source and destination objects overlap",
  		     function_name);
--- 158,166 ----
diff -cr gcc-2.8/cccp.c \emx\gnu\gcc-2.8/cccp.c
*** gcc-2.8/cccp.c	Thu Feb 26 13:38:58 1998
--- \emx\gnu\gcc-2.8/cccp.c	Sun Nov  1 13:25:10 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* cccp.c -- changed for emx by Eberhard Mattes -- Jun 1998 */
  /* C Compatible Compiler Preprocessor (CCCP)
     Copyright (C) 1986, 87, 89, 92-97, 1998 Free Software Foundation, Inc.
     Written by Paul Rubin, June 1986
***************
*** 149,154 ****
--- 150,160 ----
  #define INO_T_EQ(a, b) 0
  #endif
  
+ #ifdef __EMX__
+ #define INO_T_EQ(a, b) 0
+ #define INO_T_HASH(a) 0
+ #endif /* __EMX__ */
+ 
  #ifndef O_RDONLY
  #define O_RDONLY 0
  #endif
***************
*** 268,273 ****
--- 274,287 ----
  
  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;
***************
*** 1266,1271 ****
--- 1280,1289 ----
    }
  #endif
  
+ #ifdef __EMX__
+   _emxload_env ("GCCLOAD");
+ #endif /* __EMX__ */
+ 
    in_fname = NULL;
    out_fname = NULL;
  
***************
*** 1679,1684 ****
--- 1697,1714 ----
  	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 = "";
***************
*** 2044,2050 ****
--- 2074,2084 ----
  	q = p + (len - 4);
  
        /* Supply our own suffix.  */
+ #ifndef EMX
        strcpy (q, OBJECT_SUFFIX);
+ #else /* EMX */
+       strcpy (q, omf ? ".obj" : ".o");
+ #endif /* EMX */
  
        deps_output (p, ':');
        deps_output (in_fname, ' ');
***************
*** 4488,4494 ****
--- 4522,4532 ----
        if (errno == EACCES)
  	break;
  #else
+ #ifdef __EMX__
+       if (errno != ENOENT && errno != ENOTDIR && errno != ENAMETOOLONG)
+ #else /* not __EMX__ */
        if (errno != ENOENT && errno != ENOTDIR)
+ #endif /* not __EMX__ */
  	break;
  #endif
      }
***************
*** 4653,4658 ****
--- 4691,4699 ----
    /* At present, any path that begins with a drive spec is absolute.  */
    if (isalpha (filename[0]) && filename[1] == ':') return 1;
  #endif
+ #ifdef __EMX__
+   if (!_fnisrel (filename)) return 1;
+ #endif /* __EMX__ */
    if (filename[0] == '/') return 1;
  #ifdef DIR_SEPARATOR
    if (filename[0] == DIR_SEPARATOR) return 1;
***************
*** 4686,4691 ****
--- 4727,4733 ----
  	  continue;
        } else {
  	/* On some hosts // differs from /; Posix allows this.  */
+ #ifndef __EMX__
  	static int slashslash_vs_slash;
  	if (slashslash_vs_slash == 0) {
  	  struct stat s1, s2;
***************
*** 4695,4700 ****
--- 4737,4743 ----
  				 ? 1 : -1);
  	}
  	if (slashslash_vs_slash < 0)
+ #endif /* !__EMX__ */
  	  *to++ = '/';
        }
      }
diff -cr gcc-2.8/config/i386/i386.c \emx\gnu\gcc-2.8/config/i386/i386.c
*** gcc-2.8/config/i386/i386.c	Wed Dec  3 15:01:22 1997
--- \emx\gnu\gcc-2.8/config/i386/i386.c	Sun Nov  1 13:25:10 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* i386.c -- changed for emx by Eberhard Mattes -- Jun 1998 */
  /* Subroutines for insn-output.c for Intel X86.
     Copyright (C) 1988, 92, 94, 95, 96, 1997 Free Software Foundation, Inc.
  
***************
*** 36,41 ****
--- 37,46 ----
  #include "except.h"
  #include "function.h"
  
+ #ifdef EMX
+ #include "expr.h"       /* STACK_CHECK_PROBE_LOAD */
+ #endif /* EMX */
+ 
  #ifdef EXTRA_CONSTRAINT
  /* If EXTRA_CONSTRAINT is defined, then the 'S'
     constraint in REG_CLASS_FROM_LETTER will no longer work, and various
***************
*** 667,672 ****
--- 672,683 ----
  
        if (attr)
  	cum->nregs = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr)));
+ #ifdef EMX
+       if (lookup_attribute ("optlink", TYPE_ATTRIBUTES (fntype)))
+         {
+           cum->nregs = 3; cum->optlink = 1;
+         }
+ #endif /* EMX */
      }
  
    /* Determine if this function has variable arguments.  This is
***************
*** 712,717 ****
--- 723,732 ----
  	     words, cum->words, cum->nregs, GET_MODE_NAME (mode), named);
  
    cum->words += words;
+ #ifdef EMX
+   if (cum->optlink && mode == BLKmode)
+     return;                     /* Skip aggregates */
+ #endif /* EMX */
    cum->nregs -= words;
    cum->regno += words;
  
***************
*** 756,766 ****
--- 771,798 ----
        break;
  
      case BLKmode:
+ #ifdef EMX
+       if (cum->optlink)
+         break;
+       /* fall through */
+ #endif /* EMX */
      case DImode:
      case SImode:
      case HImode:
      case QImode:
        if (words <= cum->nregs)
+ #ifdef EMX
+         if (cum->optlink)
+           {
+             ret = gen_rtx (PARALLEL, mode, rtvec_alloc (2));
+             XVECEXP (ret, 0, 0) = gen_rtx (EXPR_LIST, VOIDmode,
+                                            NULL_RTX, const0_rtx);
+             XVECEXP (ret, 0, 1) = gen_rtx (EXPR_LIST, VOIDmode,
+                                            gen_rtx (REG, mode, cum->regno),
+                                            const0_rtx);
+           }
+         else
+ #endif /* EMX */
  	ret = gen_rtx (REG, mode, cum->regno);
        break;
      }
***************
*** 771,776 ****
--- 803,814 ----
  	       "function_arg (size=%d, wds=%2d, nregs=%d, mode=%4s, named=%d",
  	       words, cum->words, cum->nregs, GET_MODE_NAME (mode), named);
  
+ #ifdef EMX
+       if (ret && GET_CODE (ret) == PARALLEL)
+         fprintf (stderr, ", stack/reg=%%e%s",
+                  reg_names[ REGNO(XEXP (XVECEXP (ret, 0, 1), 0))]);
+       else
+ #endif /* EMX */
        if (ret)
  	fprintf (stderr, ", reg=%%e%s", reg_names[ REGNO(ret) ]);
        else
***************
*** 2050,2055 ****
--- 2088,2155 ----
  	}
      }
  
+ #ifdef EMX
+   if (tsize >= EMX_PROBE_SIZE && TARGET_EMX_PROBE)
+     {
+       rtx emxops[2];
+ 
+       if (tsize <= EMX_PROBE_MAX_INLINE)
+         {
+           long i, j;
+ 
+           emxops[0] = const0_rtx;
+           i = tsize; j = 0;
+           while (i >= EMX_PROBE_SIZE)
+             {
+               i -= EMX_PROBE_SIZE; j += EMX_PROBE_SIZE;
+               emxops[1] = gen_rtx (MEM, SImode,
+                                    gen_rtx (PLUS, Pmode,
+                                             stack_pointer_rtx),
+                                    gen_rtx (CONST_INT, SImode, -j));
+               MEM_VOLATILE_P (emxops[1]) = 1;
+               if (do_rtl)
+                 {
+                   if (STACK_CHECK_PROBE_LOAD)
+                     insn = emit_move_insn (gen_reg_rtx (SImode), emxops[1]);
+                   else
+                     insn = emit_move_insn (emxops[1], const0_rtx);
+                   RTX_FRAME_RELATED_P (insn) = 1;
+                 }
+               else
+                 {
+                   if (STACK_CHECK_PROBE_LOAD)
+                     output_asm_insn (AS2 (test%L1,%0,%1), emxops);
+                   else
+                     output_asm_insn (AS2 (mov%L1,%0,%1), emxops);
+                 }
+             }
+         }
+       else
+ 	{
+ 	  emxops[0] = GEN_INT (tsize);
+ 	  emxops[1] = gen_rtx (MEM, QImode,
+ 			       gen_rtx (SYMBOL_REF, Pmode, "__probe"));
+           if (do_rtl)
+             {
+               insn = emit_insn (gen_rtx (SET, VOIDmode,
+                                          gen_rtx (MEM, SImode,
+                                                   gen_rtx (PRE_DEC, SImode,
+                                                            stack_pointer_rtx)),
+                                          emxops[0]));
+               RTX_FRAME_RELATED_P (insn) = 1;
+               insn = emit_call_insn (gen_rtx (CALL, VOIDmode, emxops[1],
+                                               const0_rtx));
+               RTX_FRAME_RELATED_P (insn) = 1;
+             }
+           else
+             {
+               output_asm_insn (AS1 (push%L0,%0), emxops);
+               output_asm_insn (AS1 (call,%P1), emxops);
+             }
+ 	}
+     }
+ #endif /* EMX */
+ 
    if (tsize == 0)
      ;
    else if (! TARGET_STACK_PROBE || tsize < CHECK_STACK_LIMIT)
***************
*** 2171,2176 ****
--- 2271,2281 ----
  		  ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
    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)
diff -cr gcc-2.8/config/i386/i386.h \emx\gnu\gcc-2.8/config/i386/i386.h
*** gcc-2.8/config/i386/i386.h	Fri Feb  6 16:52:40 1998
--- \emx\gnu\gcc-2.8/config/i386/i386.h	Sun Nov  1 13:25:10 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* i386.h -- changed for emx by Eberhard Mattes -- Jun 1998 */
  /* Definitions of target machine for GNU compiler for Intel X86
     (386, 486, Pentium).
     Copyright (C) 1988, 92, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
***************
*** 973,978 ****
--- 974,982 ----
    int words;			/* # words passed so far */
    int nregs;			/* # registers available for passing */
    int regno;			/* next available register number */
+ #ifdef EMX
+   int optlink;                  /* nonzero if optlink (vs. regparm) */
+ #endif /* EMX */
  } CUMULATIVE_ARGS;
  
  /* Initialize a variable CUM of type CUMULATIVE_ARGS
diff -cr gcc-2.8/cp/lex.c \emx\gnu\gcc-2.8/cp/lex.c
*** gcc-2.8/cp/lex.c	Wed Nov 26 21:13:20 1997
--- \emx\gnu\gcc-2.8/cp/lex.c	Sun May  2 13:14:34 1999
***************
*** 1,3 ****
--- 1,4 ----
+ /* lex.c -- changed for emx by Eberhard Mattes -- May 1999 */
  /* Separate lexical analyzer for GNU C++.
     Copyright (C) 1987, 89, 92-96, 1997 Free Software Foundation, Inc.
     Hacked by Michael Tiemann (tiemann@cygnus.com)
***************
*** 104,114 ****
--- 105,119 ----
  file_name_nondirectory (x)
       char *x;
  {
+ #ifdef __EMX__
+   return _getname (x);
+ #else /* not __EMX__ */
    char *tmp = (char *) rindex (x, '/');
    if (tmp)
      return (char *) (tmp + 1);
    else
      return x;
+ #endif /* not __EMX__ */
  }
  
  /* This obstack is needed to hold text.  It is not safe to use
diff -cr gcc-2.8/cplus-de.c \emx\gnu\gcc-2.8/cplus-de.c
*** gcc-2.8/cplus-de.c	Wed Dec  3 14:10:38 1997
--- \emx\gnu\gcc-2.8/cplus-de.c	Sun Nov  1 13:25:10 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* cplus-de.c -- changed for emx by Eberhard Mattes -- Mar 1998 */
  /* Demangler for GNU C++ 
     Copyright 1989, 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
     Written by James Clark (jjc@jclark.uucp)
***************
*** 223,229 ****
  #endif
  
  static int
! demangle_template PARAMS ((struct work_stuff *work, const char **, string *,
  			   string *, int));
  
  static int
--- 224,230 ----
  #endif
  
  static int
! demangle_template PARAMS ((struct work_stuff *, const char **, string *,
  			   string *, int));
  
  static int
diff -cr gcc-2.8/dwarf2ou.c \emx\gnu\gcc-2.8/dwarf2ou.c
*** gcc-2.8/dwarf2ou.c	Sat Feb 28 21:58:12 1998
--- \emx\gnu\gcc-2.8/dwarf2ou.c	Sun Nov  1 13:25:12 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* dwarf2ou.c -- changed for emx by Eberhard Mattes -- Jun 1998 */
  /* Output Dwarf2 format symbol table information from the GNU C compiler.
     Copyright (C) 1992, 93, 95, 96, 97, 1998 Free Software Foundation, Inc.
     Contributed by Gary Funck (gary@intrepid.com).
***************
*** 1551,1556 ****
--- 1552,1563 ----
  
    if (for_eh)
      {
+ #ifdef EMX
+       fputs ("\t.stabs\t\"___eh_frame__\", 23, 0, 0, ___FRAME_BEGIN__\n",
+              asm_out_file);
+       text_section ();
+       ASM_OUTPUT_ALIGN (asm_out_file, 2);
+ #else /* not EMX */
  #ifdef EH_FRAME_SECTION
        EH_FRAME_SECTION ();
  #else
***************
*** 1561,1566 ****
--- 1568,1574 ----
        ASM_GLOBALIZE_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
        ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
  #endif
+ #endif /* not EMX */
        assemble_label ("__FRAME_BEGIN__");
      }
    else
diff -cr gcc-2.8/explow.c \emx\gnu\gcc-2.8/explow.c
*** gcc-2.8/explow.c	Wed Feb  4 03:16:02 1998
--- \emx\gnu\gcc-2.8/explow.c	Sun Nov  1 13:25:12 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* explow.c -- changed for emx by Eberhard Mattes -- Aug 1998 */
  /* Subroutines for manipulating rtx's in semantically interesting ways.
     Copyright (C) 1987, 91, 94-97, 1998 Free Software Foundation, Inc.
  
***************
*** 794,799 ****
--- 795,839 ----
      emit_move_insn (stack_pointer_rtx, temp);
  }
  
+ #ifdef EMX
+ 
+ static int emx_disable_stack_probe;
+ 
+ static void
+ emx_stack_probe (adjust)
+      rtx adjust;
+ {
+   if (TARGET_EMX_PROBE && !emx_disable_stack_probe
+       && (GET_CODE (adjust) != CONST_INT || INTVAL (adjust) >= EMX_PROBE_SIZE))
+     {
+       int i, j;
+ 
+       if (GET_CODE (adjust) == CONST_INT
+           && INTVAL (adjust) <= EMX_PROBE_MAX_INLINE)
+         {
+           i = INTVAL (adjust); j = 0;
+           while (i >= EMX_PROBE_SIZE)
+             {
+               i -= EMX_PROBE_SIZE; j += EMX_PROBE_SIZE;
+               emit_stack_probe (gen_rtx (PLUS, Pmode,
+                                          stack_pointer_rtx,
+                                          gen_rtx (CONST_INT, SImode, -j)));
+             }
+         }
+       else
+         {
+           emit_push_insn (adjust, SImode, NULL_TREE, NULL_RTX,
+                           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
+ 
  /* Adjust the stack pointer by minus ADJUST (an rtx for a number of bytes).
     This pushes when ADJUST is positive.  ADJUST need not be constant.  */
  
***************
*** 807,812 ****
--- 847,856 ----
    if (adjust == const0_rtx)
      return;
  
+ #ifdef EMX
+   emx_stack_probe (adjust);
+ #endif /* EMX */
+ 
    temp = expand_binop (Pmode,
  #ifdef STACK_GROWS_DOWNWARD
  		       sub_optab,
***************
*** 1108,1113 ****
--- 1152,1161 ----
       account what has already been checked.  */
    if (flag_stack_check && ! STACK_CHECK_BUILTIN)
      probe_stack_range (STACK_CHECK_MAX_FRAME_SIZE + STACK_CHECK_PROTECT, size);
+ #ifdef EMX
+   if (flag_stack_check && ! STACK_CHECK_BUILTIN && TARGET_EMX_PROBE)
+     emx_disable_stack_probe = 1;
+ #endif /* EMX */
  
    /* Don't use a TARGET that isn't a pseudo.  */
    if (target == 0 || GET_CODE (target) != REG
***************
*** 1149,1154 ****
--- 1197,1205 ----
    emit_move_insn (target, virtual_stack_dynamic_rtx);
  #endif
      }
+ #ifdef EMX
+   emx_disable_stack_probe = 0;
+ #endif /* EMX */
  
    if (MUST_ALIGN)
      {
***************
*** 1213,1218 ****
--- 1264,1281 ----
       HOST_WIDE_INT first;
       rtx size;
  {
+ #ifdef EMX
+   if (TARGET_EMX_PROBE)
+     {
+       if (GET_CODE (size) == CONST_INT)
+         size = GEN_INT (INTVAL (size) + first);
+       else
+         size = expand_binop (Pmode, add_optab, size,
+                              GEN_INT (first),
+                              NULL_RTX, 1, OPTAB_LIB_WIDEN);
+       first = 0;
+     }
+ #endif /* EMX */
    /* First see if we have an insn to check the stack.  Use it if so.  */
  #ifdef HAVE_check_stack
    if (HAVE_check_stack)
diff -cr gcc-2.8/function.c \emx\gnu\gcc-2.8/function.c
*** gcc-2.8/function.c	Sun May  2 13:30:52 1999
--- \emx\gnu\gcc-2.8/function.c	Sun Nov  1 13:25:12 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* function.c -- changed for emx by Eberhard Mattes -- Aug 1998 */
  /* Expands front end tree to back end RTL for GNU C-Compiler
     Copyright (C) 1987, 88, 89, 91-97, 1998 Free Software Foundation, Inc.
  
***************
*** 3952,3957 ****
--- 3953,3962 ----
  	     in this case.  */
  	  || REG_PARM_STACK_SPACE (fndecl) > 0
  #endif
+ #ifdef EMX
+           || (GET_CODE (entry_parm) == PARALLEL
+               && XEXP (XVECEXP (entry_parm, 0, 0), 0) == NULL_RTX)
+ #endif /* EMX */
  	  )
  	{
  	  stack_args_size.constant += arg_size.constant;
diff -cr gcc-2.8/gcc.c \emx\gnu\gcc-2.8/gcc.c
*** gcc-2.8/gcc.c	Sun May  2 13:30:54 1999
--- \emx\gnu\gcc-2.8/gcc.c	Mon Nov 23 22:06:50 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* gcc.c -- changed for emx by Eberhard Mattes -- Nov 1998 */
  /* Compiler driver program that can handle many languages.
     Copyright (C) 1987, 89, 92-97, 1998 Free Software Foundation, Inc.
  
***************
*** 129,134 ****
--- 130,141 ----
  #define DIR_SEPARATOR '/'
  #endif
  
+ #ifdef __EMX__
+ #include <process.h>
+ #include <stdlib.h>
+ extern char *_getname();
+ #endif /* __EMX__ */
+ 
  static char dir_separator_str[] = {DIR_SEPARATOR, 0};
  
  #define obstack_chunk_alloc xmalloc
***************
*** 233,238 ****
--- 240,256 ----
  /* 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.  */
+ int pipes_supported;
+ 
+ /* Name of first input file, for defaulting the output file. */
+ static char *first_infile;
+ #endif /* EMX */
+ 
  static void init_spec		PROTO((void));
  static void read_specs		PROTO((char *, int));
  static void set_spec		PROTO((char *, char *));
***************
*** 727,732 ****
--- 745,751 ----
  			\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} \
***************
*** 738,743 ****
--- 757,783 ----
  			%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
  			%{T*}\
  			\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 %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}}}\
+ 			%{T*}\
+ 			\n }}}}}}";
+ #endif /* EMX */
  #endif
  
  /* A vector of options to give to the linker.
***************
*** 973,978 ****
--- 1013,1040 ----
  	  i++;
  	}
  
+ #ifdef EMX
+       /* Handle abbreviations and synonyms.  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] == '-')
***************
*** 990,995 ****
--- 1052,1061 ----
  	    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
***************
*** 2163,2171 ****
--- 2229,2242 ----
    for (n_commands = 1, i = 0; i < argbuf_index; i++)
      if (strcmp (argbuf[i], "|") == 0)
        {				/* each command.  */
+ #ifndef __EMX__
  #if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN32__)) || defined (OS2) || defined (VMS)
          fatal ("-pipe not supported");
  #endif
+ #else /* __EMX__ */
+ 	if (!pipes_supported)
+ 	  fatal ("-pipe not supported");
+ #endif /* __EMX__ */
  	argbuf[i] = 0;	/* termination of command args.  */
  	commands[n_commands].prog = argbuf[i + 1];
  	commands[n_commands].argv = &argbuf[i + 1];
***************
*** 2480,2485 ****
--- 2551,2557 ----
  	}
      }
  
+ #ifndef __EMX__
    /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
    temp = getenv ("LPATH");
    if (temp && *cross_compile == '0')
***************
*** 2512,2517 ****
--- 2584,2590 ----
  	    endp++;
  	}
      }
+ #endif /* !__EMX__ */
  
    /* Convert new-style -- options to old-style.  */
    translate_options (&argc, &argv);
***************
*** 2635,2640 ****
--- 2708,2723 ----
  	  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 (strcmp (argv[i], "-save-temps") == 0)
***************
*** 2798,2806 ****
--- 2881,2891 ----
  	    case 'o':
  	      have_o = 1;
  #if defined(HAVE_EXECUTABLE_SUFFIX) || defined(HAVE_OBJECT_SUFFIX)
+ #ifndef EMX     /* This code would break -Zexe */
  	      argv[i] = convert_filename (argv[i], 1);
  	      if (p[1] == 0)
  		argv[i+1] = convert_filename (argv[i+1], 1);
+ #endif /* !EMX */
  #endif
  	      goto normal_switch;
  
***************
*** 2812,2817 ****
--- 2897,2906 ----
  		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
***************
*** 2826,2831 ****
--- 2915,2921 ----
  
    /* Set up the search paths before we go looking for config files.  */
  
+ #ifndef __EMX__
    /* These come before the md prefixes so that we will find gcc's subcommands
       (such as cpp) rather than those of the host system.  */
    /* Use 2 as fourth arg meaning try just the machine as a suffix,
***************
*** 2882,2887 ****
--- 2972,2989 ----
  	      concat (tooldir_prefix, "lib", dir_separator_str, NULL_PTR),
  	      "BINUTILS", 0, 0, NULL_PTR);
  
+ #else /* __EMX__ */
+   {
+     char exe[270], *name;
+ 
+     if (_execname (exe, sizeof (exe)) == 0 && (name = _getname (exe)) != exe)
+       {
+         *name = 0;
+         add_prefix (&exec_prefixes, exe, NULL_PTR, 1, 0, NULL_PTR);
+       }
+   }
+ #endif /* __EMX__ */
+ 
    /* More prefixes are enabled in main, after we read the specs file
       and determine whether this is cross-compilation or not.  */
  
***************
*** 2953,2958 ****
--- 3055,3069 ----
  	  infiles[n_infiles].language = "*";
  	  infiles[n_infiles++].name = argv[++i];
  	}
+ #ifdef EMX
+       else if (strcmp (argv[i], "-Zlinker") == 0)
+ 	{
+ 	  infiles[n_infiles].language = "*";
+ 	  infiles[n_infiles++].name = "-O";
+ 	  infiles[n_infiles].language = "*";
+ 	  infiles[n_infiles++].name = argv[++i];
+ 	}
+ #endif /* EMX */
        else if (strncmp (argv[i], "-l", 2) == 0)
  	{
  	  infiles[n_infiles].language = "*";
***************
*** 3055,3060 ****
--- 3166,3175 ----
  	    {
  	      infiles[n_infiles].language = spec_lang;
  	      infiles[n_infiles++].name = argv[i];
+ #ifdef EMX
+ 	      if (!first_infile)
+ 		first_infile = argv[i];
+ #endif /* EMX */
  	    }
  	}
      }
***************
*** 3493,3499 ****
--- 3608,3621 ----
  	    break;
  
  	  case 'O':
+ #ifndef EMX
  	    obstack_grow (&obstack, OBJECT_SUFFIX, strlen (OBJECT_SUFFIX));
+ #else /* EMX */
+ 	    if (omf)
+ 	      obstack_grow (&obstack, ".obj", 4);
+ 	    else
+ 	      obstack_grow (&obstack, ".o", 2);
+ #endif /* EMX */
  	    arg_going = 1;
  	    break;
  
***************
*** 4375,4380 ****
--- 4497,4512 ----
    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
***************
*** 4796,4801 ****
--- 4928,4953 ----
  	}
        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;
+       if (!input_basename)
+         input_basename = "aout";
+       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.8/gcov.c \emx\gnu\gcc-2.8/gcov.c
*** gcc-2.8/gcov.c	Wed Dec  3 14:11:10 1997
--- \emx\gnu\gcc-2.8/gcov.c	Mon Dec 21 01:15:38 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* gcov.c -- changed for emx by Eberhard Mattes -- Dec 1998 */
  /* Gcov.c: prepend line execution counts and branch probabilities to a
     source file.
     Copyright (C) 1990, 91, 92, 93, 94, 96, 1997 Free Software Foundation, Inc.
***************
*** 398,404 ****
--- 399,409 ----
    else
      strcat (bbg_file_name, ".bbg");
  
+ #ifdef __EMX__
+   bb_file = fopen (bb_file_name, "rb");
+ #else /* not __EMX__ */
    bb_file = fopen (bb_file_name, "r");
+ #endif /* not __EMX__ */
    if (bb_file == NULL)
      {
        fprintf (stderr, "Could not open basic block file %s.\n", bb_file_name);
***************
*** 407,420 ****
  
    /* If none of the functions in the file were executed, then there won't
       be a .da file.  Just assume that all counts are zero in this case.  */
    da_file = fopen (da_file_name, "r");
    if (da_file == NULL)
      {
        fprintf (stderr, "Could not open data file %s.\n", da_file_name);
        fprintf (stderr, "Assuming that all execution counts are zero.\n");
      }
!     
    bbg_file = fopen (bbg_file_name, "r");
    if (bbg_file == NULL)
      {
        fprintf (stderr, "Could not open program flow graph file %s.\n",
--- 412,433 ----
  
    /* If none of the functions in the file were executed, then there won't
       be a .da file.  Just assume that all counts are zero in this case.  */
+ #ifdef __EMX__
+   da_file = fopen (da_file_name, "rb");
+ #else /* not __EMX__ */
    da_file = fopen (da_file_name, "r");
+ #endif /* not __EMX__ */
    if (da_file == NULL)
      {
        fprintf (stderr, "Could not open data file %s.\n", da_file_name);
        fprintf (stderr, "Assuming that all execution counts are zero.\n");
      }
! 
! #ifdef __EMX__    
!   bbg_file = fopen (bbg_file_name, "rb");
! #else /* not __EMX__ */
    bbg_file = fopen (bbg_file_name, "r");
+ #endif /* not __EMX__ */
    if (bbg_file == NULL)
      {
        fprintf (stderr, "Could not open program flow graph file %s.\n",
diff -cr gcc-2.8/objc/Object.m \emx\gnu\gcc-2.8/objc/Object.m
*** gcc-2.8/objc/Object.m	Sat Nov 29 03:14:38 1997
--- \emx\gnu\gcc-2.8/objc/Object.m	Mon Nov 23 19:09:14 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* Object.m -- changed for emx by Eberhard Mattes -- Nov 1998 */
  /* The implementation of class Object for Objective-C.
     Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
  
***************
*** 29,35 ****
--- 30,38 ----
  #include "objc/Protocol.h"
  #include "objc/objc-api.h"
  
+ #ifndef __EMX__
  extern int errno;
+ #endif /* __EMX__ */
  
  #define MAX_CLASS_NAME_LEN 256
  
diff -cr gcc-2.8/objc/thr-os2.c \emx\gnu\gcc-2.8/objc/thr-os2.c
*** gcc-2.8/objc/thr-os2.c	Wed Dec  3 14:11:26 1997
--- \emx\gnu\gcc-2.8/objc/thr-os2.c	Mon Nov 23 19:09:14 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* thr-os2.c -- changed for emx by Eberhard Mattes -- Nov 1998 */
  /* GNU Objective C Runtime Thread Interface - OS/2 emx Implementation
     Copyright (C) 1996, 1997 Free Software Foundation, Inc.
     Contributed by Thomas Baier (baier@ci.tuwien.ac.at)
***************
*** 24,29 ****
--- 25,31 ----
     however invalidate any other reasons why the executable file might be
     covered by the GNU General Public License.  */
  
+ #include <stdlib.h>
  #include <objc/thr.h>
  #include "runtime.h"
  
***************
*** 178,184 ****
  int
  __objc_mutex_allocate(objc_mutex_t mutex)
  {
!   if (DosCreateMutexSem (NULL, (HMTX)(&(mutex->backend)),0L,0) > 0)
      return -1;
    else
      return 0;
--- 180,186 ----
  int
  __objc_mutex_allocate(objc_mutex_t mutex)
  {
!   if (DosCreateMutexSem (NULL, (PHMTX)(&(mutex->backend)),0L,0) > 0)
      return -1;
    else
      return 0;
diff -cr gcc-2.8/pexecute.c \emx\gnu\gcc-2.8/pexecute.c
*** gcc-2.8/pexecute.c	Wed Jan  7 23:40:36 1998
--- \emx\gnu\gcc-2.8/pexecute.c	Sun Nov  1 13:25:12 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* pexecute.c -- changed for emx by Eberhard Mattes -- Mar 1998 */
  /* Utilities to execute a program in a subprocess (possibly linked by pipes
     with other subprocesses), and wait for it.
     Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
***************
*** 368,373 ****
--- 369,470 ----
  
  #endif /* OS2 */
  
+ #ifdef __EMX__
+ 
+ #include <process.h>
+ 
+ extern int pipes_supported;
+ 
+ int
+ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
+      const char *program;
+      char * const *argv;
+      const char *this_pname;
+      const char *temp_base;
+      char **errmsg_fmt, **errmsg_arg;
+      int flags;
+ {
+   int pid;
+   int pdes[2], org_stdin, org_stdout, input_desc, output_desc;
+   /* Pipe waiting from last process, to be used as input for the next one.
+      Value is STDIN_FILE_NO if no pipe is waiting
+      (i.e. the next command is the first of a group).  */
+   static int last_pipe_input;
+ 
+   /* If this is the first process, initialize.  */
+   if (flags & PEXECUTE_FIRST)
+     last_pipe_input = STDIN_FILE_NO;
+ 
+   input_desc = last_pipe_input;
+   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 (! (flags & PEXECUTE_LAST))
+     {
+       if (pipe (pdes) < 0)
+ 	{
+ 	  *errmsg_fmt = "pipe";
+ 	  *errmsg_arg = NULL;
+ 	  return -1;
+ 	}
+       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 = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (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)
+     {
+       *errmsg_fmt = install_error_msg;
+       *errmsg_arg = program;
+       return -1;
+     }
+   return pid;
+ }
+ 
+ int
+ pwait (pid, status, flags)
+      int pid;
+      int *status;
+      int flags;
+ {
+   /* ??? Here's an opportunity to canonicalize the values in STATUS.
+      Needed?  */
+   do
+     {
+       pid = wait (status);
+     } while (pid == -1 && errno == EINTR);
+   return pid;
+ }
+ 
+ #endif /* __EMX__ */
+ 
  #ifdef MPW
  
  /* MPW pexecute doesn't actually run anything; instead, it writes out
***************
*** 505,511 ****
  
  /* include for Unix-like environments but not for Dos-like environments */
  #if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \
!     && ! defined (_WIN32)
  
  #ifdef VMS
  #define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \
--- 602,608 ----
  
  /* include for Unix-like environments but not for Dos-like environments */
  #if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \
!     && ! defined (_WIN32) && ! defined (__EMX__)
  
  #ifdef VMS
  #define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \
***************
*** 651,654 ****
    return pid;
  }
  
! #endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! _WIN32 */
--- 748,751 ----
    return pid;
  }
  
! #endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! _WIN32 && ! __EMX__ */
diff -cr gcc-2.8/profile.c \emx\gnu\gcc-2.8/profile.c
*** gcc-2.8/profile.c	Thu Jan 15 02:27:10 1998
--- \emx\gnu\gcc-2.8/profile.c	Mon Dec 21 01:18:38 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* profile.c -- changed for emx by Eberhard Mattes -- Dec 1998 */
  /* Calculate branch probabilities, and basic block execution counts. 
     Copyright (C) 1990, 91-94, 96, 97, 1998 Free Software Foundation, Inc.
     Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
***************
*** 1370,1376 ****
--- 1371,1381 ----
        strcpy (data_file, filename);
        strip_off_ending (data_file, len);
        strcat (data_file, ".bb");
+ #ifdef __EMX__
+       if ((bb_file = fopen (data_file, "wb")) == 0)
+ #else /* not __EMX__ */
        if ((bb_file = fopen (data_file, "w")) == 0)
+ #endif /* not __EMX__ */
  	pfatal_with_name (data_file);
  
        /* Open an output file for the program flow graph.  */
***************
*** 1379,1385 ****
--- 1384,1394 ----
        strcpy (bbg_file_name, filename);
        strip_off_ending (bbg_file_name, len);
        strcat (bbg_file_name, ".bbg");
+ #ifdef __EMX__
+       if ((bbg_file = fopen (bbg_file_name, "wb")) == 0)
+ #else /* not __EMX__ */
        if ((bbg_file = fopen (bbg_file_name, "w")) == 0)
+ #endif /* not __EMX__ */
  	pfatal_with_name (bbg_file_name);
  
        /* Initialize to zero, to ensure that the first file name will be
diff -cr gcc-2.8/toplev.c \emx\gnu\gcc-2.8/toplev.c
*** gcc-2.8/toplev.c	Sun May  2 13:31:04 1999
--- \emx\gnu\gcc-2.8/toplev.c	Sun Nov  1 13:25:12 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* toplev.c -- changed for emx by Eberhard Mattes -- Mar 1998 */
  /* Top level of GNU C compiler
     Copyright (C) 1987, 88, 89, 92-7, 1998 Free Software Foundation, Inc.
  
***************
*** 2157,2162 ****
--- 2158,2172 ----
  
    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;
***************
*** 2240,2262 ****
--- 2250,2292 ----
  
    /* 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 addressof dump desired, open the output file.  */
    if (addressof_dump)
+ #ifndef __EMX__
      addressof_dump_file = open_dump_file (dump_base_name, ".addressof");
+ #else /* __EMX__ */
+     addressof_dump_file = open_dump_file (dump_base_name, ".add");
+ #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 branch_prob dump desired, open the output file.  */
    if (branch_prob_dump)
***************
*** 2264,2294 ****
--- 2294,2352 ----
  
    /* 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)
***************
*** 2298,2304 ****
--- 2356,2366 ----
  
    /* 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
  
***************
*** 3734,3739 ****
--- 3796,3805 ----
    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;
***************
*** 4370,4375 ****
--- 4436,4442 ----
  	       lim - (char *) &environ);
        fflush (stderr);
  
+ #ifndef __EMX__
  #ifndef __MSDOS__
  #ifdef USG
        system ("ps -l 1>&2");
***************
*** 4377,4382 ****
--- 4444,4450 ----
        system ("ps v");
  #endif /* not USG */
  #endif
+ #endif /* !__EMX__ */
      }
  #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN32) */
  
diff -cr gcc-2.8/varasm.c \emx\gnu\gcc-2.8/varasm.c
*** gcc-2.8/varasm.c	Sun May  2 13:31:06 1999
--- \emx\gnu\gcc-2.8/varasm.c	Sun Nov  1 13:25:12 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* varasm.c -- changed for emx by Eberhard Mattes -- Mar 1998 */
  /* Output variables, constants and external declarations, for GNU compiler.
     Copyright (C) 1987, 88, 89, 92-97, 1998 Free Software Foundation, Inc.
  
***************
*** 1184,1189 ****
--- 1185,1199 ----
       tree decl;
       char *fnname;
  {
+ #ifdef EMX
+   if (TARGET_EPILOGUE)
+     {
+       char *lbl = alloca (strlen (fnname) + 8);
+       strcpy (lbl, "__POST$");
+       strcat (lbl, fnname);
+       ASM_OUTPUT_LABEL (asm_out_file, lbl);
+     }
+ #endif /* EMX */
  #ifdef ASM_DECLARE_FUNCTION_SIZE
    ASM_DECLARE_FUNCTION_SIZE (asm_out_file, fnname, decl);
  #endif
