* coffcode.h (bfd_coff_backend_data): Add new field
authorIan Lance Taylor <ian@airs.com>
Fri, 6 Oct 1995 19:19:48 +0000 (19:19 +0000)
committerIan Lance Taylor <ian@airs.com>
Fri, 6 Oct 1995 19:19:48 +0000 (19:19 +0000)
_bfd_coff_pointerize_aux_hook.
(coff_pointerize_aux_hook): Define as a function if RS6000COFF_C
or I960, and as 0 otherwise.
(bfd_coff_std_swap_table): Initialize new field.
* libcoff.h: Rebuild.
* coffgen.c (coff_pointerize_aux): Change parameters  to take
symbol pointer instead of type and class, and to take aux index.
Call _bfd_coff_pointerize_aux_hook if it is defined.
(coff_get_normalized_symtab): Always call coff_pointerize_aux.
* coff-alpha.c (alpha_ecoff_backend_data): Initialize all fields.
* coff-mips.c (mips_ecoff_backend_data): Likewise.

bfd/ChangeLog
bfd/coff-alpha.c
bfd/coff-mips.c
bfd/coffcode.h
bfd/coffgen.c
bfd/libcoff.h

index c3a8108..c87895d 100644 (file)
@@ -8,6 +8,19 @@ Fri Oct  6 12:24:47 1995  Michael Meissner  <meissner@tiktok.cygnus.com>
 
 Fri Oct  6 12:04:02 1995  Ian Lance Taylor  <ian@cygnus.com>
 
 
 Fri Oct  6 12:04:02 1995  Ian Lance Taylor  <ian@cygnus.com>
 
+       * coffcode.h (bfd_coff_backend_data): Add new field
+       _bfd_coff_pointerize_aux_hook.
+       (coff_pointerize_aux_hook): Define as a function if RS6000COFF_C
+       or I960, and as 0 otherwise.
+       (bfd_coff_std_swap_table): Initialize new field.
+       * libcoff.h: Rebuild.
+       * coffgen.c (coff_pointerize_aux): Change parameters  to take
+       symbol pointer instead of type and class, and to take aux index.
+       Call _bfd_coff_pointerize_aux_hook if it is defined.
+       (coff_get_normalized_symtab): Always call coff_pointerize_aux.
+       * coff-alpha.c (alpha_ecoff_backend_data): Initialize all fields.
+       * coff-mips.c (mips_ecoff_backend_data): Likewise.
+
        * coff-rs6000.c: Add full support for AIX archives.  Rewrite old
        read-only/host-only support.
 
        * coff-rs6000.c: Add full support for AIX archives.  Rewrite old
        read-only/host-only support.
 
index d914d4d..bc140a1 100644 (file)
@@ -1976,7 +1976,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
     alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
     alpha_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
     _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
     alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
     alpha_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
     _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
   },
   /* Supported architecture.  */
   bfd_arch_alpha,
   },
   /* Supported architecture.  */
   bfd_arch_alpha,
index e1a269f..527a0fc 100644 (file)
@@ -2442,7 +2442,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
     mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
     _bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
     _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
     mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
     _bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
     _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
   },
   /* Supported architecture.  */
   bfd_arch_mips,
   },
   /* Supported architecture.  */
   bfd_arch_mips,
index 84f1ad4..327d575 100644 (file)
@@ -649,6 +649,12 @@ dependent COFF routines:
 . boolean (*_bfd_coff_symname_in_debug) PARAMS ((
 .       bfd     *abfd,
 .       struct internal_syment *sym));
 . boolean (*_bfd_coff_symname_in_debug) PARAMS ((
 .       bfd     *abfd,
 .       struct internal_syment *sym));
+. boolean (*_bfd_coff_pointerize_aux_hook) PARAMS ((
+.       bfd *abfd,
+.       combined_entry_type *table_base,
+.       combined_entry_type *symbol,
+.       unsigned int indaux,
+.       combined_entry_type *aux));
 . void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
 .       bfd     *abfd,
 .       struct bfd_link_info *link_info,
 . void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
 .       bfd     *abfd,
 .       struct bfd_link_info *link_info,
@@ -1169,6 +1175,63 @@ symname_in_debug_hook (abfd, sym)
 
 #endif
 
 
 #endif
 
+#ifdef RS6000COFF_C
+
+/* We don't want to pointerize the csect auxent of a C_EXT or C_HIDEXT
+   symbol.  */
+
+static boolean coff_pointerize_aux_hook
+  PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
+          unsigned int, combined_entry_type *));
+
+/*ARGSUSED*/
+static boolean
+coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
+     bfd *abfd;
+     combined_entry_type *table_base;
+     combined_entry_type *symbol;
+     unsigned int indaux;
+     combined_entry_type *aux;
+{
+  int class = symbol->u.syment.n_sclass;
+
+  /* Return true if we don't want to pointerize this aux entry, which
+     is the case for the last aux entry for a C_EXT or C_HIDEXT
+     symbol.  */
+  return ((class == C_EXT || class == C_HIDEXT)
+         && indaux + 1 == symbol->u.syment.n_numaux);
+}
+
+#else
+#ifdef I960
+
+/* We don't want to pointerize bal entries.  */
+
+static boolean coff_pointerize_aux_hook
+  PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
+          unsigned int, combined_entry_type *));
+
+/*ARGSUSED*/
+static boolean
+coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
+     bfd *abfd;
+     combined_entry_type *table_base;
+     combined_entry_type *symbol;
+     unsigned int indaux;
+     combined_entry_type *aux;
+{
+  /* Return true if we don't want to pointerize this aux entry, which
+     is the case for the lastfirst aux entry for a C_LEAFPROC symbol.  */
+  return indaux == 1 && symbol->u.syment.n_sclass == C_LEAFPROC;
+}
+
+#else /* ! I960 */
+
+#define coff_pointerize_aux_hook 0
+
+#endif /* ! I960 */
+#endif /* ! RS6000COFF_C */
+
 /*
 SUBSUBSECTION
        Writing relocations
 /*
 SUBSUBSECTION
        Writing relocations
@@ -2837,7 +2900,7 @@ static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
   coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in,
   coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook,
   coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
   coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in,
   coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook,
   coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
-  coff_slurp_symbol_table, symname_in_debug_hook,
+  coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
   coff_reloc16_extra_cases, coff_reloc16_estimate,
   coff_sym_is_global, coff_compute_section_file_positions,
   coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
   coff_reloc16_extra_cases, coff_reloc16_estimate,
   coff_sym_is_global, coff_compute_section_file_positions,
   coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
index 68588a2..b1fb60b 100644 (file)
@@ -53,6 +53,9 @@ static boolean coff_write_alien_symbol
 static boolean coff_write_native_symbol
   PARAMS ((bfd *, coff_symbol_type *, unsigned int *, bfd_size_type *,
           asection **, bfd_size_type *));
 static boolean coff_write_native_symbol
   PARAMS ((bfd *, coff_symbol_type *, unsigned int *, bfd_size_type *,
           asection **, bfd_size_type *));
+static void coff_pointerize_aux
+  PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
+          unsigned int, combined_entry_type *));
 
 #define STRING_SIZE_SIZE (4)
 
 
 #define STRING_SIZE_SIZE (4)
 
@@ -77,16 +80,7 @@ make_a_section_from_file (abfd, hdr, target_index)
   strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
   name[sizeof (hdr->s_name)] = 0;
 
   strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
   name[sizeof (hdr->s_name)] = 0;
 
-  return_section = bfd_make_section (abfd, name);
-  if (return_section == NULL)
-    return_section = bfd_coff_make_section_hook (abfd, name);
-
-  /* Handle several sections of the same name.  For example, if an executable
-     has two .bss sections, GDB better be able to find both of them
-     (PR 3562).  */
-  if (return_section == NULL)
-    return_section = bfd_make_section_anyway (abfd, name);
-
+  return_section = bfd_make_section_anyway (abfd, name);
   if (return_section == NULL)
     return false;
 
   if (return_section == NULL)
     return false;
 
@@ -1195,13 +1189,23 @@ coff_section_symbol (abfd, name)
    pointers to syments.  */
 
 static void
    pointers to syments.  */
 
 static void
-coff_pointerize_aux (abfd, table_base, type, class, auxent)
+coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent)
      bfd *abfd;
      combined_entry_type *table_base;
      bfd *abfd;
      combined_entry_type *table_base;
-     unsigned int type;
-     unsigned int class;
+     combined_entry_type *symbol;
+     unsigned int indaux;
      combined_entry_type *auxent;
 {
      combined_entry_type *auxent;
 {
+  int type = symbol->u.syment.n_type;
+  int class = symbol->u.syment.n_sclass;
+
+  if (coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook)
+    {
+      if ((*coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook)
+         (abfd, table_base, symbol, indaux, auxent))
+       return;
+    }
+
   /* Don't bother if this is a file or a section */
   if (class == C_STAT && type == T_NULL)
     return;
   /* Don't bother if this is a file or a section */
   if (class == C_STAT && type == T_NULL)
     return;
@@ -1215,8 +1219,7 @@ coff_pointerize_aux (abfd, table_base, type, class, auxent)
       && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0)
     {
       auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p =
       && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0)
     {
       auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p =
-       (table_base
-        + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l);
+       table_base + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l;
       auxent->fix_end = 1;
     }
   /* A negative tagndx is meaningless, but the SCO 3.2v4 cc can
       auxent->fix_end = 1;
     }
   /* A negative tagndx is meaningless, but the SCO 3.2v4 cc can
@@ -1492,17 +1495,8 @@ coff_get_normalized_symtab (abfd)
                                symbol_ptr->u.syment.n_sclass,
                                i, symbol_ptr->u.syment.n_numaux,
                                &(internal_ptr->u.auxent));
                                symbol_ptr->u.syment.n_sclass,
                                i, symbol_ptr->u.syment.n_numaux,
                                &(internal_ptr->u.auxent));
-         /* Remember that bal entries arn't pointerized */
-         if (i != 1 || symbol_ptr->u.syment.n_sclass != C_LEAFPROC)
-           {
-
-             coff_pointerize_aux (abfd,
-                                  internal,
-                                  symbol_ptr->u.syment.n_type,
-                                  symbol_ptr->u.syment.n_sclass,
-                                  internal_ptr);
-           }
-
+         coff_pointerize_aux (abfd, internal, symbol_ptr, i,
+                              internal_ptr);
        }
     }
 
        }
     }
 
index 4e7d837..d136b03 100644 (file)
@@ -391,9 +391,6 @@ typedef struct
        bfd     *abfd,
        PTR     internal_scnhdr,
        const char *name));
        bfd     *abfd,
        PTR     internal_scnhdr,
        const char *name));
- asection *(*_bfd_make_section_hook) PARAMS ((
-       bfd     *abfd,
-       char    *name));
  void (*_bfd_set_alignment_hook) PARAMS ((
        bfd     *abfd,
        asection *sec,
  void (*_bfd_set_alignment_hook) PARAMS ((
        bfd     *abfd,
        asection *sec,
@@ -403,6 +400,12 @@ typedef struct
  boolean (*_bfd_coff_symname_in_debug) PARAMS ((
        bfd     *abfd,
        struct internal_syment *sym));
  boolean (*_bfd_coff_symname_in_debug) PARAMS ((
        bfd     *abfd,
        struct internal_syment *sym));
+ boolean (*_bfd_coff_pointerize_aux_hook) PARAMS ((
+       bfd *abfd,
+       combined_entry_type *table_base,
+       combined_entry_type *symbol,
+       unsigned int indaux,
+       combined_entry_type *aux));
  void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
        bfd     *abfd,
        struct bfd_link_info *link_info,
  void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
        bfd     *abfd,
        struct bfd_link_info *link_info,
@@ -514,9 +517,6 @@ typedef struct
 #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
         ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
 
 #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
         ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
 
-#define bfd_coff_make_section_hook(abfd, name)\
-        ((coff_backend_info (abfd)->_bfd_make_section_hook) (abfd, name))
-
 #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
         ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
 
 #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
         ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))