NS32K changes from Ian Dall.
authorKen Raeburn <raeburn@cygnus>
Thu, 14 Jul 1994 21:35:54 +0000 (21:35 +0000)
committerKen Raeburn <raeburn@cygnus>
Thu, 14 Jul 1994 21:35:54 +0000 (21:35 +0000)
Note: Some of the ns32k-specific files do require gcc to compile at present.
This will be fixed.

bfd/ChangeLog
bfd/aout-ns32k.h [new file with mode: 0644]
bfd/bfd-in2.h
bfd/config.bfd
bfd/configure.host
bfd/hosts/pc532mach.h [new file with mode: 0644]
bfd/netbsd532.c [new file with mode: 0644]
bfd/pc532-mach.c [new file with mode: 0644]
bfd/reloc.c

index a768ee2399eb459e19009a6e74f601f821444bf9..7471fe6bd6c8c29404efb08a63410ec7f46b2807 100644 (file)
@@ -1,3 +1,99 @@
+Thu Jul 14 15:12:24 1994  Ken Raeburn  (raeburn@cujo.cygnus.com)
+
+       * reloc.c (enum bfd_reloc_code_real, bfd_type, struct
+       reloc_howto_struct, reloc_howto_type, HOWTO, HOWTO2): Copied
+       changes over from bfd-in2.h so they get generated properly next
+       time someone runs "make headers".
+       * bfd-in2.h: Rebuilt.
+
+       * targets.c (netbsd532_vec, pc532mach_vec): Declare const.
+       (m88kmach3_vec): Restore deleted declaration.
+
+       * configure.in: Alphabetize target vector names.
+
+       * config/pc532mach.mh: New file.
+       (HDEPFILES, HDEFINES): Define here.
+       * config/pc532-mach.mt (HDEPFILES, HDEFINES): Deleted.
+       * config/ns32k-netbsd.mt (HDEPFILES, HDEFINES): Deleted.
+
+       Sun Jul 10 00:04:20 1994  Ian Dall  (dall@hfrd.dsto.gov.au)
+
+       * pc532-mach.c: New File. pc532-mach a.out format.
+
+       * netbsd532.c: New file. pc532-netbsd532 a.out format.
+
+       * hosts/pc532mach.h: New file. pc532-mach host support.
+
+       * cpu-ns32k.c: New file. ns32k support cpu specific code rather
+       than format specific code.
+
+       * config/pc532-mach.mt: New file. Support for pc532-mach target.
+
+       * config/ns32k-netbsd.mt: New file. Support for netbsd532 target.
+
+       * aout-ns32k.c, aout-ns32k.h: New files supporting aout format for
+       ns32k series. 
+
+       * targets.c: Add netbsd532_vec and pc532machaout_vec into
+       bfd_target_vector array. Move netbsd386_vec to alphabetic order
+       location.
+
+       * reloc.c (_bfd_final_link_relocate) Add support for
+       special_function1 in howto.
+
+       * libaout.h: add M_NS32032, M_NS32532, M_532_NETBSD entries in
+       machine_type enum.
+
+       * configure.in: add pc532mach_vec and netbsd532_vec entries.
+
+       * config.bfd: add pc532mach host entries. Use for both
+       ns32k-pc532-mach and ns32k-pc532-netbsd.
+
+       * config.bfd: it doesn't work to use i386-mach3 for ns32k*-*-mach.
+       add ns32k-pc532-mach* and ns32k-*-netbsd* entries.
+
+       * bfd-in2.h: Add ns32k specific relocations to bfd_reloc_code_real
+       enum.
+
+       * bfd-in2.h: Add special_function1 to struct howto. Change HOWTO
+       and NEWHOWTO macros to make special_function1 NULL. Neww HOWTO2
+       macro.
+
+       * bfd-in2.h: Split definition of struct reloc_howto_struct
+       and corresponding typedef into two statements.
+
+       * bfd-in2.h: Add entry bfd_arch_ns32k to bfd_architecture enum.
+
+       * archures.c: Add bfd_ns32k_arch prototype, and entry in
+       archures_init_table. 
+
+       * aoutx.h (aout_link_reloc_link_order): Allow for target dependent
+       MY_put_reloc macro. Allow for target dependent special_function1
+       to apply the relocation. 
+
+       * aoutx.h (aout_link_input_section_std): Allow for target
+       dependent determination of reloc howto. Allow for target dependent
+       special_function1 to apply the relocation.
+
+       * aoutx.h (get_reloc_upper_bound): Detect bss and return 0.
+
+       * aoutx.h (slurp_reloc_table): Detect bss and succesfully read
+       zero reloc entries.
+
+       * aoutx.h (machine_type): Add bfd_arch_ns32k case.
+
+       * aoutx.h: Stat to determine executable status if STAT_FOR_EXEC
+       is defined (not just MACH). Use fstat instead of stat and check
+       for fstat error.
+
+       * aoutx.h: Allow target dependent swap_std_reloc_{in,out}.
+
+       * aoutx.h: Allow CTORS reloc info to be in target dependent reloc
+       table.
+
+       * aout-target.h: Apply SWAP_MAGIC (if defined) after
+       swap_exec_header_in, otherwise we have magic in the wrong order.
+
 Thu Jul 14 11:47:27 1994  Stan Shebs  (shebs@andros.cygnus.com)
 
        * coff-sparc.c (sparccoff_vec): Have leading underscores.
diff --git a/bfd/aout-ns32k.h b/bfd/aout-ns32k.h
new file mode 100644 (file)
index 0000000..7ab15de
--- /dev/null
@@ -0,0 +1,17 @@
+/* Written by Ian Dall
+ *            5-Jun-94
+ */
+#define MYNS(OP) CAT(ns32kaout_,OP)
+CONST struct reloc_howto_struct *
+MYNS(bfd_reloc_type_lookup)
+  PARAMS((bfd *abfd AND
+         bfd_reloc_code_real_type code));
+
+boolean
+MYNS(write_object_contents)
+  PARAMS((bfd *abfd));
+
+/* Avoid multiple definitions from aoutx if supporting standard a.out format(s)
+ * as well as this one
+ */
+#define NAME(x,y) CAT3(ns32kaout, _32_, y)
index 62ee6dc51e02430315af3c2c276f952bcafdf425..ab889a587eb15c8897d1b47922ef4a6c126393e0 100644 (file)
@@ -748,7 +748,7 @@ typedef struct sec
            multiple times, the value of a symbol is the amount of
            space it requires, and the largest symbol value is the one
            used).  Most targets have exactly one of these (which we
-           translate to bfd_com_section), but ECOFF has two. */
+           translate to bfd_com_section_ptr), but ECOFF has two. */
 #define SEC_IS_COMMON 0x8000
 
          /* The section contains only debugging information.  For
@@ -883,28 +883,36 @@ typedef struct sec
    struct bfd_link_order *link_order_tail;
 } asection ;
 
-
      /* These sections are global, and are managed by BFD.  The application
        and target back end are not permitted to change the values in
-       these sections.  */
+       these sections.  New code should use the section_ptr macros rather
+       than referring directly to the const sections.  The const sections
+       may eventually vanish.  */
 #define BFD_ABS_SECTION_NAME "*ABS*"
 #define BFD_UND_SECTION_NAME "*UND*"
 #define BFD_COM_SECTION_NAME "*COM*"
 #define BFD_IND_SECTION_NAME "*IND*"
 
      /* the absolute section */
-extern asection bfd_abs_section;
+extern const asection bfd_abs_section;
+#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
+#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
      /* Pointer to the undefined section */
-extern asection bfd_und_section;
+extern const asection bfd_und_section;
+#define bfd_und_section_ptr ((asection *) &bfd_und_section)
+#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
      /* Pointer to the common section */
-extern asection bfd_com_section;
+extern const asection bfd_com_section;
+#define bfd_com_section_ptr ((asection *) &bfd_com_section)
      /* Pointer to the indirect section */
-extern asection bfd_ind_section;
-
-extern struct symbol_cache_entry *bfd_abs_symbol;
-extern struct symbol_cache_entry *bfd_com_symbol;
-extern struct symbol_cache_entry *bfd_und_symbol;
-extern struct symbol_cache_entry *bfd_ind_symbol;
+extern const asection bfd_ind_section;
+#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
+#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
+
+extern const struct symbol_cache_entry * const bfd_abs_symbol;
+extern const struct symbol_cache_entry * const bfd_com_symbol;
+extern const struct symbol_cache_entry * const bfd_und_symbol;
+extern const struct symbol_cache_entry * const bfd_ind_symbol;
 #define bfd_get_section_size_before_reloc(section) \
      (section->reloc_done ? (abort(),1): (section)->_raw_size)
 #define bfd_get_section_size_after_reloc(section) \
@@ -999,6 +1007,7 @@ enum bfd_architecture
   bfd_arch_h8500,      /* Hitachi H8/500 */
   bfd_arch_sh,         /* Hitachi SH */
   bfd_arch_alpha,      /* Dec Alpha */
+  bfd_arch_ns32k,      /* National Semiconductors ns32000 */
   bfd_arch_last
   };
 
@@ -1133,7 +1142,9 @@ enum complain_overflow
   complain_overflow_unsigned
 };
 
-typedef struct reloc_howto_struct
+typedef unsigned char bfd_byte;
+
+struct reloc_howto_struct
 {
         /*  The type field has mainly a documetary use - the back end can
            do what it wants with it, though normally the back end's
@@ -1183,6 +1194,17 @@ typedef struct reloc_howto_struct
                                             bfd *output_bfd,
                                             char **error_message));
 
+
+        /* If this field is non null, then the supplied function is
+          called rather than the normal function. This is similar
+          to special_function (previous), but takes different arguments,
+          and is used for the new linking code. */
+  bfd_reloc_status_type (*special_function1)
+                           PARAMS((const reloc_howto_type *howto,
+                                   bfd *input_bfd,
+                                   bfd_vma relocation,
+                                   bfd_byte *location));
+
         /* The textual name of the relocation type. */
   char *name;
 
@@ -1213,9 +1235,12 @@ typedef struct reloc_howto_struct
           empty (e.g., m88k bcs); this flag signals the fact.*/
   boolean pcrel_offset;
 
-} reloc_howto_type;
+};
+typedef struct reloc_howto_struct reloc_howto_type;
 #define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
-  {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
+  {(unsigned)C,R,S,B, P, BI, O,SF, 0,NAME,INPLACE,MASKSRC,MASKDST,PC}
+#define HOWTO2(C, R,S,B, P, BI, O, SF, SF1,NAME, INPLACE, MASKSRC, MASKDST, PC) \
+  {(unsigned)C,R,S,B, P, BI, O,SF, SF1,NAME,INPLACE,MASKSRC,MASKDST,PC}
 #define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
 
 #define HOWTO_PREPARE(relocation, symbol)      \
@@ -1232,8 +1257,6 @@ typedef struct reloc_howto_struct
 int 
 bfd_get_reloc_size  PARAMS ((const reloc_howto_type *));
 
-typedef unsigned char bfd_byte;
-
 typedef struct relent_chain {
   arelent relent;
   struct   relent_chain *next;
@@ -1418,6 +1441,20 @@ typedef enum bfd_reloc_code_real
   BFD_RELOC_386_GOTOFF,
   BFD_RELOC_386_GOTPC,
 
+   /* ns32k relocations */
+  BFD_RELOC_NS32K_IMM_8,
+  BFD_RELOC_NS32K_IMM_16,
+  BFD_RELOC_NS32K_IMM_32,
+  BFD_RELOC_NS32K_IMM_8_PCREL,
+  BFD_RELOC_NS32K_IMM_16_PCREL,
+  BFD_RELOC_NS32K_IMM_32_PCREL,
+  BFD_RELOC_NS32K_DISP_8,
+  BFD_RELOC_NS32K_DISP_16,
+  BFD_RELOC_NS32K_DISP_32,
+  BFD_RELOC_NS32K_DISP_8_PCREL,
+  BFD_RELOC_NS32K_DISP_16_PCREL,
+  BFD_RELOC_NS32K_DISP_32_PCREL,
+
    /* PowerPC/POWER (RS/6000) relocs.  */
    /* 26 bit relative branch.  Low two bits must be zero.  High 24
      bits installed in bits 6 through 29 of instruction.  */
index 2e634306fcb25c6b409dd300f30920e5530cdd58..d68fc005772f2d84aad9b8324febb0dfb594fba8 100755 (executable)
@@ -4,10 +4,19 @@
 # Convert a canonical host type into a BFD host type.
 # Call with canonical name as the argument.
 # Echos the result.
+# If second argument is _, echoes whether underscores are stripped.
 
 canon="$1"
 cpu=`echo $canon | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
 
+# The binutils c++filt program wants to know whether underscores are
+# stripped or not.  It uses this information to choose a default.
+# This information is duplicated in the symbol_leading_char field of
+# the BFD target vector, but c++filt does not deal with object files
+# and is not linked against libbfd.a.  It is not terribly important
+# that c++filt get this right; it is just convenient.
+strip_underscore=no
+
 # WHEN ADDING ENTRIES TO THIS MATRIX:
 #  Make sure that the left side always has two dashes.  Otherwise you
 #  can get spurious matches.  Even for unambiguous cases, do this as a
@@ -16,14 +25,14 @@ cpu=`echo $canon | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
 case "${canon}" in
   alpha-*-netware*)    bfd_name=alpha-nlm ;;
   alpha-*-*)           bfd_name=alphaosf ;;
-  a29k-*-ebmon*)       bfd_name=a29k-coff ;;
-  a29k-*-udi*)         bfd_name=a29k-coff ;;
-  a29k-*-aout*)                bfd_name=a29k-aout ;;
-  a29k-*-coff*)                bfd_name=a29k-coff ;;
-  a29k-*-sym1*)                bfd_name=a29k-coff ;;
-  h8300*-*-*)          bfd_name=h8300-coff ;;
-  h8500-*-*)           bfd_name=h8500-coff ;;
-  sh-*-*)              bfd_name=sh-coff ;;
+  a29k-*-ebmon*)       bfd_name=a29k-coff strip_underscore=yes ;;
+  a29k-*-udi*)         bfd_name=a29k-coff strip_underscore=yes ;;
+  a29k-*-aout*)                bfd_name=a29k-aout strip_underscore=yes ;;
+  a29k-*-coff*)                bfd_name=a29k-coff strip_underscore=yes ;;
+  a29k-*-sym1*)                bfd_name=a29k-coff strip_underscore=yes ;;
+  h8300*-*-*)          bfd_name=h8300-coff strip_underscore=yes ;;
+  h8500-*-*)           bfd_name=h8500-coff strip_underscore=yes ;;
+  sh-*-*)              bfd_name=sh-coff strip_underscore=yes ;;
   hppa*-*-*elf*)       bfd_name=hppa-elf ;;
   hppa*-*-bsd*)                bfd_name=hppabsd ;;
   hppa*-*-hpux*)       bfd_name=hppahpux ;;
@@ -35,95 +44,99 @@ case "${canon}" in
   i[34]86-*-sysv*)     bfd_name=i386-coff ;;
   i[34]86-*-isc*)      bfd_name=i386-coff ;;
   i[34]86-*-sco*)      bfd_name=i386-coff ;;
-  i[34]86-sequent-bsd*)        bfd_name=i386-dynix ;;
-  i[34]86-*-bsd*)      bfd_name=i386-bsd ;;
+  i[34]86-sequent-bsd*)        bfd_name=i386-dynix strip_underscore=yes ;;
+  i[34]86-*-bsd*)      bfd_name=i386-bsd strip_underscore=yes ;;
   i[34]86-*-coff)      bfd_name=i386-coff ;;
   i[34]86-*-aix*)      bfd_name=i386-coff ;;
   i[34]86-*-elf)       bfd_name=i386-elf ;;
-  i[34]86-*-netbsd*)   bfd_name=i386-netbsd ;;
+  i[34]86-*-netbsd*)   bfd_name=i386-netbsd strip_underscore=yes ;;
   i[34]86-*-netware*)  bfd_name=i386-nlm ;;
-  i[34]86-*-linux*)    bfd_name=i386-linux ;;
+  i[34]86-*-linux*)    bfd_name=i386-linux strip_underscore=yes ;;
   i[34]86-*-lynxos*)   bfd_name=i386-lynx ;;
-  i[34]86-*-gnu*)      bfd_name=i386-mach3 ;;
-  i[34]86-*-mach*)     bfd_name=i386-mach3 ;;
-  i[34]86-*-osf1mk*)   bfd_name=i386-mach3 ;;
-  i[34]86-*-os9k)      bfd_name=i386-os9k;;
+  i[34]86-*-gnu*)      bfd_name=i386-mach3 strip_underscore=yes ;;
+  i[34]86-*-mach*)     bfd_name=i386-mach3 strip_underscore=yes ;;
+  i[34]86-*-osf1mk*)   bfd_name=i386-mach3 strip_underscore=yes ;;
+  i[34]86-*-os9k)      bfd_name=i386-os9k ;;
   i[34]86-none-*)      bfd_name=i386-coff ;;
-  i960-*-vxworks4*)    bfd_name=i960-bout ;;
-  i960-*-vxworks5.0)   bfd_name=i960-bout ;;
-  i960-*-vxworks5.*)   bfd_name=i960-coff ;;
-  i960-*-vxworks*)     bfd_name=i960-bout ;;
-  i960-*-aout*)                bfd_name=i960-bout ;;
-  i960-*-bout*)                bfd_name=i960-bout ;;
-  i960-*-coff*)                bfd_name=i960-coff ;;
-  i960-*-nindy*)       bfd_name=i960-bout ;;
+  i960-*-vxworks4*)    bfd_name=i960-bout strip_underscore=yes ;;
+  i960-*-vxworks5.0)   bfd_name=i960-bout strip_underscore=yes ;;
+  i960-*-vxworks5.*)   bfd_name=i960-coff strip_underscore=yes ;;
+  i960-*-vxworks*)     bfd_name=i960-bout strip_underscore=yes ;;
+  i960-*-aout*)                bfd_name=i960-bout strip_underscore=yes ;;
+  i960-*-bout*)                bfd_name=i960-bout strip_underscore=yes ;;
+  i960-*-coff*)                bfd_name=i960-coff strip_underscore=yes ;;
+  i960-*-nindy*)       bfd_name=i960-bout strip_underscore=yes ;;
   m68*-apollo-*)       bfd_name=apollo ;;
   m68*-bull-sysv*)     bfd_name=u68k-coff ;;
-  m68*-hp-bsd*)                bfd_name=hp300bsd ;;
-  m68*-*-aout*)                bfd_name=m68k-0aout ;;
+  m68*-hp-bsd*)                bfd_name=hp300bsd strip_underscore=yes ;;
+  m68*-*-aout*)                bfd_name=m68k-0aout strip_underscore=yes ;;
   m68*-*-coff*)                bfd_name=m68k-coff ;;
-  m68*-*-hpux*)                bfd_name=hp300hpux ;;
+  m68*-*-hpux*)                bfd_name=hp300hpux strip_underscore=yes ;;
   m68*-*-lynxos*)      bfd_name=m68k-lynx ;;
-  m68*-*-os68k*)       bfd_name=m68k-aout ;;
-  m68*-*-sunos*)       bfd_name=m68k-aout ;;
+  m68*-*-os68k*)       bfd_name=m68k-aout strip_underscore=yes ;;
+  m68*-*-sunos*)       bfd_name=m68k-aout strip_underscore=yes ;;
   m68*-*-sysv4*)       bfd_name=m68k-elf ;;
   m68*-*-sysv*)                bfd_name=m68k-coff ;;
-  m68*-*-vxworks*)     bfd_name=m68k-aout ;;
-  m68*-ericsson-*)     bfd_name=m68k-ose ;;
-  m68*-netx-*)         bfd_name=m68k-aout ;;
+  m68*-*-vxworks*)     bfd_name=m68k-aout strip_underscore=yes ;;
+  m68*-ericsson-*)     bfd_name=m68k-ose strip_underscore=yes ;;
+  m68*-netx-*)         bfd_name=m68k-aout strip_underscore=yes ;;
 
-  m88*-*-sysv4*)       bfd_name=m88k-elf ;;
   # DGUX used to use COFF, but now (Jan 94) I believe it uses ELF by default.
   m88*-*-dgux*)                bfd_name=m88k-elf ;;
-  m88*-*-*)            bfd_name=m88k-coff ;;
+  m88*-*-mach3*)       bfd_name=m88k-mach3 ;;
+  m88*-*-sysv4*)       bfd_name=m88k-elf ;;
+  m88*-*-*)            bfd_name=m88k-coff strip_underscore=yes ;;
 
   mips*-big-*)         bfd_name=bigmips ;;
-  mips*-dec-bsd*)       bfd_name=mipsdecbsd ;;
+  mips*-dec-bsd*)       bfd_name=mipsdecbsd strip_underscore=yes ;;
+  mips*-dec-mach3*)     bfd_name=mips-mach3 ;;
   mips*-dec-*)         bfd_name=decstation ;;
   mips*el-*-ecoff*)    bfd_name=decstation ;;
   mips*-*-ecoff*)      bfd_name=bigmips ;;
   mips*-*-irix5*)      bfd_name=mipsbelf ;;
   mips*-sgi-*)         bfd_name=bigmips ;;
+  mips*-*-mach3*)      bfd_name=mips-mach3 ;;
   mips*-*-sysv4*)      bfd_name=mipsbelf ;;
   mips*-*-sysv*)       bfd_name=riscos ;;
   mips*-*-riscos*)     bfd_name=riscos ;;
   mips*-*-bsd*)                bfd_name=bigmips ;; # Sony News
   mips*el-*-elf*)      bfd_name=mipslelf ;;
   mips*-*-elf*)                bfd_name=mipsbelf ;;
-  # Apparently this is similar enough to 386 mach to use the same target.
-  ns32*-*-mach*)       bfd_name=i386-mach3 ;;
+  ns32k-pc532-mach*)   bfd_name=pc532-mach strip_underscore=yes;;
+  ns32k-*-netbsd*)     bfd_name=ns32k-netbsd strip_underscore=yes;;
   powerpc-*-aix*)      bfd_name=rs6000 ;;
+  powerpc-*-elf*)      bfd_name=ppc-elf ;;
   powerpc-*-sysv4*)    bfd_name=ppc-elf ;;
   powerpc-*-netware*)  bfd_name=ppc-nlm ;;
   rs6000-*-*)          bfd_name=rs6000 ;;
   sparc-*-lynxos*)     bfd_name=sparc-lynx ;;
   sparc-*-solaris2*)   bfd_name=sparc-elf ;;
   sparc-*-sysv4*)      bfd_name=sparc-elf ;;
-  sparc64-*-aout*)     bfd_name=sparc-aout ;;
+  sparc64-*-aout*)     bfd_name=sparc-aout strip_underscore=yes ;;
   sparc64-*-elf*)      bfd_name=sparc64-elf ;;
   sparc-*-netware*)    bfd_name=sparc-nlm ;;
   sparc*-*-coff*)      bfd_name=sparc-coff ;;
-  sparc*-*-*)          bfd_name=sparc-aout ;;
-  tahoe-*-*)           bfd_name=tahoe ;;
+  sparc*-*-*)          bfd_name=sparc-aout strip_underscore=yes ;;
+  tahoe-*-*)           bfd_name=tahoe strip_underscore=yes ;;
   vax-*-vms*)          bfd_name=vax-vms ;;
-  vax-*-*)             bfd_name=vax ;;
+  vax-*-*)             bfd_name=vax strip_underscore=yes ;;
   we32k-*-*)           bfd_name=we32k ;;
-  z8k*-*-*)            bfd_name=z8k-coff ;;
+  z8k*-*-*)            bfd_name=z8k-coff strip_underscore=yes ;;
 
-  *-*-aout*)           bfd_name=${cpu}-aout ;;
-  *-*-bsd*)            bfd_name=${cpu}-aout ;;
+  *-*-aout*)           bfd_name=${cpu}-aout strip_underscore=yes ;;
+  *-*-bsd*)            bfd_name=${cpu}-aout strip_underscore=yes ;;
   *-*-netware*)                bfd_name=${cpu}-nlm ;;
   *-*-sysv4*)          bfd_name=${cpu}-elf ;;
   *-*-solaris2*)       bfd_name=${cpu}-elf ;;
-  *-*-vsta*)           bfd_name=${cpu}-aout ;;
+  *-*-vsta*)           bfd_name=${cpu}-aout strip_underscore=yes ;;
   *-*-go32*)           bfd_name=${cpu}-coff ;;
   *-*-sysv*)           bfd_name=${cpu}-coff ;;
 
-  *-*-aout64*)         bfd_name=${cpu}-aout64 ;;
+  *-*-aout64*)         bfd_name=${cpu}-aout64 strip_underscore=yes ;;
   *-*-elf64*)          bfd_name=${cpu}-elf64 ;;
 
-  *-adobe-*)           bfd_name=adobe ;;
-  *-sony-*)            bfd_name=news ;;
+  *-adobe-*)           bfd_name=adobe strip_underscore=yes ;;
+  *-sony-*)            bfd_name=news strip_underscore=yes ;;
   *-intel-*)           bfd_name=${cpu}-coff ;;
   *-stratus-*)         bfd_name=${cpu}-elf ;;
   *-cbm-*)             bfd_name=${cpu}-elf ;;
@@ -134,4 +147,8 @@ case "${canon}" in
   *)                   bfd_name=$canon ;;
 esac
 
-echo $bfd_name
+if [ "x$2" = "x_" ]; then
+  echo $strip_underscore
+else
+  echo $bfd_name
+fi
index ce583473503e7918f7a570a538e64fa708176432..4ff421ef3ae4cd19f8da689dd7f4ab19f6139d97 100644 (file)
@@ -37,7 +37,7 @@ i[34]86-*-sysv4*)     my_host=i386v4 ;;
 i[34]86-*-sysv*)       my_host=i386v ;;
 i[34]86-*-solaris*)    my_host=i386v ;;
 i[34]86-*-sco*)                my_host=i386sco ;;
-i[34]86-*-mach*)       my_host=i386mach3 ;;
+i[34]86-*-mach3*)      my_host=i386mach3 ;;
 i[34]86-*-osf1mk*)     my_host=i386osf1mk ;;
 i[34]86-*-msdos*)      my_host=dose ;;
 i[34]86-*-linux*)      my_host=i386linux ;;
@@ -48,10 +48,13 @@ i[34]86-*-aix*)             my_host=i386aix ;;
 i860-*-*)              my_host=stratus ;;
 
 mips-dec-bsd*)          my_host=mipsbsd ;;
+mips-dec-mach3*)        my_host=mipsmach3 ;;
 mips-dec-*)            my_host=decstation ;;
 mips-sgi-irix3*)       my_host=irix3 ;;
 mips-sgi-irix4*)       my_host=irix4 ;;
 mips-sgi-irix5*)       my_host=irix5 ;;
+mips-*-mach3*)         my_host=mipsmach3 ;;
+mips-*-sysv4*)         my_host=sysv4 ;;
 mips-*-sysv*)          my_host=riscos ;;
 mips-*-riscos*)                my_host=riscos ;;
 mips-sony-bsd*)                my_host=news-mips ;;
@@ -73,9 +76,10 @@ m88*-*-sysv4*)               my_host=delta88v4 ;;
 m88*-motorola-sysv*)   my_host=delta88 ;;
 m88*-harris-*)         my_host=harris ;;
 m88*-*-dgux*)          my_host=dgux ;;
+m88*-*-mach3*)         my_host=m88kmach3 ;;
 
-# Apparently the same config file as for 386 works.
-ns32k-*-mach*)         my_host=i386mach3 ;;
+ns32k-pc532-mach)      my_host=pc532mach ;;
+ns32k-pc532-netbsd*)    my_host=pc532mach ;;
 
 romp-*-*)              my_host=rtbsd ;;
 
diff --git a/bfd/hosts/pc532mach.h b/bfd/hosts/pc532mach.h
new file mode 100644 (file)
index 0000000..327f877
--- /dev/null
@@ -0,0 +1,34 @@
+#include "hosts/std-host.h"
+
+#include <machine/vmparam.h>
+#include <sys/param.h>
+#undef BYTE_SIZE               /* Was in bits. We define it later in bytes */
+
+/* This is an ugly way to hack around the incorrect
+ * definition of UPAGES in ns532/machparam.h.
+ *
+ * The definition should specify the size reserved
+ * for "struct user" in core files in PAGES,
+ * but instead it gives it in 512-byte core-clicks
+ * for ns532, i386 and i860. UPAGES is used only in trad-core.c.
+ */
+#if UPAGES == 16
+#undef  UPAGES
+#define UPAGES 2
+#endif
+
+#if UPAGES != 2
+#error UPAGES is neither 2 nor 16
+#endif
+
+#define        HAVE_STRERROR
+
+#define        HOST_PAGE_SIZE          1
+#define        HOST_SEGMENT_SIZE       NBPG
+#define        HOST_MACHINE_ARCH       bfd_arch_ns32k
+#define        HOST_TEXT_START_ADDR    USRTEXT
+#define        HOST_STACK_END_ADDR     USRSTACK
+
+/* Not declared in errno.h on Mach3.  */
+
+extern int errno;
diff --git a/bfd/netbsd532.c b/bfd/netbsd532.c
new file mode 100644 (file)
index 0000000..32e94a9
--- /dev/null
@@ -0,0 +1,189 @@
+/* BFD back-end for NetBSD/532 a.out-ish binaries.
+   Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+/*
+ * Created by Ian Dall
+ *            5-Jun-94
+ *
+ * Largely a copy of netbsd386.c plus some code from aout-pc532-mach.c
+ */
+
+#define        BYTES_IN_WORD   4
+#define        ARCH    32
+
+/* ZMAGIC files never include the header in the text.  */
+#define        N_HEADER_IN_TEXT(x)     1
+
+#define        PAGE_SIZE       0x1000
+
+/* ZMAGIC files start at address 0.  This does not apply to QMAGIC.  */
+#define TEXT_START_ADDR PAGE_SIZE
+#define N_SHARED_LIB(x) 0
+
+/* Use a_entry of 0 to distinguish object files from OMAGIC executables */
+#define N_TXTADDR(x) \
+    ((N_MAGIC(x) == OMAGIC) && \
+      ((x).a_entry < TEXT_START_ADDR) ? 0 :    /* object file or NMAGIC */\
+     N_SHARED_LIB(x) ? 0 :     \
+     N_HEADER_IN_TEXT(x)  ?    \
+           TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\
+           TEXT_START_ADDR                     /* a page of padding */\
+    )
+
+#define        SEGMENT_SIZE    PAGE_SIZE
+
+#define        DEFAULT_ARCH    bfd_arch_ns32k
+
+#define MY(OP) CAT(netbsd532_,OP)
+/* This needs to start with a.out so GDB knows it is an a.out variant.  */
+#define TARGETNAME "a.out-netbsd-532"
+#define MACHTYPE_OK(mtype) ((mtype) == M_532_NETBSD)
+
+#define N_MAGIC(ex) \
+    ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info))&0xffff) : ((ex).a_info))
+#define N_MACHTYPE(ex) \
+    ( (((ex).a_info)&0xffff0000) ? (((((ex).a_info))>>16)&0x03ff) : 0 )
+#define N_FLAGS(ex) \
+    ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info)>>26)&0x3f) : 0 )
+#define N_SET_INFO(ex, mag,mid,flag) \
+    ( (ex).a_info = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \
+    (((mag)&0xffff)) ) )
+#define N_SET_MAGIC(exec,magic) \
+  ((exec).a_info = (((exec).a_info & ~0xffff) | ((magic) & 0xffff)))
+#define N_SET_MACHTYPE(exec,machtype) \
+  ((exec).a_info = \
+   (((exec).a_info & ~(0x3ff<<16)) | (((machtype)&0xff) << 16)))
+#define N_SET_FLAGS(exec, flags) \
+  ((exec).a_info = \
+      (((exec).a_info & ~(0x3f<<26)) | (((flags)&0x3f) << 26)))
+
+#define N_MAG(MAG) ((MAG) == o_magic? OMAGIC: ((MAG) == z_magic? ZMAGIC: ((MAG) == n_magic? NMAGIC: 0)))
+
+#define WRITE_HEADERS(abfd, execp)                                           \
+      {                                                                              \
+       bfd_size_type text_size; /* dummy vars */                             \
+        int mag;                                                             \
+       file_ptr text_end;                                                    \
+       if (adata(abfd).magic == undecided_magic)                             \
+         NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);     \
+        mag = adata(abfd).magic;                                             \
+       N_SET_INFO(*execp, N_MAG(mag), M_532_NETBSD, aout_backend_info (abfd)->exec_hdr_flags);                       \
+                                                                             \
+       execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE;        \
+       execp->a_entry = bfd_get_start_address (abfd);                        \
+                                                                             \
+       execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *                \
+                          obj_reloc_entry_size (abfd));                      \
+       execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *                \
+                          obj_reloc_entry_size (abfd));                      \
+       NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes);           \
+                                                                             \
+       if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false;       \
+       if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)           \
+           != EXEC_BYTES_SIZE)                                               \
+         return false;                                                       \
+       /* Now write out reloc info, followed by syms and strings */          \
+                                                                             \
+       if (bfd_get_outsymbols (abfd) != (asymbol **) NULL                    \
+           && bfd_get_symcount (abfd) != 0)                                  \
+           {                                                                 \
+             if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET)     \
+                 != 0)                                                       \
+               return false;                                                 \
+                                                                             \
+             if (! NAME(aout,write_syms)(abfd)) return false;                \
+                                                                             \
+             if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET)    \
+                 != 0)                                                       \
+               return false;                                                 \
+                                                                             \
+             if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd)))   \
+               return false;                                                 \
+             if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET)    \
+                 != 0)                                                       \
+               return false;                                                 \
+                                                                             \
+             if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd)))    \
+               return false;                                                 \
+           }                                                                 \
+      }                                                                              
+
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "aout-ns32k.h"
+#include "libbfd.h"
+#include "libaout.h"
+
+
+/* On NetBSD, the magic number is always in ntohl's "network" (big-endian)
+   format.  */
+#define SWAP_MAGIC(ext) bfd_getb32 (ext)
+
+#include "aout/aout64.h"
+
+/* Forward declaration. Defined in aout-target.h */
+static boolean MY(set_sizes)();
+
+static CONST struct aout_backend_data MY(backend_data) = {
+  0,                           /* zmagic contiguous */
+  1,                           /* text incl header */
+  0,
+  0,                           /* text vma? */
+  MY(set_sizes),
+  0,                           /* exec header is counted */
+};
+
+#define MY_backend_data &MY(backend_data)
+
+
+/* We can`t use the MYNS macro here for cpp reasons too subtle
+ * for me -- IWD
+ */
+#define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup
+
+/* libaout doesn't use NAME for these ... */
+#define MY_get_section_contents aout_32_get_section_contents
+
+static boolean
+MY(write_object_contents) (abfd)
+     bfd *abfd;
+{
+  struct external_exec exec_bytes;
+  struct internal_exec *execp = exec_hdr (abfd);
+
+#if CHOOSE_RELOC_SIZE
+  CHOOSE_RELOC_SIZE(abfd);
+#else
+  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
+#endif
+
+  BFD_ASSERT(bfd_get_arch(abfd) == bfd_arch_ns32k);
+  BFD_ASSERT(bfd_get_mach(abfd) == 32532);
+  N_SET_MACHTYPE (*execp, M_532_NETBSD);
+
+  N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
+
+  WRITE_HEADERS(abfd, execp);
+
+  return true;
+}
+
+#define MY_write_object_contents MY(write_object_contents)
+
+#include "aout-target.h"
diff --git a/bfd/pc532-mach.c b/bfd/pc532-mach.c
new file mode 100644 (file)
index 0000000..ccd858f
--- /dev/null
@@ -0,0 +1,101 @@
+/* Written by Ian Dall
+ *            19-Apr-94
+ *
+ * Formerly part of aout-pc532-mach.c. Split out to allow more
+ * flexibility with multiple formats.
+ *
+ */
+/* This architecture has N_TXTOFF and N_TXTADDR defined as if
+ * N_HEADER_IN_TEXT, but the a_text entry (text size) does not include the
+ * space for the header. So we have N_HEADER_IN_TEXT defined to
+ * 1 and specially define our own N_TXTSIZE
+ */
+
+#define N_HEADER_IN_TEXT(x) 1
+#define N_TXTSIZE(x) ((x).a_text)
+
+
+#define TEXT_START_ADDR 0x10000       /* from old ld */
+#define PAGE_SIZE 0x1000       /* from old ld,  032 & 532 are really 512/4k */
+
+/* Use a_entry of 0 to distinguish object files from OMAGIC executables */
+#define N_TXTADDR(x) \
+    (N_MAGIC(x) == OMAGIC ? \
+        ((x).a_entry < TEXT_START_ADDR? 0: TEXT_START_ADDR): \
+      (N_MAGIC(x) == NMAGIC? TEXT_START_ADDR: \
+        TEXT_START_ADDR + EXEC_BYTES_SIZE))
+
+#define ARCH 32
+
+#define        SEGMENT_SIZE    PAGE_SIZE
+
+#define N_SHARED_LIB(x) 0
+#define SEGMENT_SIZE PAGE_SIZE
+#define DEFAULT_ARCH bfd_arch_ns32k
+
+#define MY(OP) CAT(pc532mach_,OP)
+
+#define TARGETNAME "a.out-pc532-mach"
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "aout-ns32k.h"
+#include "libaout.h"
+#include "libbfd.h"
+#include "aout/aout64.h"
+
+/* We can`t use the MYNS macro here for cpp reasons too subtle
+ * for me -- IWD
+ */
+#define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup
+
+/* libaout doesn't use NAME for these ... */
+#define MY_get_section_contents aout_32_get_section_contents
+
+/* Forward declaration. Defined in aout-target.h */
+static boolean MY(set_sizes)();
+
+static CONST struct aout_backend_data MY(backend_data) = {
+  0,                           /* zmagic contiguous */
+  1,                           /* text incl header */
+  0,
+  0,                           /* text vma? */
+  MY(set_sizes),
+  1,                           /* exec header is not counted */
+};
+
+#define MY_backend_data &MY(backend_data)
+
+static boolean
+MY(write_object_contents) (abfd)
+     bfd *abfd;
+{
+  struct external_exec exec_bytes;
+  struct internal_exec *execp = exec_hdr (abfd);
+
+#if CHOOSE_RELOC_SIZE
+  CHOOSE_RELOC_SIZE(abfd);
+#else
+  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
+#endif
+
+  BFD_ASSERT(bfd_get_arch(abfd) == bfd_arch_ns32k);
+  switch (bfd_get_mach(abfd)) {
+  case 32032:
+    N_SET_MACHTYPE (*execp, M_NS32032);
+    break;
+  case 32532:
+  default:
+    N_SET_MACHTYPE (*execp, M_NS32532);
+    break;
+  }
+  N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
+
+  WRITE_HEADERS(abfd, execp);
+
+  return true;
+}
+
+#define MY_write_object_contents MY(write_object_contents)
+
+#include "aout-target.h"
index 6275cb3491f11d9b9fee905f4aebc1bec9b53969..487be0e767f6b80064918196cd7f28819e220df0 100644 (file)
@@ -282,7 +282,9 @@ SUBSUBSECTION
 CODE_FRAGMENT
 .struct symbol_cache_entry;            {* Forward declaration *}
 .
-.typedef struct reloc_howto_struct
+.typedef unsigned char bfd_byte;
+.
+.struct reloc_howto_struct
 .{
 .       {*  The type field has mainly a documetary use - the back end can
 .           do what it wants with it, though normally the back end's
@@ -332,6 +334,17 @@ CODE_FRAGMENT
 .                                            bfd *output_bfd,
 .                                            char **error_message));
 .
+.
+.       {* If this field is non null, then the supplied function is
+.          called rather than the normal function. This is similar
+.         to special_function (previous), but takes different arguments,
+.          and is used for the new linking code. *}
+.  bfd_reloc_status_type (*special_function1)
+.                          PARAMS((const reloc_howto_type *howto,
+.                                  bfd *input_bfd,
+.                                  bfd_vma relocation,
+.                                  bfd_byte *location));
+.
 .       {* The textual name of the relocation type. *}
 .  char *name;
 .
@@ -362,7 +375,8 @@ CODE_FRAGMENT
 .          empty (e.g., m88k bcs); this flag signals the fact.*}
 .  boolean pcrel_offset;
 .
-.} reloc_howto_type;
+.};
+.typedef struct reloc_howto_struct reloc_howto_type;
 
 */
 
@@ -375,7 +389,9 @@ DESCRIPTION
 
 
 .#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
-.  {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
+.  {(unsigned)C,R,S,B, P, BI, O,SF, 0,NAME,INPLACE,MASKSRC,MASKDST,PC}
+.#define HOWTO2(C, R,S,B, P, BI, O, SF, SF1,NAME, INPLACE, MASKSRC, MASKDST, PC) \
+.  {(unsigned)C,R,S,B, P, BI, O,SF, SF1,NAME,INPLACE,MASKSRC,MASKDST,PC}
 
 DESCRIPTION
        And will be replaced with the totally magic way. But for the
@@ -437,8 +453,6 @@ DESCRIPTION
 
        How relocs are tied together in an <<asection>>:
 
-.typedef unsigned char bfd_byte;
-.
 .typedef struct relent_chain {
 .  arelent relent;
 .  struct   relent_chain *next;
@@ -500,7 +514,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
   asymbol *symbol;
 
   symbol = *(reloc_entry->sym_ptr_ptr);
-  if ((symbol->section == &bfd_abs_section)
+  if (bfd_is_abs_section (symbol->section)
       && output_bfd != (bfd *) NULL)
     {
       reloc_entry->address += input_section->output_offset;
@@ -510,7 +524,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
   /* If we are not producing relocateable output, return an error if
      the symbol is not defined.  An undefined weak symbol is
      considered to have a value of zero (SVR4 ABI, p. 4-27).  */
-  if (symbol->section == &bfd_und_section
+  if (bfd_is_und_section (symbol->section)
       && (symbol->flags & BSF_WEAK) == 0
       && output_bfd == (bfd *) NULL)
     flag = bfd_reloc_undefined;
@@ -618,7 +632,9 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
 
          /* WTF?? */
          if (abfd->xvec->flavour == bfd_target_coff_flavour
-             && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0)
+             && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0
+             && strcmp (abfd->xvec->name, "coff-Intel-little") != 0
+             && strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
            {
 #if 1
              /* For m68k-coff, the addend was being subtracted twice during
@@ -977,6 +993,13 @@ _bfd_final_link_relocate (howto, input_bfd, input_section, contents, address,
        relocation -= address;
     }
 
+  if(howto->special_function1) {
+      bfd_reloc_status_type cont;
+      cont = (*howto->special_function1)(howto, input_bfd, relocation,
+                                      contents + address);
+      if (cont != bfd_reloc_continue)
+       return cont;
+    }
   return _bfd_relocate_contents (howto, input_bfd, relocation,
                                 contents + address);
 }
@@ -1371,6 +1394,20 @@ CODE_FRAGMENT
 .  BFD_RELOC_386_GOTOFF,
 .  BFD_RELOC_386_GOTPC,
 .
+.  {* ns32k relocations *}
+.  BFD_RELOC_NS32K_IMM_8,
+.  BFD_RELOC_NS32K_IMM_16,
+.  BFD_RELOC_NS32K_IMM_32,
+.  BFD_RELOC_NS32K_IMM_8_PCREL,
+.  BFD_RELOC_NS32K_IMM_16_PCREL,
+.  BFD_RELOC_NS32K_IMM_32_PCREL,
+.  BFD_RELOC_NS32K_DISP_8,
+.  BFD_RELOC_NS32K_DISP_16,
+.  BFD_RELOC_NS32K_DISP_32,
+.  BFD_RELOC_NS32K_DISP_8_PCREL,
+.  BFD_RELOC_NS32K_DISP_16_PCREL,
+.  BFD_RELOC_NS32K_DISP_32_PCREL,
+.
 .  {* PowerPC/POWER (RS/6000) relocs.  *}
 .  {* 26 bit relative branch.  Low two bits must be zero.  High 24
 .     bits installed in bits 6 through 29 of instruction.  *}
This page took 0.04218 seconds and 4 git commands to generate.