*** gas-2.3/bfd/coff-apollo.c-dist	Wed Apr  6 20:57:58 1994
--- gas-2.3/bfd/coff-apollo.c	Mon Aug  8 13:34:10 1994
***************
*** 27,37 ****
--- 27,78 ----
  #include "coff/internal.h"
  #include "libcoff.h"
  
+ #define DOIT(x) \
+   x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) +  relocation) & howto->dst_mask))
+ 
+ /* This special function handles Apollo relocations.  Normal COFF
+    relocations are used, except that common symbols have the symbol
+    value included in the relocation target.  */
+ 
+ static bfd_reloc_status_type
+ DEFUN (coff_apollo_reloc, (abfd, reloc_entry, symbol, data,
+ 			   input_section, output_bfd),
+        bfd *abfd AND
+        arelent *reloc_entry AND
+        asymbol *symbol AND
+        PTR data AND
+        asection *input_section AND
+        bfd *output_bfd)
+ {
+   bfd_size_type addr = reloc_entry->address;
+   reloc_howto_type *howto = reloc_entry->howto;
+   bfd_vma relocation = symbol->value;
+ 
+   if (     bfd_is_com_section (symbol->section)   &&   relocation
+       &&   howto->size == 2)
+     {
+       /* This should be the only case possible for Apollo.  Add
+ 	 the common size to the target.  */
+       long  x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
+       DOIT (x);
+       bfd_put_32 (abfd, x, (bfd_byte *)data + addr);
+     }
+ 
+   /* Let bfd_perform_relocation handle all other relocations.  */
+   return bfd_reloc_continue;
+ }
+ 
  #ifdef ONLY_DECLARE_RELOCS
  extern reloc_howto_type apollocoff_howto_table[];
  #else
  reloc_howto_type apollocoff_howto_table[] = 
  {
+   /* WJE:  Apollo uses only R_DIR32 as late as SR10.3.5.  Relocation types
+      R_RELLONG and R_PCRLONG cause "illegal relocation type" messages
+      from the Apollo /bin/ld.  If another loader is used, these could be
+      permitted.  Apollo executables have relocations for routines in
+      shared libraries.  These are also restricted to R_DIR32 only.
+      For now, comment out the relative modes.
    HOWTO(R_RELBYTE,	       0,  0,  	8,  false, 0, complain_overflow_bitfield, 0, "8",	true, 0x000000ff,0x000000ff, false),
    HOWTO(R_RELWORD,	       0,  1, 	16, false, 0, complain_overflow_bitfield, 0, "16",	true, 0x0000ffff,0x0000ffff, false),
    HOWTO(R_RELLONG,	       0,  2, 	32, false, 0, complain_overflow_bitfield, 0, "32",	true, 0xffffffff,0xffffffff, false),
***************
*** 38,44 ****
    HOWTO(R_PCRBYTE,	       0,  0, 	8,  true,  0, complain_overflow_signed, 0, "DISP8",    true, 0x000000ff,0x000000ff, false),
    HOWTO(R_PCRWORD,	       0,  1, 	16, true,  0, complain_overflow_signed, 0, "DISP16",   true, 0x0000ffff,0x0000ffff, false),
    HOWTO(R_PCRLONG,	       0,  2, 	32, true,  0, complain_overflow_signed, 0, "DISP32",   true, 0xffffffff,0xffffffff, false),
!   HOWTO(R_RELLONG_NEG,	       0,  -2, 	32, false, 0, complain_overflow_bitfield, 0, "-32",	true, 0xffffffff,0xffffffff, false),
  };
  #endif /* not ONLY_DECLARE_RELOCS */
  
--- 79,87 ----
    HOWTO(R_PCRBYTE,	       0,  0, 	8,  true,  0, complain_overflow_signed, 0, "DISP8",    true, 0x000000ff,0x000000ff, false),
    HOWTO(R_PCRWORD,	       0,  1, 	16, true,  0, complain_overflow_signed, 0, "DISP16",   true, 0x0000ffff,0x0000ffff, false),
    HOWTO(R_PCRLONG,	       0,  2, 	32, true,  0, complain_overflow_signed, 0, "DISP32",   true, 0xffffffff,0xffffffff, false),
!   HOWTO(R_RELLONG_NEG,	       0,  -2, 	32, false, 0, complain_overflow_bitfield, 0, "-32",	true, 0xffffffff,0xffffffff, false), */
! 
!   HOWTO(R_DIR32,	       0,  2, 	32, false, 0, complain_overflow_bitfield, coff_apollo_reloc, "32",	true, 0xffffffff,0xffffffff, false)
  };
  #endif /* not ONLY_DECLARE_RELOCS */
  
***************
*** 59,73 ****
       int relocentry;
  {
    switch (relocentry) 
!   {
!    case R_RELBYTE:	internal->howto = apollocoff_howto_table + 0; break;
!    case R_RELWORD:	internal->howto = apollocoff_howto_table + 1; break;
!    case R_RELLONG:	internal->howto = apollocoff_howto_table + 2; break;
!    case R_PCRBYTE:	internal->howto = apollocoff_howto_table + 3; break;
!    case R_PCRWORD:	internal->howto = apollocoff_howto_table + 4; break;
!    case R_PCRLONG:	internal->howto = apollocoff_howto_table + 5; break;
!    case R_RELLONG_NEG:	internal->howto = apollocoff_howto_table + 6; break;
!   }
  }
  
  int 
--- 102,122 ----
       int relocentry;
  {
    switch (relocentry) 
!     {
!     /* WJE:  commented out
!     case R_RELBYTE:	internal->howto = apollocoff_howto_table + 0; break;
!     case R_RELWORD:	internal->howto = apollocoff_howto_table + 1; break;
!     case R_RELLONG:	internal->howto = apollocoff_howto_table + 2; break;
!     case R_PCRBYTE:	internal->howto = apollocoff_howto_table + 3; break;
!     case R_PCRWORD:	internal->howto = apollocoff_howto_table + 4; break;
!     case R_PCRLONG:	internal->howto = apollocoff_howto_table + 5; break;
!     case R_RELLONG_NEG:	internal->howto = apollocoff_howto_table + 6; break; */
! 
!     case R_DIR32:	internal->howto = apollocoff_howto_table + 0; break;
!     default:
!       internal->howto = 0;
!       BFD_FAIL ();
!     }
  }
  
  int 
***************
*** 75,99 ****
       CONST struct reloc_howto_struct *internal;
  {
    if (internal->pc_relative) 
-   {
-     switch (internal->bitsize) 
      {
!      case 32: return R_PCRLONG;
!      case 16: return R_PCRWORD;
!      case 8: return R_PCRBYTE;
      }
!   }
    else
!   {
!     switch (internal->bitsize)
!      {
!       case 32: return R_RELLONG;
!       case 16: return R_RELWORD;
!       case 8: return R_RELBYTE;
!      }
!   }
!   return R_RELLONG;    
  }
  #endif /* not ONLY_DECLARE_RELOCS */
  
  #define RTYPE2HOWTO(internal, relocentry) \
--- 124,169 ----
       CONST struct reloc_howto_struct *internal;
  {
    if (internal->pc_relative) 
      {
!       /* WJE:  commented out
!       switch (internal->bitsize) 
! 	{
! 	case 32: return R_PCRLONG;
! 	case 16: return R_PCRWORD;
! 	case 8: return R_PCRBYTE;
! 	} */
! 
!       BFD_FAIL ();
!       return 0;
      }
!   /* WJE:  commented out
    else
!     {
!       switch (internal->bitsize)
! 	{
! 	case 32: return R_RELLONG;
! 	case 16: return R_RELWORD;
! 	case 8: return R_RELBYTE;
! 	}
!     }
!   return R_RELLONG; */
! 
!   return R_DIR32;
  }
+ 
+ static reloc_howto_type *
+ DEFUN (coff_apollo_reloc_type_lookup, (abfd, code),
+        bfd *abfd AND
+        bfd_reloc_code_real_type code)
+ {
+   switch (code)
+     {
+     case BFD_RELOC_32:
+       return apollocoff_howto_table + 0;
+     default:
+       return 0;
+     }
+ }
  #endif /* not ONLY_DECLARE_RELOCS */
  
  #define RTYPE2HOWTO(internal, relocentry) \
***************
*** 103,109 ****
--- 173,224 ----
    external.r_type = apollo_howto2rtype(internal);
  
  #include "coffcode.h"
+ #undef coff_bfd_reloc_type_lookup
+ #define coff_bfd_reloc_type_lookup coff_apollo_reloc_type_lookup
+ #undef coff_close_and_cleanup
+ #define coff_close_and_cleanup apollo_coff_close_and_cleanup
  
+ boolean
+ DEFUN (apollo_coff_mkobject,(abfd),
+        bfd *abfd)
+ {
+   int ok = coff_mkobject (abfd);
+ 
+   /* Apollo object files always have an aouthdr.  Setting the flag
+      EXEC_P will create an aouthdr.  */
+   if (ok)
+     abfd->flags |= EXEC_P;
+ 
+   return ok;
+ }
+ 
+ boolean
+ DEFUN (apollo_coff_close_and_cleanup, (abfd),
+        bfd *abfd)
+ {
+   char *cmd;
+   int old_errno;
+ 
+   if (abfd->direction == write_direction)
+     {
+       /* Change the file type to coff, ignoring any failures.  It will
+ 	 fail if the file is on an NFS-mounted filesystem.  A flush is
+ 	 done before changing the file type for safety.
+ 	 This method is simpler than using ios_$ calls to create the file
+ 	 and safer than using unreleased file_$ calls to change the type.  */
+       bfd_flush (abfd);
+       old_errno = errno;
+       cmd = alloca (32 + strlen (abfd->filename));
+       if (cmd)
+ 	{
+ 	  sprintf (cmd, "/com/obty '%s' coff", abfd->filename);
+ 	  system (cmd);
+ 	}
+       errno = old_errno;
+     }
+   return true;
+ }
+ 
  bfd_target 
  #ifdef TARGET_SYM
    TARGET_SYM =
***************
*** 130,138 ****
  #else
    0,				/* leading underscore */
  #endif
!   '/',				/* ar_pad_char */
    15,				/* ar_max_namelen */
!   3,				/* minimum section alignment */
    bfd_getb64, bfd_getb_signed_64, bfd_putb64,
       bfd_getb32, bfd_getb_signed_32, bfd_putb32,
       bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
--- 245,253 ----
  #else
    0,				/* leading underscore */
  #endif
!   ' ',				/* ar_pad_char */
    15,				/* ar_max_namelen */
!   2,				/* minimum section alignment */
    bfd_getb64, bfd_getb_signed_64, bfd_putb64,
       bfd_getb32, bfd_getb_signed_32, bfd_putb32,
       bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
***************
*** 142,148 ****
  
   {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
     bfd_generic_archive_p, _bfd_dummy_target},
!  {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
     bfd_false},
   {bfd_false, coff_write_object_contents, /* bfd_write_contents */
     _bfd_write_archive_contents, bfd_false},
--- 257,263 ----
  
   {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
     bfd_generic_archive_p, _bfd_dummy_target},
!  {bfd_false, apollo_coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
     bfd_false},
   {bfd_false, coff_write_object_contents, /* bfd_write_contents */
     _bfd_write_archive_contents, bfd_false},
*** gas-2.3/bfd/coffcode.h-dist	Tue Apr 26 17:09:28 1994
--- gas-2.3/bfd/coffcode.h	Mon Aug  8 11:41:58 1994
***************
*** 318,327 ****
--- 318,335 ----
    if (!strcmp (sec_name, _TEXT))
      {
        styp_flags = STYP_TEXT;
+ #ifdef STYP_INSTRUCTION
+       /* For Apollo */
+       styp_flags |= STYP_INSTRUCTION;
+ #endif
      }
    else if (!strcmp (sec_name, _DATA))
      {
        styp_flags = STYP_DATA;
+ #ifdef STYP_ZERO
+       /* For Apollo */
+       styp_flags |= STYP_ZERO;
+ #endif
  #ifdef TWO_DATA_SECS
      }
    else if (!strcmp (sec_name, ".data2"))
***************
*** 329,334 ****
--- 337,383 ----
        styp_flags = STYP_DATA;
  #endif /* TWO_DATA_SECS */
      }
+ #ifdef _APTV
+   /* For Apollo.  Add the common Apollo section names.  If an _RWDI
+      compressed data section is used, then the data section flags would
+      have to be set to REG, BSS, ZERO, COMPRESSED.  */
+   else if (!strcmp(sec_name, _APTV))
+     {
+       styp_flags = STYP_DATA;
+     }
+   else if (!strcmp(sec_name, _BLOCKS))
+     {
+       styp_flags = STYP_RELOCATED_NOT_LOADED | STYP_DEBUG;
+     }
+   else if (!strcmp(sec_name, _INLIB))
+     {
+       styp_flags = STYP_LIB;
+     }
+   else if (!strcmp(sec_name, _LINES))
+     {
+       styp_flags = STYP_RELOCATED_NOT_LOADED | STYP_DEBUG;
+     }
+   else if (!strcmp(sec_name, _MIR))
+     {
+       styp_flags = STYP_INFO;
+     }
+   else if (!strcmp(sec_name, _RWDI))
+     {
+       styp_flags = STYP_RELOCATED_NOT_LOADED;
+     }
+   else if (!strcmp(sec_name, _SRI))
+     {
+       styp_flags = STYP_INFO;
+     }
+   else if (!strcmp(sec_name, _SYMBOLS))
+     {
+       styp_flags = STYP_RELOCATED_NOT_LOADED | STYP_DEBUG;
+     }
+   else if (!strcmp(sec_name, _UNWIND))
+     {
+       styp_flags = STYP_TEXT;
+     }
+ #endif /* _APTV */
    else if (!strcmp (sec_name, _BSS))
      {
        styp_flags = STYP_BSS;
***************
*** 359,369 ****
        styp_flags = STYP_INFO;
  #endif
      }
!   else if (!strcmp (sec_name, ".stab")
! 	   || !strncmp (sec_name, ".stabstr", 8))
      {
        styp_flags = STYP_INFO;
      }
    /* Try and figure out what it should be */
    else if (sec_flags & SEC_CODE)
      {
--- 408,426 ----
        styp_flags = STYP_INFO;
  #endif
      }
!   else if (!strcmp (sec_name, ".stab"))
      {
+ #ifdef STYP_RELOCATED_NOT_LOADED
+       /* For Apollo */
+       styp_flags = STYP_RELOCATED_NOT_LOADED;
+ #else
        styp_flags = STYP_INFO;
+ #endif
      }
+   else if (!strncmp (sec_name, ".stabstr", 8))
+     {
+       styp_flags = STYP_INFO;
+     }
    /* Try and figure out what it should be */
    else if (sec_flags & SEC_CODE)
      {
***************
*** 453,458 ****
--- 510,521 ----
  	 ensure that the section vma matches the section file
  	 position.  */
      }
+ #ifdef STYP_RELOCATED_NOT_LOADED
+   else if (styp_flags & STYP_RELOCATED_NOT_LOADED)
+     {
+       /* For Apollo.  Like STYP_INFO above. */
+     }
+ #endif
    else
      {
        sec_flags |= SEC_ALLOC | SEC_LOAD;
***************
*** 1199,1205 ****
  #ifdef MC68MAGIC
      case bfd_arch_m68k:
  #ifdef APOLLOM68KMAGIC
!       *magicp = APOLLO_COFF_VERSION_NUMBER;
  #else
        *magicp = MC68MAGIC;
  #endif
--- 1262,1277 ----
  #ifdef MC68MAGIC
      case bfd_arch_m68k:
  #ifdef APOLLOM68KMAGIC
!       /* WJE:  Apollo object files always have an aouthdr.  Set EXEC_P
! 	 so one will be generated by coff_write_object_contents ().  */
!       *magicp = APOLLOM68KMAGIC;
!       *flagsp = EXEC_P;
! 
!       /* If there are no text section relocations, set F_PIC.  The first
! 	 section is assumed to be the text section.  Such code may be
! 	 used as a shared library.  */
!       if (abfd->sections   &&   abfd->sections->reloc_count == 0)
! 	*flagsp |= F_PIC;
  #else
        *magicp = MC68MAGIC;
  #endif
***************
*** 1392,1398 ****
  
  /* If .file, .text, .data, .bss symbols are missing, add them.  */
  /* @@ Should we only be adding missing symbols, or overriding the aux
!    values for existing section symbols?  */
  static boolean
  coff_add_missing_symbols (abfd)
       bfd *abfd;
--- 1464,1471 ----
  
  /* If .file, .text, .data, .bss symbols are missing, add them.  */
  /* @@ Should we only be adding missing symbols, or overriding the aux
!    values for existing section symbols?  WJE:  the previous aux entry
!    is usually inaccurate, so it should be updated here.  */
  static boolean
  coff_add_missing_symbols (abfd)
       bfd *abfd;
***************
*** 1429,1434 ****
--- 1502,1511 ----
  	    need_data = 0;
  	  else if (!strcmp (name, _BSS))
  	    need_bss = 0;
+ 
+ 	  /* WJE:  Update section symbol aux entry.  */
+ 	  if (sympp[i]->flags & BSF_SECTION_SYM)
+ 	    (void) coff_section_symbol (abfd, name);
  	}
      }
    /* Now i == bfd_get_symcount (abfd).  */
*** gas-2.3/bfd/coffswap.h-dist	Wed May 11 01:05:48 1994
--- gas-2.3/bfd/coffswap.h	Mon Aug  8 11:41:58 1994
***************
*** 644,649 ****
--- 644,658 ----
    bfd_h_put_32(abfd, aouthdr_in->tagentries, (bfd_byte *) aouthdr_out->tagentries);
  #endif
  
+   /* FIXME not all platforms are here yet.  */
+ 
+ #ifdef APOLLO_M68
+   bfd_h_put_32(abfd, aouthdr_in->o_inlib, (bfd_byte *) aouthdr_out->o_inlib);
+   bfd_h_put_32(abfd, aouthdr_in->o_sri, (bfd_byte *) aouthdr_out->o_sri);
+   bfd_h_put_32(abfd, aouthdr_in->vid[0], (bfd_byte *) aouthdr_out->vid);
+   bfd_h_put_32(abfd, aouthdr_in->vid[1], (bfd_byte *) aouthdr_out->vid+4);
+ #endif
+ 
  #ifdef MIPSECOFF
    bfd_h_put_32(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start);
    bfd_h_put_32(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value);
*** gas-2.3/bfd/section.c-dist	Wed Mar 16 01:01:08 1994
--- gas-2.3/bfd/section.c	Mon Aug  8 11:41:59 1994
***************
*** 414,421 ****
  
  #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX)	\
    asymbol *SYM = (asymbol *) &global_syms[IDX]; \
!   asection SEC = { NAME, 0, 0, FLAGS, 0, 0, (boolean) 0, 0, 0, 0, &SEC,\
! 		    0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, (boolean) 0, \
  		     (asymbol *) &global_syms[IDX], &SYM, }
  
  STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol, BFD_COM_SECTION_NAME, 0);
--- 414,421 ----
  
  #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX)	\
    asymbol *SYM = (asymbol *) &global_syms[IDX]; \
!   asection SEC = { NAME, 0, 0, FLAGS, 0, (boolean) 0, 0, 0, 0, 0, &SEC,\
! 		    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (boolean) 0, \
  		     (asymbol *) &global_syms[IDX], &SYM, }
  
  STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol, BFD_COM_SECTION_NAME, 0);
*** gas-2.3/bfd/config/apollo.mh-dist	Wed Oct 13 18:08:40 1993
--- gas-2.3/bfd/config/apollo.mh	Mon Aug  8 11:41:59 1994
***************
*** 1,6 ****
! # Apollo cc can't get through all of bfd no matter what options you
! # give it. Use gcc instead.
  
! HDEFINES =
! RANLIB=echo >/dev/null
! CC= gcc
--- 1,13 ----
! # This is for Apollo systems using the BSD environment.  It has been tested
! # on SR10.3.5 with the version 6.8 compiler using ANSI headers.
  
! RANLIB = true
! 
! # Use this for the Apollo compiler.  It may be necessary to
! # add -U__STDC__ and -DUSG for earlier compilers.
! CC = cc -A systype,any -A runtype,any
! 
! # Use this for GCC.  For a final build, use the CFLAGS and LDFLAGS below.
! # CC = gcc
! # CFLAGS  = -O2
! # LDFLAGS = -s
*** gas-2.3/bfd/config/apollov68.mh-dist	Tue Aug 18 15:24:36 1992
--- gas-2.3/bfd/config/apollov68.mh	Mon Aug  8 11:41:59 1994
***************
*** 1,6 ****
! # vasta@apollo.com says this is how to compile on an Apollo (SR10.x).
! # Use a Berkeley environment.
! # sef@Cygnus.COM says this is how to compile on an apollo in the SysV
! # environment.
! CC=cc -A nansi -A cpu,3000 -A runtype,any -A systype,any -DSHORT_ENUM_BUG -DUSG -U__STDC__ -Dm68000=mc68000
! RANLIB = echo
--- 1,15 ----
! # This is for Apollo systems using the SYS5 environment.  The BSD version
! # has been tested on SR10.3.5 with the version 6.8 compiler
! # using ANSI headers.  This SYS5 version is untested.
! 
! RANLIB   = true
! HDEFINES = -DUSG
! 
! # Use this for the Apollo compiler.  It may be necessary to
! # add -U__STDC__ and -DUSG for earlier compilers.
! CC = cc -A systype,any -A runtype,any
! 
! # Use this for GCC.  For a final build, use the CFLAGS and LDFLAGS below.
! # CC = gcc
! # CFLAGS  = -O2
! # LDFLAGS = -s
*** gas-2.3/config/mh-a68bsd-dist	Tue Nov 16 22:57:03 1993
--- gas-2.3/config/mh-a68bsd	Mon Aug  8 11:42:00 1994
***************
*** 1,12 ****
! RANLIB=true
  
! #None of the Apollo compilers can compile gas or binutils.  The preprocessor
! # chokes on bfd, the compiler won't let you assign integers to enums, and
! # other problems.  Defining CC to gcc is a questionable way to say "don't use
! # the apollo compiler" (the preferred version of GCC could be called cc,
! # or whatever), but I'm not sure leaving CC as cc is any better...
  
! #CC=cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DNO_STDARG
! CC=gcc
  
! BISON=yacc
--- 1,13 ----
! # This is for Apollo systems using the BSD environment.  It has been tested
! # on SR10.3.5 with the version 6.8 compiler using ANSI headers.
  
! RANLIB = true
  
! # Use this for the Apollo compiler.  It may be necessary to
! # add -U__STDC__ and -DUSG for earlier compilers.
! CC = cc -A systype,any -A runtype,any
  
! # Use this for GCC.  For a final build, use the CFLAGS and LDFLAGS below.
! # CC = gcc
! # CFLAGS  = -O2
! # LDFLAGS = -s
*** gas-2.3/config/mh-apollo68-dist	Wed Jun 10 01:32:24 1992
--- gas-2.3/config/mh-apollo68	Mon Aug  8 11:42:00 1994
***************
*** 1,3 ****
  HDEFINES = -DUSG
! RANLIB=true
! CC= cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DUSG
--- 1,15 ----
+ # This is for Apollo systems using the SYS5 environment.  The BSD version
+ # has been tested on SR10.3.5 with the version 6.8 compiler
+ # using ANSI headers.  This SYS5 version is untested.
+ 
+ RANLIB   = true
  HDEFINES = -DUSG
! 
! # Use this for the Apollo compiler.  It may be necessary to
! # add -U__STDC__ and -DUSG for earlier compilers.
! CC = cc -A systype,any -A runtype,any
! 
! # Use this for GCC.  For a final build, use the CFLAGS and LDFLAGS below.
! # CC = gcc
! # CFLAGS  = -O2
! # LDFLAGS = -s
*** gas-2.3/gas/configure.in-dist	Wed May 11 01:07:12 1994
--- gas-2.3/gas/configure.in	Mon Aug  8 11:42:01 1994
***************
*** 183,189 ****
  			obj_format=aout emulation=sun3 ;;
    m68k-motorola-sysv)	obj_format=coff gas_target=m68kcoff emulation=delta ;;
    m68k-bull-sysv3*)	obj_format=coff gas_target=m68kcoff emulation=dpx2 ;;
!   m68k-apollo-*)	obj_format=coff gas_target=apollo emulation=apollo ;;
    m68k-*-coff | m68k-*-sysv*)
  			obj_format=coff gas_target=m68kcoff ;;
    m68k-*-hpux)		obj_format=hp300 emulation=hp300 ;;
--- 183,190 ----
  			obj_format=aout emulation=sun3 ;;
    m68k-motorola-sysv)	obj_format=coff gas_target=m68kcoff emulation=delta ;;
    m68k-bull-sysv3*)	obj_format=coff gas_target=m68kcoff emulation=dpx2 ;;
!   m68k-apollo-*)	obj_format=coff gas_target=apollo emulation=apollo
! 			 bfd_gas=yes ;;
    m68k-*-coff | m68k-*-sysv*)
  			obj_format=coff gas_target=m68kcoff ;;
    m68k-*-hpux)		obj_format=hp300 emulation=hp300 ;;
*** gas-2.3/gas/expr.c-dist	Thu Apr 14 17:30:12 1994
--- gas-2.3/gas/expr.c	Mon Aug  8 11:42:02 1994
***************
*** 865,873 ****
  };
  
  segT
! expr (rank, resultP)
!      operator_rankT rank;	/* Larger # is higher rank. */
!      expressionS *resultP;	/* Deliver result here. */
  {
    segT retval;
    expressionS right;
--- 865,873 ----
  };
  
  segT
! DEFUN (expr, (rank, resultP),
!        operator_rankT rank AND	/* Larger # is higher rank. */
!        expressionS *resultP)	/* Deliver result here. */
  {
    segT retval;
    expressionS right;
*** gas-2.3/gas/expr.h-dist	Thu Jan 27 19:00:33 1994
--- gas-2.3/gas/expr.h	Mon Aug  8 11:42:02 1994
***************
*** 117,123 ****
  typedef char operator_rankT;
  
  char get_symbol_end PARAMS ((void));
! segT expr PARAMS ((int rank, expressionS * resultP));
  unsigned int get_single_number PARAMS ((void));
  
  /* end of expr.h */
--- 117,123 ----
  typedef char operator_rankT;
  
  char get_symbol_end PARAMS ((void));
! segT expr PARAMS ((operator_rankT rank, expressionS * resultP));
  unsigned int get_single_number PARAMS ((void));
  
  /* end of expr.h */
*** gas-2.3/gas/frags.c-dist	Sun Jan 30 17:29:53 1994
--- gas-2.3/gas/frags.c	Mon Aug  8 11:42:03 1994
***************
*** 208,223 ****
   */
  
  char *
! frag_variant (type, max_chars, var, subtype, symbol, offset, opcode, pcrel_adjust, bsr)
!      relax_stateT type;
!      int max_chars;
!      int var;
!      relax_substateT subtype;
!      symbolS *symbol;
!      long offset;
!      char *opcode;
!      int pcrel_adjust;
!      char bsr;
  {
    register char *retval;
  
--- 208,224 ----
   */
  
  char *
! DEFUN (frag_variant, (type, max_chars, var, subtype, symbol, offset,
! 		      opcode, pcrel_adjust, bsr),
!      relax_stateT type AND
!      int max_chars AND
!      int var AND
!      relax_substateT subtype AND
!      symbolS *symbol AND
!      long offset AND
!      char *opcode AND
!      int pcrel_adjust AND
!      char bsr)
  {
    register char *retval;
  
*** gas-2.3/gas/frags.h-dist	Wed Nov 17 17:06:42 1993
--- gas-2.3/gas/frags.h	Mon Aug  8 11:42:03 1994
***************
*** 54,60 ****
  			    long offset,
  			    char *opcode,
  			    int pcrel_adjust,
! 			    int bsr));
  
  char *frag_var PARAMS ((relax_stateT type,
  			int max_chars,
--- 54,60 ----
  			    long offset,
  			    char *opcode,
  			    int pcrel_adjust,
! 			    char bsr));
  
  char *frag_var PARAMS ((relax_stateT type,
  			int max_chars,
*** gas-2.3/gas/write.c-dist	Wed May  4 02:05:41 1994
--- gas-2.3/gas/write.c	Mon Aug  8 11:42:04 1994
***************
*** 101,120 ****
   * Create a fixS in obstack 'notes'.
   */
  static fixS *
! fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
! 		  r_type)
!      fragS *frag;		/* Which frag? */
!      int where;			/* Where in that frag? */
!      int size;			/* 1, 2, or 4 usually. */
!      symbolS *add_symbol;	/* X_add_symbol. */
!      symbolS *sub_symbol;	/* X_op_symbol. */
!      offsetT offset;		/* X_add_number. */
!      int pcrel;			/* TRUE if PC-relative relocation. */
  #ifdef BFD_ASSEMBLER
!      bfd_reloc_code_real_type r_type; /* Relocation type */
  #else
!      int r_type;		/* Relocation type */
  #endif
  {
    fixS *fixP;
  
--- 101,121 ----
   * Create a fixS in obstack 'notes'.
   */
  static fixS *
! DEFUN (fix_new_internal, (frag, where, size, add_symbol, sub_symbol,
! 			  offset, pcrel, r_type),
!        fragS *frag AND		/* Which frag? */
!        int where AND		/* Where in that frag? */
!        int size AND		/* 1, 2, or 4 usually. */
!        symbolS *add_symbol AND	/* X_add_symbol. */
!        symbolS *sub_symbol AND	/* X_op_symbol. */
!        offsetT offset AND	/* X_add_number. */
!        int pcrel AND		/* TRUE if PC-relative relocation. */
  #ifdef BFD_ASSEMBLER
!        bfd_reloc_code_real_type r_type /* Relocation type */
  #else
!        int r_type		/* Relocation type */
  #endif
+        )
  {
    fixS *fixP;
  
***************
*** 185,202 ****
  /* Create a fixup relative to a symbol (plus a constant).  */
  
  fixS *
! fix_new (frag, where, size, add_symbol, offset, pcrel, r_type)
!      fragS *frag;		/* Which frag? */
!      int where;			/* Where in that frag? */
!      short int size;		/* 1, 2, or 4 usually. */
!      symbolS *add_symbol;	/* X_add_symbol. */
!      offsetT offset;		/* X_add_number. */
!      int pcrel;			/* TRUE if PC-relative relocation. */
  #ifdef BFD_ASSEMBLER
!      bfd_reloc_code_real_type r_type; /* Relocation type */
  #else
!      int r_type;		/* Relocation type */
  #endif
  {
    return fix_new_internal (frag, where, size, add_symbol,
  			   (symbolS *) NULL, offset, pcrel, r_type);
--- 186,204 ----
  /* Create a fixup relative to a symbol (plus a constant).  */
  
  fixS *
! DEFUN (fix_new, (frag, where, size, add_symbol, offset, pcrel, r_type),
!        fragS *frag AND		/* Which frag? */
!        int where AND		/* Where in that frag? */
!        short int size AND	/* 1, 2, or 4 usually. */
!        symbolS *add_symbol AND	/* X_add_symbol. */
!        offsetT offset AND	/* X_add_number. */
!        int pcrel AND		/* TRUE if PC-relative relocation. */
  #ifdef BFD_ASSEMBLER
!        bfd_reloc_code_real_type r_type /* Relocation type */
  #else
!        int r_type		/* Relocation type */
  #endif
+        )
  {
    return fix_new_internal (frag, where, size, add_symbol,
  			   (symbolS *) NULL, offset, pcrel, r_type);
***************
*** 207,223 ****
     file formats support anyhow.  */
  
  fixS *
! fix_new_exp (frag, where, size, exp, pcrel, r_type)
!      fragS *frag;		/* Which frag? */
!      int where;			/* Where in that frag? */
!      short int size;		/* 1, 2, or 4 usually. */
!      expressionS *exp;		/* Expression.  */
!      int pcrel;			/* TRUE if PC-relative relocation. */
  #ifdef BFD_ASSEMBLER
!      bfd_reloc_code_real_type r_type; /* Relocation type */
  #else
!      int r_type;		/* Relocation type */
  #endif
  {
    symbolS *add = NULL;
    symbolS *sub = NULL;
--- 209,226 ----
     file formats support anyhow.  */
  
  fixS *
! DEFUN (fix_new_exp, (frag, where, size, exp, pcrel, r_type),
!        fragS *frag AND		/* Which frag? */
!        int where AND		/* Where in that frag? */
!        short int size AND	/* 1, 2, or 4 usually. */
!        expressionS *exp AND	/* Expression.  */
!        int pcrel AND		/* TRUE if PC-relative relocation. */
  #ifdef BFD_ASSEMBLER
!        bfd_reloc_code_real_type r_type /* Relocation type */
  #else
!        int r_type		/* Relocation type */
  #endif
+        )
  {
    symbolS *add = NULL;
    symbolS *sub = NULL;
*** gas-2.3/gas/write.h-dist	Wed Dec 29 15:21:07 1993
--- gas-2.3/gas/write.h	Mon Aug  8 11:42:04 1994
***************
*** 149,165 ****
  void number_to_chars_bigendian    PARAMS ((char *, valueT, int));
  
  #ifdef BFD_ASSEMBLER
! fixS *fix_new PARAMS ((fragS * frag, int where, int size,
  		       symbolS * add_symbol, offsetT offset, int pcrel,
  		       bfd_reloc_code_real_type r_type));
! fixS *fix_new_exp PARAMS ((fragS * frag, int where, int size,
  			   expressionS *exp, int pcrel,
  			   bfd_reloc_code_real_type r_type));
  #else
! fixS *fix_new PARAMS ((fragS * frag, int where, int size,
  		       symbolS * add_symbol, offsetT offset, int pcrel,
  		       int r_type));
! fixS *fix_new_exp PARAMS ((fragS * frag, int where, int size,
  			   expressionS *exp, int pcrel, int r_type));
  #endif
  
--- 149,165 ----
  void number_to_chars_bigendian    PARAMS ((char *, valueT, int));
  
  #ifdef BFD_ASSEMBLER
! fixS *fix_new PARAMS ((fragS * frag, int where, short int size,
  		       symbolS * add_symbol, offsetT offset, int pcrel,
  		       bfd_reloc_code_real_type r_type));
! fixS *fix_new_exp PARAMS ((fragS * frag, int where, short int size,
  			   expressionS *exp, int pcrel,
  			   bfd_reloc_code_real_type r_type));
  #else
! fixS *fix_new PARAMS ((fragS * frag, int where, short int size,
  		       symbolS * add_symbol, offsetT offset, int pcrel,
  		       int r_type));
! fixS *fix_new_exp PARAMS ((fragS * frag, int where, short int size,
  			   expressionS *exp, int pcrel, int r_type));
  #endif
  
*** gas-2.3/gas/config/atof-ieee.c-dist	Thu Mar  3 13:37:40 1994
--- gas-2.3/gas/config/atof-ieee.c	Mon Aug  8 11:42:05 1994
***************
*** 156,162 ****
  char *
  atof_ieee (str, what_kind, words)
       char *str;			/* Text to convert to binary. */
!      char what_kind;		/* 'd', 'f', 'g', 'h' */
       LITTLENUM_TYPE *words;	/* Build the binary here. */
  {
    /* Extra bits for zeroed low-order bits.  The 1st MAX_PRECISION are
--- 156,162 ----
  char *
  atof_ieee (str, what_kind, words)
       char *str;			/* Text to convert to binary. */
!      int what_kind;		/* 'd', 'f', 'g', 'h' */
       LITTLENUM_TYPE *words;	/* Build the binary here. */
  {
    /* Extra bits for zeroed low-order bits.  The 1st MAX_PRECISION are
*** gas-2.3/gas/config/obj-coff.c-dist	Wed May 18 18:50:07 1994
--- gas-2.3/gas/config/obj-coff.c	Mon Aug  8 11:42:06 1994
***************
*** 1025,1031 ****
  	    }
  	}
        if (S_IS_EXTERNAL (symp))
! 	S_SET_STORAGE_CLASS (symp, C_EXT);
        else if (SF_GET_LOCAL (symp))
  	*punt = 1;
        /* more ... */
--- 1025,1038 ----
  	    }
  	}
        if (S_IS_EXTERNAL (symp))
! 	{
! 	  S_SET_STORAGE_CLASS (symp, C_EXT);
! 
! #ifdef SET_COFF_EXTERN_TYPE
! 	  /* WJE:  Used by Apollo to silence ld warnings.  */
! 	  SET_COFF_EXTERN_TYPE (symp);
! #endif
! 	}
        else if (SF_GET_LOCAL (symp))
  	*punt = 1;
        /* more ... */
***************
*** 1119,1125 ****
  		case 'b': flags |= SEC_ALLOC; flags &=~ SEC_LOAD; break;
  		case 'n': flags &=~ SEC_LOAD; break;
  		case 'd':
! 		case 'w': flags &=~ SEC_READONLY; break;
  		case 'x': flags |= SEC_CODE; break;
  
  		case 'i': /* STYP_INFO */
--- 1126,1135 ----
  		case 'b': flags |= SEC_ALLOC; flags &=~ SEC_LOAD; break;
  		case 'n': flags &=~ SEC_LOAD; break;
  		case 'd':
! 		case 'w':
! 		  flags &=~ SEC_READONLY;
! 		  flags |=  SEC_DATA;   /* WJE:  for Apollo */
! 		  break;
  		case 'x': flags |= SEC_CODE; break;
  
  		case 'i': /* STYP_INFO */
***************
*** 1180,1185 ****
--- 1190,1201 ----
    mask = ((bfd_vma) 1 << (bfd_vma) sec->alignment_power) - 1;
    if (size & mask)
      bfd_set_section_size (stdoutput, sec, (size + mask) & ~mask);
+ 
+ #ifdef SECTION_REQUIRES_SYMBOL
+   /* WJE:  make section symbol.  This is used by Apollo.  */
+   if (SECTION_REQUIRES_SYMBOL (sec))
+     (void) section_symbol (sec);
+ #endif
  
    /* @@ these should be in a "stabs.h" file, or maybe as.h */
  #ifndef STAB_SECTION_NAME
*** gas-2.3/gas/config/tc-m68k.c-dist	Tue Apr 26 17:21:09 1994
--- gas-2.3/gas/config/tc-m68k.c	Mon Aug  8 11:42:07 1994
***************
*** 28,33 ****
--- 28,45 ----
  
  #include "obstack.h"
  
+ #ifdef TE_APOLLO
+ /* WJE:  The Apollo loader and run-time system support only direct 32-bit
+    relocations.  PC-relative modes are NOT supported at all.  The Apollo
+    shared library linkage convention uses code stubs in the .data or
+    .aptv sections.  All the subseg_change () calls were made conditional
+    on NO_SUBSEG_CHANGES.  FIXME All the subseg_change () calls and
+    NO_SUBSEG_CHANGES could be removed if not needed on any other platform.  */
+ #define NO_PCREL_RELOCS
+ #define NO_SUBSEG_CHANGES
+ #define DISP_INCLUDES_ADDRESS
+ #endif
+ 
  /* The opcode table is too big for gcc, which (currently) requires
     exponential space at compile time for initialized arrays.  */
  #ifdef __GNUC__
***************
*** 529,534 ****
--- 541,552 ----
  #ifdef TE_SUN3
    {"align", s_align_bytes, 0},
  #endif
+ #ifdef TE_APOLLO
+   /* Generate 24-bit unaligned integers for use in making .unwind section
+      entries. This may not work unless the operands are constants or
+      differences between two labels.  */
+   {"int24", cons, 3},
+ #endif
    {0, 0, 0}
  };
  
***************
*** 3939,3948 ****
  /* Turn a string in input_line_pointer into a floating point constant of type
     type, and store the appropriate bytes in *litP.  The number of LITTLENUMS
     emitted is stored in *sizeP .  An error message is returned, or NULL on OK.
     */
  char *
  md_atof (type, litP, sizeP)
!      char type;
       char *litP;
       int *sizeP;
  {
--- 3957,3968 ----
  /* Turn a string in input_line_pointer into a floating point constant of type
     type, and store the appropriate bytes in *litP.  The number of LITTLENUMS
     emitted is stored in *sizeP .  An error message is returned, or NULL on OK.
+    FIXME this routine is defined with "char type" on some platforms and
+    "int type" on others.  gas/tc.h declares TYPE as int.
     */
  char *
  md_atof (type, litP, sizeP)
!      int type;
       char *litP;
       int *sizeP;
  {
***************
*** 4034,4039 ****
--- 4054,4069 ----
        upper_limit = 0x7fff;
        lower_limit = -0x8000;
        break;
+ #ifdef TE_APOLLO
+     case 3:
+       /* Allow 24-bit fixups for Apollo .unwind sections.  */
+       *buf++ = (val >> 16);
+       *buf++ = (val >> 8);
+       *buf++ = val;
+       upper_limit = 0x7FFFFF;
+       lower_limit = -0x800000;
+       break;
+ #endif
      case 4:
        *buf++ = (val >> 24);
        *buf++ = (val >> 16);
***************
*** 4069,4077 ****
  
  #ifdef BFD_ASSEMBLER
  int
! md_apply_fix (fixP, valp)
!      fixS *fixP;
!      long *valp;
  {
    md_apply_fix_2 (fixP, *valp);
    return 1;
--- 4099,4107 ----
  
  #ifdef BFD_ASSEMBLER
  int
! DEFUN (md_apply_fix, (fixP, valp),
!      fixS *fixP AND
!      valueT *valp)
  {
    md_apply_fix_2 (fixP, *valp);
    return 1;
***************
*** 4112,4118 ****
--- 4142,4158 ----
    /* No longer true:   know(fragP->fr_symbol); */
  
    /* The displacement of the address, from current location.  */
+ #ifdef DISP_INCLUDES_ADDRESS
+   /* WJE:  for Apollo, appears OK for all platforms.  */
+   disp = (fragP->fr_symbol
+ 	  ?   (S_GET_VALUE (fragP->fr_symbol)
+ 	       +   fragP->fr_symbol->sy_frag->fr_address)
+ 	  :   0);
+ #else
+   /* WJE:  this looks wrong, fails on Apollo.  FIXME if this is always
+      wrong, remove it and DISP_INCLUDES_ADDRESS conditional.  */
    disp = fragP->fr_symbol ? S_GET_VALUE (fragP->fr_symbol) : 0;
+ #endif
    disp = (disp + fragP->fr_offset) - object_address;
  
    switch (fragP->fr_subtype)
***************
*** 4136,4148 ****
--- 4176,4201 ----
        ext = 2;
        break;
      case TAB (ABRANCH, LONG):
+ #ifdef NO_PCREL_RELOCS
+       /* This is for systems like Apollo that lack PC-relative relocations.
+ 	 This is only a partial fix covering normal GCC output.  This
+ 	 problem would also affect some other instructions and cases that
+ 	 GCC does not generate.  The only problem case is JBSR to an
+ 	 external or non-text target.  GCC-generated branches are normally
+ 	 local, so BSR would not need relocation.  */
+       if (cpu_of_arch (current_architecture) < m68020
+ 	  ||   S_GET_SEGMENT (fragP->fr_symbol) != text_section)
+ #else
        if (cpu_of_arch (current_architecture) < m68020)
+ #endif
  	{
  	  if (fragP->fr_opcode[0] == 0x61)
  	    {
  	      fragP->fr_opcode[0] = 0x4E;
  	      fragP->fr_opcode[1] = (char) 0xB9; /* JBSR with ABSL LONG offset */
+ #ifndef NO_SUBSEG_CHANGES
  	      subseg_change (text_section, 0); /* @@ */
+ #endif
  
  	      fix_new (fragP,
  		       fragP->fr_fix,
***************
*** 4159,4165 ****
--- 4212,4220 ----
  	    {
  	      fragP->fr_opcode[0] = 0x4E;
  	      fragP->fr_opcode[1] = (char) 0xF9; /* JMP  with ABSL LONG offset */
+ #ifndef NO_SUBSEG_CHANGES
  	      subseg_change (text_section, 0); /* @@ */
+ #endif
  	      fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
  		       fragP->fr_offset, 0, NO_RELOC);
  	      fragP->fr_fix += 4;
***************
*** 4188,4194 ****
--- 4243,4251 ----
        *buffer_address++ = 0x4e;	/* put in jmp long (0x4ef9) */
        *buffer_address++ = (char) 0xf9;
        fragP->fr_fix += 2;	/* account for jmp instruction */
+ #ifndef NO_SUBSEG_CHANGES
        subseg_change (text_section, 0);
+ #endif
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
  	       fragP->fr_offset, 0, NO_RELOC);
        fragP->fr_fix += 4;
***************
*** 4206,4212 ****
--- 4263,4271 ----
        *buffer_address++ = (char) 0xf9;
  
        fragP->fr_fix += 6;	/* account for bra/jmp instructions */
+ #ifndef NO_SUBSEG_CHANGES
        subseg_change (text_section, 0);
+ #endif
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
  	       fragP->fr_offset, 0, NO_RELOC);
        fragP->fr_fix += 4;
***************
*** 4227,4233 ****
--- 4286,4294 ----
        /* The thing to do here is force it to ABSOLUTE LONG, since
  	PCREL is really trying to shorten an ABSOLUTE address anyway */
        /* JF FOO This code has not been tested */
+ #ifndef NO_SUBSEG_CHANGES
        subseg_change (text_section, 0);
+ #endif
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
  	       0, NO_RELOC);
        if ((fragP->fr_opcode[1] & 0x3F) != 0x3A)
***************
*** 4240,4246 ****
--- 4301,4309 ----
        ext = 0;
        break;
      case TAB (PCLEA, SHORT):
+ #ifndef NO_SUBSEG_CHANGES
        subseg_change (text_section, 0);
+ #endif
        fix_new (fragP, (int) (fragP->fr_fix), 2, fragP->fr_symbol,
  	       fragP->fr_offset, 1, NO_RELOC);
        fragP->fr_opcode[1] &= ~0x3F;
***************
*** 4248,4254 ****
--- 4311,4319 ----
        ext = 2;
        break;
      case TAB (PCLEA, LONG):
+ #ifndef NO_SUBSEG_CHANGES
        subseg_change (text_section, 0);
+ #endif
        fix_new (fragP, (int) (fragP->fr_fix) + 2, 4, fragP->fr_symbol,
  	       fragP->fr_offset + 2, 1, NO_RELOC);
        *buffer_address++ = 0x01;
***************
*** 4278,4287 ****
  #else
  
  void
! md_convert_frag (abfd, sec, fragP)
!      bfd *abfd;
!      asection sec;
!      fragS *fragP;
  {
    md_convert_frag_1 (fragP);
  }
--- 4343,4352 ----
  #else
  
  void
! DEFUN (md_convert_frag, (abfd, sec, fragP),
!      bfd *abfd AND
!      segT sec AND
!      fragS *fragP)
  {
    md_convert_frag_1 (fragP);
  }
***************
*** 4312,4318 ****
--- 4377,4390 ----
  	    fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), BYTE);
  	    break;
  	  }
+ #ifdef NO_PCREL_RELOCS
+ 	/* WJE:  See note in md_convert_frag_1 () above.  */
+ 	else if ((fragP->fr_symbol == 0)
+ 		 || (cpu_of_arch (current_architecture) < m68020)
+ 		 || S_GET_SEGMENT (fragP->fr_symbol) != text_section)
+ #else
  	else if ((fragP->fr_symbol == 0) || (cpu_of_arch (current_architecture) < m68020))
+ #endif
  	  {
  	    /* On 68000, or for absolute value, switch to abs long */
  	    /* FIXME, we should check abs val, pick short or long */
***************
*** 4320,4326 ****
--- 4392,4400 ----
  	      {
  		fragP->fr_opcode[0] = 0x4E;
  		fragP->fr_opcode[1] = (char) 0xB9; /* JBSR with ABSL LONG offset */
+ #ifndef NO_SUBSEG_CHANGES
  		subseg_change (text_section, 0);
+ #endif
  		fix_new (fragP, fragP->fr_fix, 4,
  			 fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC);
  		fragP->fr_fix += 4;
***************
*** 4330,4336 ****
--- 4404,4412 ----
  	      {
  		fragP->fr_opcode[0] = 0x4E;
  		fragP->fr_opcode[1] = (char) 0xF9; /* JMP  with ABSL LONG offset */
+ #ifndef NO_SUBSEG_CHANGES
  		subseg_change (text_section, 0);
+ #endif
  		fix_new (fragP, fragP->fr_fix, 4,
  			 fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC);
  		fragP->fr_fix += 4;
***************
*** 4402,4408 ****
--- 4478,4486 ----
  	    buffer_address[0] = 0x4e;	/* put in jmp long (0x4ef9) */
  	    buffer_address[1] = (char) 0xf8;
  	    fragP->fr_fix += 2;	/* account for jmp instruction */
+ #ifndef NO_SUBSEG_CHANGES
  	    subseg_change (text_section, 0);
+ #endif
  	    fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
  		     fragP->fr_offset, 0, NO_RELOC);
  	    fragP->fr_fix += 2;
***************
*** 4414,4420 ****
--- 4492,4500 ----
  	    buffer_address[0] = 0x4e;	/* put in jmp long (0x4ef9) */
  	    buffer_address[1] = (char) 0xf9;
  	    fragP->fr_fix += 2;	/* account for jmp instruction */
+ #ifndef NO_SUBSEG_CHANGES
  	    subseg_change (text_section, 0);
+ #endif
  	    fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
  		     fragP->fr_offset, 0, NO_RELOC);
  	    fragP->fr_fix += 4;
***************
*** 4445,4451 ****
--- 4525,4533 ----
  	    buffer_address[4] = 0x4e;	/* Put in Jump Word */
  	    buffer_address[5] = (char) 0xf8;
  	    fragP->fr_fix += 6;	/* account for bra/jmp instruction */
+ #ifndef NO_SUBSEG_CHANGES
  	    subseg_change (text_section, 0);
+ #endif
  	    fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
  		     fragP->fr_offset, 0, NO_RELOC);
  	    fragP->fr_fix += 2;
***************
*** 4457,4463 ****
--- 4539,4547 ----
  	    buffer_address[4] = 0x4e;	/* put in jmp long (0x4ef9) */
  	    buffer_address[5] = (char) 0xf9;
  	    fragP->fr_fix += 6;	/* account for bra/jmp instruction */
+ #ifndef NO_SUBSEG_CHANGES
  	    subseg_change (text_section, 0);
+ #endif
  	    fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
  		     fragP->fr_offset, 0, NO_RELOC);
  	    fragP->fr_fix += 4;
*** gas-2.3/include/coff/apollo.h-dist	Wed Oct 13 17:57:17 1993
--- gas-2.3/include/coff/apollo.h	Mon Aug  8 11:42:07 1994
***************
*** 36,42 ****
--- 36,45 ----
  #define	FILHDR	struct external_filehdr
  #define	FILHSZ	sizeof(FILHDR)
  
+ /* Apollo-specific f_flags bits.  */
+ #define F_PIC (0x8000)   /* file contains position-independent code.  */
  
+ 
  /********************** AOUT "OPTIONAL HEADER" **********************/
  
  typedef struct 
***************
*** 95,110 ****
  #define _TV	".tv"
  #define _INIT	".init"
  #define _FINI	".fini"
! #define	_LINES	".lines"
! #define	_BLOCKS	".blocks"
! #define _SRI    ".sri"                  /* Static Resource Information (systype,
!  et al.) */
! #define _MIR    ".mir"                  /* Module Information Records  */
! #define _APTV   ".aptv"                 /* Apollo-style transfer vectors. */
! #define _INLIB  ".inlib"                /* Shared Library information */
! #define _RWDI   ".rwdi"         /* Read/write data initialization directives for
!  compressed sections */
! #define _UNWIND ".unwind"               /* Stack unwind information */
  
  #define	SCNHDR	struct external_scnhdr
  #define	SCNHSZ	sizeof(SCNHDR)
--- 98,116 ----
  #define _TV	".tv"
  #define _INIT	".init"
  #define _FINI	".fini"
! #define	_LINES	".lines"	/* Line numbers for debugging */
! #define	_BLOCKS	".blocks"	/* Code blocks for debugging */
! #define _SYMBOLS ".symbols"	/* Symbols for debugging */
! #define _SRI    ".sri"		/* Static Resource Information
! 				   (systype, et al.) */
! #define _MIR    ".mir"		/* Module Information Records  */
! #define _APTV   ".aptv"		/* Transfer vectors used to call routines
! 				   in shared libraries */
! #define _INLIB  ".inlib"	/* Shared Library information */
! #define _RWDI   ".rwdi"		/* Read/write data initialization
! 				   directives for compressed sections */
! #define _UNWIND ".unwind"	/* Stack unwind information for debuggers
! 				   and the tb (traceback) command */
  
  #define	SCNHDR	struct external_scnhdr
  #define	SCNHSZ	sizeof(SCNHDR)
*** gas-2.3/libiberty/config/mh-a68bsd-dist	Tue Apr 14 16:33:25 1992
--- gas-2.3/libiberty/config/mh-a68bsd	Mon Aug  8 11:42:08 1994
***************
*** 1,2 ****
! RANLIB=ranlib
! CC= cc -A ansi -A runtype,any -A systype,any -U__STDC__
--- 1,13 ----
! # This is for Apollo systems using the BSD environment.  It has been tested
! # on SR10.3.5 with the version 6.8 compiler using ANSI headers.
! 
! RANLIB = true
! 
! # Use this for the Apollo compiler.  It may be necessary to
! # add -U__STDC__ and -DUSG for earlier compilers.
! CC = cc -A systype,any -A runtype,any
! 
! # Use this for GCC.  For a final build, use the CFLAGS and LDFLAGS below.
! # CC = gcc
! # CFLAGS  = -O2
! # LDFLAGS = -s
*** gas-2.3/libiberty/config/mh-apollo68-dist	Thu Dec  3 00:53:17 1992
--- gas-2.3/libiberty/config/mh-apollo68	Mon Aug  8 11:42:08 1994
***************
*** 1,2 ****
! RANLIB=true
! CC= cc -A ansi -A runtype,any -A systype,any -U__STDC__
--- 1,15 ----
! # This is for Apollo systems using the SYS5 environment.  The BSD version
! # has been tested on SR10.3.5 with the version 6.8 compiler
! # using ANSI headers.  This SYS5 version is untested.
! 
! RANLIB   = true
! HDEFINES = -DUSG
! 
! # Use this for the Apollo compiler.  It may be necessary to
! # add -U__STDC__ and -DUSG for earlier compilers.
! CC = cc -A systype,any -A runtype,any
! 
! # Use this for GCC.  For a final build, use the CFLAGS and LDFLAGS below.
! # CC = gcc
! # CFLAGS  = -O2
! # LDFLAGS = -s
