]> Git Repo - binutils.git/blobdiff - bfd/aoutf1.h
* bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
[binutils.git] / bfd / aoutf1.h
index 11da04c74d37bd5a624e76a9a7d96ccf6f56be9d..2f4b7286ddb07699fbc99554766fc3dd8f79ac9b 100644 (file)
@@ -1,5 +1,5 @@
-/* A.out "format 1" file handling code
-   Copyright (C) 1990-1991 Free Software Foundation, Inc.
+/* A.out "format 1" file handling code for BFD.
+   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -29,6 +29,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "aout/stab_gnu.h"
 #include "aout/ar.h"
 
+/* This is needed to reject a NewsOS file, e.g. in
+   gdb/testsuite/gdb.t10/crossload.exp. <[email protected]>
+   I needed to add M_UNKNOWN to recognize a 68000 object, so this will
+   probably no longer reject a NewsOS object.  <[email protected]>. */
+#define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \
+                           || (mtype) == M_68010 \
+                           || (mtype) == M_68020 \
+                           || (mtype) == M_SPARC)
+
 /*
 The file @code{aoutf1.h} contains the code for BFD's
 a.out back end. Control over the generated back end is given by these
@@ -51,8 +60,6 @@ The name put into the target vector.
 
 */
 
-void (*bfd_error_trap)();
-
 /*SUPPRESS558*/
 /*SUPPRESS529*/
 
@@ -67,9 +74,9 @@ DEFUN(NAME(sunos,set_arch_mach), (abfd, machtype),
 
   case M_UNKNOWN:
       /* Some Sun3s make magic numbers without cpu types in them, so
-        we'll default to the 68020. */
+        we'll default to the 68000. */
     arch = bfd_arch_m68k;
-    machine = 68020;
+    machine = 68000;
     break;
     
   case M_68010:
@@ -90,6 +97,7 @@ DEFUN(NAME(sunos,set_arch_mach), (abfd, machtype),
     break;
     
   case M_386:
+  case M_386_DYNIX:
     arch = bfd_arch_i386;
     machine = 0;
     break;
@@ -171,9 +179,22 @@ DEFUN(NAME(aout,sunos4_write_object_contents),
   }
     
   choose_reloc_size(abfd);
-    
-  /* FIXME */
-  N_SET_FLAGS (*execp, 0x1);
+
+#if 0
+  /* Some tools want this to be 0, some tools want this to be one.
+     Today, it seems that 0 is the most important setting (PR1927) */
+  N_SET_FLAGS (*execp, 0x0);
+#else
+
+  /* Fri Jun 11 14:23:31 PDT 1993
+     FIXME 
+     Today's optimal setting is 1.  This is a pain, since it
+     reopens 1927.  This should be readdressed by creating a new
+     target for each each supported, giving perhaps sun3/m68k
+     and sun4/sparc a.out formats.
+     */
+  N_SET_FLAGS (*execp, 1);
+#endif
     
   WRITE_HEADERS(abfd, execp);
 
@@ -272,7 +293,7 @@ struct internal_sunos_core {
   int c_tsize;                   /* Text size (bytes) */
   int c_dsize;                   /* Data size (bytes) */
   int c_ssize;                   /* Stack size (bytes) */
-  long c_stacktop;               /* Stack top (address) */
+  bfd_vma c_stacktop;            /* Stack top (address) */
   char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
   long fp_stuff_pos;           /* file offset of external FPU state (regs) */
   int fp_stuff_size;           /* Size of it */
@@ -337,10 +358,30 @@ DEFUN(swapcore_sparc,(abfd, ext, intcore),
   intcore->c_ucode =
     bfd_h_get_32 (abfd, 
                  intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *)extcore);
+
   /* Supposedly the user stack grows downward from the bottom of kernel memory.
-     Presuming that this remains true, this definition will work. */
-#define SPARC_USRSTACK (-(128*1024*1024))
-  intcore->c_stacktop = SPARC_USRSTACK;        /* By experimentation */
+     Presuming that this remains true, this definition will work.  */
+  /* Now sun has provided us with another challenge.  The value is different
+     for sparc2 and sparc10 (both running SunOS 4.1.3).  We pick one or
+     the other based on the current value of the stack pointer.  This
+     loses (a) if the stack pointer has been clobbered, or (b) if the stack
+     is larger than 128 megabytes.
+
+     It's times like these you're glad they're switching to ELF.
+
+     Note that using include files or nlist on /vmunix would be wrong,
+     because we want the value for this core file, no matter what kind of
+     machine we were compiled on or are running on.  */
+#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
+#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
+  {
+    bfd_vma sp = bfd_h_get_32
+      (abfd, (unsigned char *)&((struct regs *)&extcore->c_regs[0])->r_o6);
+    if (sp < SPARC_USRSTACK_SPARC10)
+      intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
+    else
+      intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
+  }
 }
 
 /* need this cast because ptr is really void * */
@@ -374,8 +415,6 @@ DEFUN(sunos4_core_file_p,(abfd),
     char external_core[1];
   } *mergem;
   
-  bfd_error = system_call_error;
-  
   if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) !=
       sizeof (longbuf))
     return 0;
@@ -525,32 +564,7 @@ DEFUN(sunos4_core_file_matches_executable_p, (core_bfd, exec_bfd),
                  sizeof (struct internal_exec)) == 0) ? true : false;
 }
 
-extern reloc_howto_type aout_32_ext_howto_table[];
-
-static reloc_howto_type *
-DEFUN (sunos4_reloc_type_lookup, (abfd, code),
-       bfd *abfd AND
-       bfd_reloc_code_real_type code)
-{
-  switch (bfd_get_arch (abfd))
-    {
-    default:
-      return 0;
-    case bfd_arch_sparc:
-      switch (code)
-       {
-       default:
-         return 0;
-#define IDX(i,j)       case i: return &aout_32_ext_howto_table[j]
-         IDX (BFD_RELOC_CTOR, 2);
-         IDX (BFD_RELOC_32, 2);
-         IDX (BFD_RELOC_HI22, 8);
-         IDX (BFD_RELOC_LO10, 11);
-         IDX (BFD_RELOC_32_PCREL_S2, 6);
-       }
-    }
-}
-
+#define MY_set_sizes sunos4_set_sizes
 static boolean
 DEFUN (sunos4_set_sizes, (abfd),
        bfd *abfd)
@@ -582,9 +596,10 @@ static CONST struct aout_backend_data sunos4_aout_backend = {
 
 #define MY_bfd_debug_info_start                bfd_void
 #define MY_bfd_debug_info_end          bfd_void
-#define MY_bfd_debug_info_accumulate   (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
-#define MY_core_file_p sunos4_core_file_p
-#define MY_write_object_contents NAME(aout,sunos4_write_object_contents)
+#define MY_bfd_debug_info_accumulate   \
+                       (void (*) PARAMS ((bfd *, struct sec *))) bfd_void
+#define MY_core_file_p                 sunos4_core_file_p
+#define MY_write_object_contents       NAME(aout,sunos4_write_object_contents)
 #define MY_backend_data                        &sunos4_aout_backend
 
 #define TARGET_IS_BIG_ENDIAN_P
This page took 0.025696 seconds and 4 git commands to generate.