* INTERWORK_FLAG: Return true for EABIv3 objects.
[deliverable/binutils-gdb.git] / bfd / elf32-arm.h
index 64da33374f5851f2801cf662bb049e1438a9176c..17521836b8ac832aea898ddd085f46a000b834fd 100644 (file)
 typedef unsigned long int insn32;
 typedef unsigned short int insn16;
 
-static bfd_boolean elf32_arm_set_private_flags
-  PARAMS ((bfd *, flagword));
-static bfd_boolean elf32_arm_copy_private_bfd_data
-  PARAMS ((bfd *, bfd *));
-static bfd_boolean elf32_arm_merge_private_bfd_data
-  PARAMS ((bfd *, bfd *));
-static bfd_boolean elf32_arm_print_private_bfd_data
-  PARAMS ((bfd *, PTR));
-static int elf32_arm_get_symbol_type
-  PARAMS (( Elf_Internal_Sym *, int));
-static struct bfd_link_hash_table *elf32_arm_link_hash_table_create
-  PARAMS ((bfd *));
-static bfd_reloc_status_type elf32_arm_final_link_relocate
-  PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *,
-          Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *,
-          const char *, int, struct elf_link_hash_entry *));
-static insn32 insert_thumb_branch
-  PARAMS ((insn32, int));
-static struct elf_link_hash_entry *find_thumb_glue
-  PARAMS ((struct bfd_link_info *, const char *, bfd *));
-static struct elf_link_hash_entry *find_arm_glue
-  PARAMS ((struct bfd_link_info *, const char *, bfd *));
-static void elf32_arm_post_process_headers
-  PARAMS ((bfd *, struct bfd_link_info *));
-static int elf32_arm_to_thumb_stub
-  PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
-          bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
-static int elf32_thumb_to_arm_stub
-  PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
-          bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
-static bfd_boolean elf32_arm_relocate_section
-  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
-          Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static asection * elf32_arm_gc_mark_hook
-  PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
-          struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf32_arm_gc_sweep_hook
-  PARAMS ((bfd *, struct bfd_link_info *, asection *,
-          const Elf_Internal_Rela *));
-static bfd_boolean elf32_arm_check_relocs
-  PARAMS ((bfd *, struct bfd_link_info *, asection *,
-          const Elf_Internal_Rela *));
-static bfd_boolean elf32_arm_find_nearest_line
-  PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
-          const char **, unsigned int *));
-static bfd_boolean elf32_arm_adjust_dynamic_symbol
-  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static bfd_boolean elf32_arm_size_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf32_arm_finish_dynamic_symbol
-  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
-          Elf_Internal_Sym *));
-static bfd_boolean elf32_arm_finish_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-static struct bfd_hash_entry * elf32_arm_link_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-#if USE_REL
-static void arm_add_to_rel
-  PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma));
-#endif
-static bfd_boolean allocate_dynrelocs 
-  PARAMS ((struct elf_link_hash_entry *h, PTR inf));
-static bfd_boolean create_got_section 
-  PARAMS ((bfd * dynobj, struct bfd_link_info * info));
-static bfd_boolean elf32_arm_create_dynamic_sections 
-  PARAMS ((bfd * dynobj, struct bfd_link_info * info));
-static enum elf_reloc_type_class elf32_arm_reloc_type_class
-  PARAMS ((const Elf_Internal_Rela *));
-static bfd_boolean elf32_arm_object_p
-  PARAMS ((bfd *));
-
-#ifndef ELFARM_NABI_C_INCLUDED
-static void record_arm_to_thumb_glue
-  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static void record_thumb_to_arm_glue
-  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-bfd_boolean bfd_elf32_arm_allocate_interworking_sections
-  PARAMS ((struct bfd_link_info *));
-bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
-  PARAMS ((bfd *, struct bfd_link_info *));
-bfd_boolean bfd_elf32_arm_process_before_allocation
-  PARAMS ((bfd *, struct bfd_link_info *, int, int));
-#endif
-
-
-#define INTERWORK_FLAG(abfd)   (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK)
+/* In leiu of proper flags, assume all EABIv3 objects are interworkable.  */
+#define INTERWORK_FLAG(abfd)  \
+  (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) == EF_ARM_EABI_VER3 \
+  || (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK))
 
 /* The linker script knows the section names for placement.
    The entry_names are used to do simple name mangling on the stubs.
@@ -241,7 +159,7 @@ struct elf32_arm_link_hash_entry
 #define elf32_arm_link_hash_traverse(table, func, info)                        \
   (elf_link_hash_traverse                                              \
    (&(table)->root,                                                    \
-    (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
+    (bfd_boolean (*) (struct elf_link_hash_entry *, void *))) (func), \
     (info)))
 
 /* Get the ARM elf linker hash table from a link_info structure.  */
@@ -286,10 +204,9 @@ struct elf32_arm_link_hash_table
 /* Create an entry in an ARM ELF linker hash table.  */
 
 static struct bfd_hash_entry *
-elf32_arm_link_hash_newfunc (entry, table, string)
-     struct bfd_hash_entry * entry;
-     struct bfd_hash_table * table;
-     const char * string;
+elf32_arm_link_hash_newfunc (struct bfd_hash_entry * entry,
+                             struct bfd_hash_table * table,
+                             const char * string)
 {
   struct elf32_arm_link_hash_entry * ret =
     (struct elf32_arm_link_hash_entry *) entry;
@@ -297,17 +214,15 @@ elf32_arm_link_hash_newfunc (entry, table, string)
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
   if (ret == (struct elf32_arm_link_hash_entry *) NULL)
-    ret = ((struct elf32_arm_link_hash_entry *)
-          bfd_hash_allocate (table,
-                             sizeof (struct elf32_arm_link_hash_entry)));
-  if (ret == (struct elf32_arm_link_hash_entry *) NULL)
+    ret = bfd_hash_allocate (table, sizeof (struct elf32_arm_link_hash_entry));
+  if (ret == NULL)
     return (struct bfd_hash_entry *) ret;
 
   /* Call the allocation method of the superclass.  */
   ret = ((struct elf32_arm_link_hash_entry *)
         _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
                                     table, string));
-  if (ret != (struct elf32_arm_link_hash_entry *) NULL)
+  if (ret != NULL)
     ret->relocs_copied = NULL;
 
   return (struct bfd_hash_entry *) ret;
@@ -317,9 +232,7 @@ elf32_arm_link_hash_newfunc (entry, table, string)
    shortcuts to them in our hash table.  */
 
 static bfd_boolean
-create_got_section (dynobj, info)
-     bfd *dynobj;
-     struct bfd_link_info *info;
+create_got_section (bfd *dynobj, struct bfd_link_info *info)
 {
   struct elf32_arm_link_hash_table *htab;
 
@@ -348,9 +261,7 @@ create_got_section (dynobj, info)
    hash table.  */
 
 static bfd_boolean
-elf32_arm_create_dynamic_sections (dynobj, info)
-     bfd *dynobj;
-     struct bfd_link_info *info;
+elf32_arm_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
 {
   struct elf32_arm_link_hash_table *htab;
 
@@ -425,17 +336,16 @@ elf32_arm_copy_indirect_symbol (const struct elf_backend_data *bed,
 /* Create an ARM elf linker hash table.  */
 
 static struct bfd_link_hash_table *
-elf32_arm_link_hash_table_create (abfd)
-     bfd *abfd;
+elf32_arm_link_hash_table_create (bfd *abfd)
 {
   struct elf32_arm_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table);
 
-  ret = (struct elf32_arm_link_hash_table *) bfd_malloc (amt);
-  if (ret == (struct elf32_arm_link_hash_table *) NULL)
+  ret = bfd_malloc (amt);
+  if (ret == NULL)
     return NULL;
 
-  if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+  if (!_bfd_elf_link_hash_table_init (& ret->root, abfd,
                                      elf32_arm_link_hash_newfunc))
     {
       free (ret);
@@ -462,10 +372,9 @@ elf32_arm_link_hash_table_create (abfd)
 /* Locate the Thumb encoded calling stub for NAME.  */
 
 static struct elf_link_hash_entry *
-find_thumb_glue (link_info, name, input_bfd)
-     struct bfd_link_info *link_info;
-     const char *name;
-     bfd *input_bfd;
+find_thumb_glue (struct bfd_link_info *link_info,
+                const char *name,
+                bfd *input_bfd)
 {
   char *tmp_name;
   struct elf_link_hash_entry *hash;
@@ -474,8 +383,8 @@ find_thumb_glue (link_info, name, input_bfd)
   /* We need a pointer to the armelf specific hash table.  */
   hash_table = elf32_arm_hash_table (link_info);
 
-  tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
-                                 + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
+  tmp_name = bfd_malloc ((bfd_size_type) strlen (name)
+                        + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
 
   BFD_ASSERT (tmp_name);
 
@@ -486,8 +395,8 @@ find_thumb_glue (link_info, name, input_bfd)
 
   if (hash == NULL)
     /* xgettext:c-format */
-    (*_bfd_error_handler) (_("%s: unable to find THUMB glue '%s' for `%s'"),
-                          bfd_archive_filename (input_bfd), tmp_name, name);
+    (*_bfd_error_handler) (_("%B: unable to find THUMB glue '%s' for `%s'"),
+                          input_bfd, tmp_name, name);
 
   free (tmp_name);
 
@@ -497,10 +406,9 @@ find_thumb_glue (link_info, name, input_bfd)
 /* Locate the ARM encoded calling stub for NAME.  */
 
 static struct elf_link_hash_entry *
-find_arm_glue (link_info, name, input_bfd)
-     struct bfd_link_info *link_info;
-     const char *name;
-     bfd *input_bfd;
+find_arm_glue (struct bfd_link_info *link_info,
+              const char *name,
+              bfd *input_bfd)
 {
   char *tmp_name;
   struct elf_link_hash_entry *myh;
@@ -509,8 +417,8 @@ find_arm_glue (link_info, name, input_bfd)
   /* We need a pointer to the elfarm specific hash table.  */
   hash_table = elf32_arm_hash_table (link_info);
 
-  tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
-                                 + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
+  tmp_name = bfd_malloc ((bfd_size_type) strlen (name)
+                        + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
 
   BFD_ASSERT (tmp_name);
 
@@ -521,8 +429,8 @@ find_arm_glue (link_info, name, input_bfd)
 
   if (myh == NULL)
     /* xgettext:c-format */
-    (*_bfd_error_handler) (_("%s: unable to find ARM glue '%s' for `%s'"),
-                          bfd_archive_filename (input_bfd), tmp_name, name);
+    (*_bfd_error_handler) (_("%B: unable to find ARM glue '%s' for `%s'"),
+                          input_bfd, tmp_name, name);
 
   free (tmp_name);
 
@@ -566,8 +474,7 @@ static const insn32 t2a3_b_insn = 0xea000000;
 
 #ifndef ELFARM_NABI_C_INCLUDED
 bfd_boolean
-bfd_elf32_arm_allocate_interworking_sections (info)
-     struct bfd_link_info * info;
+bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info * info)
 {
   asection * s;
   bfd_byte * foo;
@@ -586,10 +493,9 @@ bfd_elf32_arm_allocate_interworking_sections (info)
 
       BFD_ASSERT (s != NULL);
 
-      foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
-                                   globals->arm_glue_size);
+      foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size);
 
-      s->_raw_size = s->_cooked_size = globals->arm_glue_size;
+      s->size = globals->arm_glue_size;
       s->contents = foo;
     }
 
@@ -602,10 +508,9 @@ bfd_elf32_arm_allocate_interworking_sections (info)
 
       BFD_ASSERT (s != NULL);
 
-      foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
-                                   globals->thumb_glue_size);
+      foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size);
 
-      s->_raw_size = s->_cooked_size = globals->thumb_glue_size;
+      s->size = globals->thumb_glue_size;
       s->contents = foo;
     }
 
@@ -613,9 +518,8 @@ bfd_elf32_arm_allocate_interworking_sections (info)
 }
 
 static void
-record_arm_to_thumb_glue (link_info, h)
-     struct bfd_link_info * link_info;
-     struct elf_link_hash_entry * h;
+record_arm_to_thumb_glue (struct bfd_link_info * link_info,
+                         struct elf_link_hash_entry * h)
 {
   const char * name = h->root.root.string;
   asection * s;
@@ -635,8 +539,7 @@ record_arm_to_thumb_glue (link_info, h)
 
   BFD_ASSERT (s != NULL);
 
-  tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
-                                 + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
+  tmp_name = bfd_malloc ((bfd_size_type) strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
 
   BFD_ASSERT (tmp_name);
 
@@ -652,9 +555,9 @@ record_arm_to_thumb_glue (link_info, h)
       return;
     }
 
-  /* The only trick here is using hash_table->arm_glue_size as the value. Even
-     though the section isn't allocated yet, this is where we will be putting
-     it.  */
+  /* The only trick here is using hash_table->arm_glue_size as the value.
+     Even though the section isn't allocated yet, this is where we will be
+     putting it.  */
   bh = NULL;
   val = globals->arm_glue_size + 1;
   _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner,
@@ -669,9 +572,8 @@ record_arm_to_thumb_glue (link_info, h)
 }
 
 static void
-record_thumb_to_arm_glue (link_info, h)
-     struct bfd_link_info *link_info;
-     struct elf_link_hash_entry *h;
+record_thumb_to_arm_glue (struct bfd_link_info *link_info,
+                         struct elf_link_hash_entry *h)
 {
   const char *name = h->root.root.string;
   asection *s;
@@ -692,8 +594,8 @@ record_thumb_to_arm_glue (link_info, h)
 
   BFD_ASSERT (s != NULL);
 
-  tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
-                                 + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
+  tmp_name = bfd_malloc ((bfd_size_type) strlen (name)
+                        + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
 
   BFD_ASSERT (tmp_name);
 
@@ -726,8 +628,8 @@ record_thumb_to_arm_glue (link_info, h)
 #define BACK_FROM_ARM "__%s_back_from_arm"
 
   /* Allocate another symbol to mark where we switch to Arm mode.  */
-  tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
-                                 + strlen (CHANGE_TO_ARM) + 1);
+  tmp_name = bfd_malloc ((bfd_size_type) strlen (name)
+                        + strlen (CHANGE_TO_ARM) + 1);
 
   BFD_ASSERT (tmp_name);
 
@@ -750,9 +652,8 @@ record_thumb_to_arm_glue (link_info, h)
    linker scripts in ld/emultempl/{armelf}.em.  */
 
 bfd_boolean
-bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
-     bfd *abfd;
-     struct bfd_link_info *info;
+bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd,
+                                       struct bfd_link_info *info)
 {
   flagword flags;
   asection *sec;
@@ -787,7 +688,8 @@ bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
 
   if (sec == NULL)
     {
-      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
+      flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+       | SEC_CODE | SEC_READONLY;
 
       sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME);
 
@@ -807,9 +709,7 @@ bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
    {armelf/pe}.em  */
 
 bfd_boolean
-bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
-     bfd *abfd;
-     struct bfd_link_info *info;
+bfd_elf32_arm_get_bfd_for_interworking (bfd *abfd, struct bfd_link_info *info)
 {
   struct elf32_arm_link_hash_table *globals;
 
@@ -832,13 +732,10 @@ bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
 }
 
 bfd_boolean
-bfd_elf32_arm_process_before_allocation (abfd, link_info,
-                                        no_pipeline_knowledge,
-                                        byteswap_code)
-     bfd *abfd;
-     struct bfd_link_info *link_info;
-     int no_pipeline_knowledge;
-     int byteswap_code;
+bfd_elf32_arm_process_before_allocation (bfd *abfd,
+                                        struct bfd_link_info *link_info,
+                                        int no_pipeline_knowledge,
+                                        int byteswap_code)
 {
   Elf_Internal_Shdr *symtab_hdr;
   Elf_Internal_Rela *internal_relocs = NULL;
@@ -863,9 +760,8 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info,
   globals->no_pipeline_knowledge = no_pipeline_knowledge;
   if (byteswap_code && !bfd_big_endian (abfd))
     {
-      _bfd_error_handler (
-         _("%s: BE8 images only valid in big-endian mode."),
-         bfd_archive_filename (abfd));
+      _bfd_error_handler (_("%B: BE8 images only valid in big-endian mode."),
+                         abfd);
       return FALSE;
     }
   globals->byteswap_code = byteswap_code;
@@ -885,7 +781,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info,
 
       /* Load the relocs.  */
       internal_relocs
-       = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL,
+       = _bfd_elf_link_read_relocs (abfd, sec, (void *) NULL,
                                     (Elf_Internal_Rela *) NULL, FALSE);
 
       if (internal_relocs == NULL)
@@ -916,12 +812,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info,
              else
                {
                  /* Go get them off disk.  */
-                 contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
-                 if (contents == NULL)
-                   goto error_return;
-
-                 if (!bfd_get_section_contents (abfd, sec, contents,
-                                                (file_ptr) 0, sec->_raw_size))
+                 if (! bfd_malloc_and_get_section (abfd, sec, &contents))
                    goto error_return;
                }
            }
@@ -1023,9 +914,7 @@ error_return:
 #define HI_LOW_ORDER      0xF000F800
 
 static insn32
-insert_thumb_branch (br_insn, rel_off)
-     insn32 br_insn;
-     int rel_off;
+insert_thumb_branch (insn32 br_insn, int rel_off)
 {
   unsigned int low_bits;
   unsigned int high_bits;
@@ -1042,7 +931,7 @@ insert_thumb_branch (br_insn, rel_off)
     br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits;
   else
     /* FIXME: abort is probably not the right call. krk@cygnus.com  */
-    abort ();                  /* error - not a valid branch instruction form.  */
+    abort ();  /* Error - not a valid branch instruction form.  */
 
   return br_insn;
 }
@@ -1050,18 +939,16 @@ insert_thumb_branch (br_insn, rel_off)
 /* Thumb code calling an ARM function.  */
 
 static int
-elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
-                        hit_data, sym_sec, offset, addend, val)
-     struct bfd_link_info * info;
-     const char *           name;
-     bfd *                  input_bfd;
-     bfd *                  output_bfd;
-     asection *             input_section;
-     bfd_byte *             hit_data;
-     asection *             sym_sec;
-     bfd_vma                offset;
-     bfd_signed_vma         addend;
-     bfd_vma                val;
+elf32_thumb_to_arm_stub (struct bfd_link_info * info,
+                        const char *           name,
+                        bfd *                  input_bfd,
+                        bfd *                  output_bfd,
+                        asection *             input_section,
+                        bfd_byte *             hit_data,
+                        asection *             sym_sec,
+                        bfd_vma                offset,
+                        bfd_signed_vma         addend,
+                        bfd_vma                val)
 {
   asection * s = 0;
   bfd_vma my_offset;
@@ -1095,11 +982,9 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
          && !INTERWORK_FLAG (sym_sec->owner))
        {
          (*_bfd_error_handler)
-           (_("%s(%s): warning: interworking not enabled."),
-            bfd_archive_filename (sym_sec->owner), name);
-         (*_bfd_error_handler)
-           (_("  first occurrence: %s: thumb call to arm"),
-            bfd_archive_filename (input_bfd));
+           (_("%B(%s): warning: interworking not enabled.\n"
+              "  first occurrence: %B: thumb call to arm"),
+            sym_sec->owner, input_bfd, name);
 
          return FALSE;
        }
@@ -1117,7 +1002,8 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
        /* Address of destination of the stub.  */
        ((bfd_signed_vma) val)
        - ((bfd_signed_vma)
-          /* Offset from the start of the current section to the start of the stubs.  */
+          /* Offset from the start of the current section
+             to the start of the stubs.  */
           (s->output_offset
            /* Offset of the start of this stub from the start of the stubs.  */
            + my_offset
@@ -1140,7 +1026,8 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
     /* Address of where the stub is located.  */
     (s->output_section->vma + s->output_offset + my_offset)
      /* Address of where the BL is located.  */
-    - (input_section->output_section->vma + input_section->output_offset + offset)
+    - (input_section->output_section->vma + input_section->output_offset
+       + offset)
     /* Addend in the relocation.  */
     - addend
     /* Biassing for PC-relative addressing.  */
@@ -1159,18 +1046,16 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
 /* Arm code calling a Thumb function.  */
 
 static int
-elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
-                        hit_data, sym_sec, offset, addend, val)
-     struct bfd_link_info * info;
-     const char *           name;
-     bfd *                  input_bfd;
-     bfd *                  output_bfd;
-     asection *             input_section;
-     bfd_byte *             hit_data;
-     asection *             sym_sec;
-     bfd_vma                offset;
-     bfd_signed_vma         addend;
-     bfd_vma                val;
+elf32_arm_to_thumb_stub (struct bfd_link_info * info,
+                        const char *           name,
+                        bfd *                  input_bfd,
+                        bfd *                  output_bfd,
+                        asection *             input_section,
+                        bfd_byte *             hit_data,
+                        asection *             sym_sec,
+                        bfd_vma                offset,
+                        bfd_signed_vma         addend,
+                        bfd_vma                val)
 {
   unsigned long int tmp;
   bfd_vma my_offset;
@@ -1202,11 +1087,9 @@ elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
          && !INTERWORK_FLAG (sym_sec->owner))
        {
          (*_bfd_error_handler)
-           (_("%s(%s): warning: interworking not enabled."),
-            bfd_archive_filename (sym_sec->owner), name);
-         (*_bfd_error_handler)
-           (_("  first occurrence: %s: arm call to thumb"),
-            bfd_archive_filename (input_bfd));
+           (_("%B(%s): warning: interworking not enabled.\n"
+              "  first occurrence: %B: arm call to thumb"),
+            sym_sec->owner, input_bfd, name);
        }
 
       --my_offset;
@@ -1247,21 +1130,18 @@ elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
 /* Perform a relocation as part of a final link.  */
 
 static bfd_reloc_status_type
-elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
-                              input_section, contents, rel, value,
-                              info, sym_sec, sym_name, sym_flags, h)
-     reloc_howto_type *     howto;
-     bfd *                  input_bfd;
-     bfd *                  output_bfd;
-     asection *             input_section;
-     bfd_byte *             contents;
-     Elf_Internal_Rela *    rel;
-     bfd_vma                value;
-     struct bfd_link_info * info;
-     asection *             sym_sec;
-     const char *           sym_name;
-     int                   sym_flags;
-     struct elf_link_hash_entry * h;
+elf32_arm_final_link_relocate (reloc_howto_type *           howto,
+                              bfd *                        input_bfd,
+                              bfd *                        output_bfd,
+                              asection *                   input_section,
+                              bfd_byte *                   contents,
+                              Elf_Internal_Rela *          rel,
+                              bfd_vma                      value,
+                              struct bfd_link_info *       info,
+                              asection *                   sym_sec,
+                              const char *                 sym_name,
+                              int                          sym_flags,
+                              struct elf_link_hash_entry * h)
 {
   unsigned long                 r_type = howto->type;
   unsigned long                 r_symndx;
@@ -1450,10 +1330,10 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
              /* FIXME: Should we translate the instruction into a BL
                 instruction instead ?  */
              if (sym_flags != STT_ARM_TFUNC)
-               (*_bfd_error_handler) (_("\
-%s: Warning: Arm BLX instruction targets Arm function '%s'."),
-                                      bfd_archive_filename (input_bfd),
-                                      h ? h->root.root.string : "(local)");
+               (*_bfd_error_handler)
+                 (_("\%B: Warning: Arm BLX instruction targets Arm function '%s'."),
+                  input_bfd,
+                  h ? h->root.root.string : "(local)");
            }
          else
 #endif
@@ -1461,8 +1341,9 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
              /* Check for Arm calling Thumb function.  */
              if (sym_flags == STT_ARM_TFUNC)
                {
-                 elf32_arm_to_thumb_stub (info, sym_name, input_bfd, output_bfd,
-                                          input_section, hit_data, sym_sec, rel->r_offset,
+                 elf32_arm_to_thumb_stub (info, sym_name, input_bfd,
+                                          output_bfd, input_section,
+                                          hit_data, sym_sec, rel->r_offset,
                                           signed_addend, value);
                  return bfd_reloc_ok;
                }
@@ -1490,8 +1371,9 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
                  A is the addend (extracted from the instruction) in bytes.
 
                 S is held in 'value'.
-                P is the base address of the section containing the instruction
-                  plus the offset of the reloc into that section, ie:
+                P is the base address of the section containing the
+                  instruction plus the offset of the reloc into that
+                  section, ie:
                     (input_section->output_section->vma +
                      input_section->output_offset +
                      rel->r_offset).
@@ -1499,18 +1381,19 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
                     (signed_addend * 4)
 
                 Note: None of these operations have knowledge of the pipeline
-                size of the processor, thus it is up to the assembler to encode
-                this information into the addend.  */
+                size of the processor, thus it is up to the assembler to
+                encode this information into the addend.  */
              value -= (input_section->output_section->vma
                        + input_section->output_offset);
              value -= rel->r_offset;
              value += (signed_addend << howto->size);
 
-             /* Previous versions of this code also used to add in the pipeline
-                offset here.  This is wrong because the linker is not supposed
-                to know about such things, and one day it might change.  In order
-                to support old binaries that need the old behaviour however, so
-                we attempt to detect which ABI was used to create the reloc.  */
+             /* Previous versions of this code also used to add in the
+                pipeline offset here.  This is wrong because the linker is
+                not supposed to know about such things, and one day it might
+                change.  In order to support old binaries that need the old
+                behaviour however, so we attempt to detect which ABI was
+                used to create the reloc.  */
              if (! globals->no_pipeline_knowledge)
                {
                  Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form */
@@ -1646,10 +1529,10 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
            /* FIXME: Should we translate the instruction into a BL
               instruction instead ?  */
            if (sym_flags == STT_ARM_TFUNC)
-             (*_bfd_error_handler) (_("\
-%s: Warning: Thumb BLX instruction targets thumb function '%s'."),
-                                    bfd_archive_filename (input_bfd),
-                                    h ? h->root.root.string : "(local)");
+             (*_bfd_error_handler)
+               (_("%B: Warning: Thumb BLX instruction targets thumb function '%s'."),
+                input_bfd,
+                h ? h->root.root.string : "(local)");
          }
        else
 #endif
@@ -1974,11 +1857,10 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
 #if USE_REL
 /* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS.  */
 static void
-arm_add_to_rel (abfd, address, howto, increment)
-     bfd *              abfd;
-     bfd_byte *         address;
-     reloc_howto_type * howto;
-     bfd_signed_vma     increment;
+arm_add_to_rel (bfd *              abfd,
+               bfd_byte *         address,
+               reloc_howto_type * howto,
+               bfd_signed_vma     increment)
 {
   bfd_signed_vma addend;
 
@@ -2046,16 +1928,14 @@ arm_add_to_rel (abfd, address, howto, increment)
 
 /* Relocate an ARM ELF section.  */
 static bfd_boolean
-elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
-                           contents, relocs, local_syms, local_sections)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
-     bfd *input_bfd;
-     asection *input_section;
-     bfd_byte *contents;
-     Elf_Internal_Rela *relocs;
-     Elf_Internal_Sym *local_syms;
-     asection **local_sections;
+elf32_arm_relocate_section (bfd *                  output_bfd,
+                           struct bfd_link_info * info,
+                           bfd *                  input_bfd,
+                           asection *             input_section,
+                           bfd_byte *             contents,
+                           Elf_Internal_Rela *    relocs,
+                           Elf_Internal_Sym *     local_syms,
+                           asection **            local_sections)
 {
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
@@ -2141,9 +2021,8 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
              if (howto->rightshift)
                {
                  (*_bfd_error_handler)
-                   (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"),
-                    bfd_archive_filename (input_bfd),
-                    bfd_get_section_name (input_bfd, input_section),
+                   (_("%B(%A+0x%lx): %s relocation against SEC_MERGE section"),
+                    input_bfd, input_section,
                     (long) rel->r_offset, howto->name);
                  return FALSE;
                }
@@ -2181,7 +2060,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
                                   r_symndx, symtab_hdr, sym_hashes,
                                   h, sec, relocation,
                                   unresolved_reloc, warned);
-         
+
          if (unresolved_reloc || relocation != 0)
            {
              /* In these cases, we don't need the relocation value.
@@ -2192,6 +2071,8 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
                case R_ARM_PC24:
                case R_ARM_ABS32:
                case R_ARM_THM_PC22:
+               case R_ARM_PLT32:
+
                  if (info->shared
                      && (
                          (!info->symbolic && h->dynindx != -1)
@@ -2225,19 +2106,13 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
                    relocation = 0;
                  break;
 
-               case R_ARM_PLT32:
-                 if (h->plt.offset != (bfd_vma)-1)
-                   relocation = 0;
-                 break;
-
                default:
                  if (unresolved_reloc)
                    _bfd_error_handler
-                     (_("%s: warning: unresolvable relocation %d against symbol `%s' from %s section"),
-                      bfd_archive_filename (input_bfd),
+                     (_("%B(%A): warning: unresolvable relocation %d against symbol `%s'"),
+                      input_bfd, input_section,
                       r_type,
-                      h->root.root.string,
-                      bfd_get_section_name (input_bfd, input_section));
+                      h->root.root.string);
                  break;
                }
            }
@@ -2316,11 +2191,10 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
 /* Set the right machine number.  */
 
 static bfd_boolean
-elf32_arm_object_p (abfd)
-     bfd *abfd;
+elf32_arm_object_p (bfd *abfd)
 {
   unsigned int mach;
-  
+
   mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION);
 
   if (mach != bfd_mach_arm_unknown)
@@ -2337,9 +2211,7 @@ elf32_arm_object_p (abfd)
 
 /* Function to keep ARM specific flags in the ELF header.  */
 static bfd_boolean
-elf32_arm_set_private_flags (abfd, flags)
-     bfd *abfd;
-     flagword flags;
+elf32_arm_set_private_flags (bfd *abfd, flagword flags)
 {
   if (elf_flags_init (abfd)
       && elf_elfheader (abfd)->e_flags != flags)
@@ -2347,13 +2219,13 @@ elf32_arm_set_private_flags (abfd, flags)
       if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN)
        {
          if (flags & EF_ARM_INTERWORK)
-           (*_bfd_error_handler) (_("\
-Warning: Not setting interworking flag of %s since it has already been specified as non-interworking"),
-                                  bfd_archive_filename (abfd));
+           (*_bfd_error_handler)
+             (_("Warning: Not setting interworking flag of %B since it has already been specified as non-interworking"),
+              abfd);
          else
-           _bfd_error_handler (_("\
-Warning: Clearing the interworking flag of %s due to outside request"),
-                               bfd_archive_filename (abfd));
+           _bfd_error_handler
+             (_("Warning: Clearing the interworking flag of %B due to outside request"),
+              abfd);
        }
     }
   else
@@ -2368,9 +2240,7 @@ Warning: Clearing the interworking flag of %s due to outside request"),
 /* Copy backend specific data from one object module to another.  */
 
 static bfd_boolean
-elf32_arm_copy_private_bfd_data (ibfd, obfd)
-     bfd *ibfd;
-     bfd *obfd;
+elf32_arm_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
 {
   flagword in_flags;
   flagword out_flags;
@@ -2399,10 +2269,9 @@ elf32_arm_copy_private_bfd_data (ibfd, obfd)
       if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK))
        {
          if (out_flags & EF_ARM_INTERWORK)
-           _bfd_error_handler (_("\
-Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it"),
-                               bfd_get_filename (obfd),
-                               bfd_archive_filename (ibfd));
+           _bfd_error_handler
+             (_("Warning: Clearing the interworking flag of %B because non-interworking code in %B has been linked with it"),
+              obfd, ibfd);
 
          in_flags &= ~EF_ARM_INTERWORK;
        }
@@ -2422,9 +2291,7 @@ Warning: Clearing the interworking flag of %s because non-interworking code in %
    object file when linking.  */
 
 static bfd_boolean
-elf32_arm_merge_private_bfd_data (ibfd, obfd)
-     bfd * ibfd;
-     bfd * obfd;
+elf32_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
 {
   flagword out_flags;
   flagword in_flags;
@@ -2517,12 +2384,11 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd)
   /* Complain about various flag mismatches.  */
   if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags))
     {
-      _bfd_error_handler (_("\
-ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d"),
-                         bfd_archive_filename (ibfd),
-                         (in_flags & EF_ARM_EABIMASK) >> 24,
-                         bfd_get_filename (obfd),
-                         (out_flags & EF_ARM_EABIMASK) >> 24);
+      _bfd_error_handler
+       (_("ERROR: %B is compiled for EABI version %d, whereas %B is compiled for version %d"),
+        ibfd, obfd,
+        (in_flags & EF_ARM_EABIMASK) >> 24,
+        (out_flags & EF_ARM_EABIMASK) >> 24);
       return FALSE;
     }
 
@@ -2531,27 +2397,24 @@ ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d
     {
       if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26))
        {
-         _bfd_error_handler (_("\
-ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"),
-                             bfd_archive_filename (ibfd),
-                             in_flags & EF_ARM_APCS_26 ? 26 : 32,
-                             bfd_get_filename (obfd),
-                             out_flags & EF_ARM_APCS_26 ? 26 : 32);
+         _bfd_error_handler
+           (_("ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"),
+            ibfd, obfd,
+            in_flags & EF_ARM_APCS_26 ? 26 : 32,
+            out_flags & EF_ARM_APCS_26 ? 26 : 32);
          flags_compatible = FALSE;
        }
 
       if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT))
        {
          if (in_flags & EF_ARM_APCS_FLOAT)
-           _bfd_error_handler (_("\
-ERROR: %s passes floats in float registers, whereas %s passes them in integer registers"),
-                               bfd_archive_filename (ibfd),
-                               bfd_get_filename (obfd));
+           _bfd_error_handler
+             (_("ERROR: %B passes floats in float registers, whereas %B passes them in integer registers"),
+              ibfd, obfd);
          else
-           _bfd_error_handler (_("\
-ERROR: %s passes floats in integer registers, whereas %s passes them in float registers"),
-                               bfd_archive_filename (ibfd),
-                               bfd_get_filename (obfd));
+           _bfd_error_handler
+             (_("ERROR: %B passes floats in integer registers, whereas %B passes them in float registers"),
+              ibfd, obfd);
 
          flags_compatible = FALSE;
        }
@@ -2559,15 +2422,13 @@ ERROR: %s passes floats in integer registers, whereas %s passes them in float re
       if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT))
        {
          if (in_flags & EF_ARM_VFP_FLOAT)
-           _bfd_error_handler (_("\
-ERROR: %s uses VFP instructions, whereas %s does not"),
-                               bfd_archive_filename (ibfd),
-                               bfd_get_filename (obfd));
+           _bfd_error_handler
+             (_("ERROR: %B uses VFP instructions, whereas %B does not"),
+              ibfd, obfd);
          else
-           _bfd_error_handler (_("\
-ERROR: %s uses FPA instructions, whereas %s does not"),
-                               bfd_archive_filename (ibfd),
-                               bfd_get_filename (obfd));
+           _bfd_error_handler
+             (_("ERROR: %B uses FPA instructions, whereas %B does not"),
+              ibfd, obfd);
 
          flags_compatible = FALSE;
        }
@@ -2575,15 +2436,13 @@ ERROR: %s uses FPA instructions, whereas %s does not"),
       if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT))
        {
          if (in_flags & EF_ARM_MAVERICK_FLOAT)
-           _bfd_error_handler (_("\
-ERROR: %s uses Maverick instructions, whereas %s does not"),
-                               bfd_archive_filename (ibfd),
-                               bfd_get_filename (obfd));
+           _bfd_error_handler
+             (_("ERROR: %B uses Maverick instructions, whereas %B does not"),
+              ibfd, obfd);
          else
-           _bfd_error_handler (_("\
-ERROR: %s does not use Maverick instructions, whereas %s does"),
-                               bfd_archive_filename (ibfd),
-                               bfd_get_filename (obfd));
+           _bfd_error_handler
+             (_("ERROR: %B does not use Maverick instructions, whereas %B does"),
+              ibfd, obfd);
 
          flags_compatible = FALSE;
        }
@@ -2600,15 +2459,13 @@ ERROR: %s does not use Maverick instructions, whereas %s does"),
              || (in_flags & EF_ARM_VFP_FLOAT) == 0)
            {
              if (in_flags & EF_ARM_SOFT_FLOAT)
-               _bfd_error_handler (_("\
-ERROR: %s uses software FP, whereas %s uses hardware FP"),
-                                   bfd_archive_filename (ibfd),
-                                   bfd_get_filename (obfd));
+               _bfd_error_handler
+                 (_("ERROR: %B uses software FP, whereas %B uses hardware FP"),
+                  ibfd, obfd);
              else
-               _bfd_error_handler (_("\
-ERROR: %s uses hardware FP, whereas %s uses software FP"),
-                                   bfd_archive_filename (ibfd),
-                                   bfd_get_filename (obfd));
+               _bfd_error_handler
+                 (_("ERROR: %B uses hardware FP, whereas %B uses software FP"),
+                  ibfd, obfd);
 
              flags_compatible = FALSE;
            }
@@ -2620,17 +2477,15 @@ ERROR: %s uses hardware FP, whereas %s uses software FP"),
        {
          if (in_flags & EF_ARM_INTERWORK)
            {
-             _bfd_error_handler (_("\
-Warning: %s supports interworking, whereas %s does not"),
-                                 bfd_archive_filename (ibfd),
-                                 bfd_get_filename (obfd));
+             _bfd_error_handler
+               (_("Warning: %B supports interworking, whereas %B does not"),
+                ibfd, obfd);
            }
          else
            {
-             _bfd_error_handler (_("\
-Warning: %s does not support interworking, whereas %s does"),
-                                 bfd_archive_filename (ibfd),
-                                 bfd_get_filename (obfd));
+             _bfd_error_handler
+               (_("Warning: %B does not support interworking, whereas %B does"),
+                ibfd, obfd);
            }
        }
     }
@@ -2641,9 +2496,7 @@ Warning: %s does not support interworking, whereas %s does"),
 /* Display the flags field.  */
 
 static bfd_boolean
-elf32_arm_print_private_bfd_data (abfd, ptr)
-     bfd *abfd;
-     PTR ptr;
+elf32_arm_print_private_bfd_data (bfd *abfd, void * ptr)
 {
   FILE * file = (FILE *) ptr;
   unsigned long flags;
@@ -2767,9 +2620,7 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
 }
 
 static int
-elf32_arm_get_symbol_type (elf_sym, type)
-     Elf_Internal_Sym * elf_sym;
-     int type;
+elf32_arm_get_symbol_type (Elf_Internal_Sym * elf_sym, int type)
 {
   switch (ELF_ST_TYPE (elf_sym->st_info))
     {
@@ -2793,12 +2644,11 @@ elf32_arm_get_symbol_type (elf_sym, type)
 }
 
 static asection *
-elf32_arm_gc_mark_hook (sec, info, rel, h, sym)
-       asection *sec;
-       struct bfd_link_info *info ATTRIBUTE_UNUSED;
-       Elf_Internal_Rela *rel;
-       struct elf_link_hash_entry *h;
-       Elf_Internal_Sym *sym;
+elf32_arm_gc_mark_hook (asection *                   sec,
+                       struct bfd_link_info *       info ATTRIBUTE_UNUSED,
+                       Elf_Internal_Rela *          rel,
+                       struct elf_link_hash_entry * h,
+                       Elf_Internal_Sym *           sym)
 {
   if (h != NULL)
     {
@@ -2832,11 +2682,10 @@ elf32_arm_gc_mark_hook (sec, info, rel, h, sym)
 /* Update the got entry reference counts for the section being removed.  */
 
 static bfd_boolean
-elf32_arm_gc_sweep_hook (abfd, info, sec, relocs)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     struct bfd_link_info *info ATTRIBUTE_UNUSED;
-     asection *sec ATTRIBUTE_UNUSED;
-     const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
+elf32_arm_gc_sweep_hook (bfd *                     abfd ATTRIBUTE_UNUSED,
+                        struct bfd_link_info *    info ATTRIBUTE_UNUSED,
+                        asection *                sec ATTRIBUTE_UNUSED,
+                        const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
 {
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
@@ -2914,11 +2763,8 @@ elf32_arm_gc_sweep_hook (abfd, info, sec, relocs)
 /* Look through the relocs for a section during the first phase.  */
 
 static bfd_boolean
-elf32_arm_check_relocs (abfd, info, sec, relocs)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     asection *sec;
-     const Elf_Internal_Rela *relocs;
+elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
+                       asection *sec, const Elf_Internal_Rela *relocs)
 {
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
@@ -2978,9 +2824,8 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
                    bfd_size_type size;
 
                    size = symtab_hdr->sh_info;
-                   size *= (sizeof (bfd_signed_vma) + sizeof(char));
-                   local_got_refcounts = ((bfd_signed_vma *)
-                                          bfd_zalloc (abfd, size));
+                   size *= (sizeof (bfd_signed_vma) + sizeof (char));
+                   local_got_refcounts = bfd_zalloc (abfd, size);
                    if (local_got_refcounts == NULL)
                      return FALSE;
                    elf_local_got_refcounts (abfd) = local_got_refcounts;
@@ -3100,21 +2945,22 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
                    /* Track dynamic relocs needed for local syms too.
                       We really need local syms available to do this
                       easily.  Oh well.  */
-                   
+
                    asection *s;
                    s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
                                                   sec, r_symndx);
                    if (s == NULL)
                      return FALSE;
-                   
+
                    head = ((struct elf32_arm_relocs_copied **)
                            &elf_section_data (s)->local_dynrel);
                  }
-               
+
                p = *head;
                if (p == NULL || p->section != sec)
                  {
                    bfd_size_type amt = sizeof *p;
+
                    p = bfd_alloc (htab->root.dynobj, amt);
                    if (p == NULL)
                      return FALSE;
@@ -3123,7 +2969,7 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
                    p->section = sec;
                    p->count = 0;
                  }
-               
+
                if (ELF32_R_TYPE (rel->r_info) == R_ARM_ABS32
                    || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32)
                  p->count += 1;
@@ -3149,48 +2995,31 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
   return TRUE;
 }
 
-/* Find the nearest line to a particular section and offset, for error
-   reporting.   This code is a duplicate of the code in elf.c, except
-   that it also accepts STT_ARM_TFUNC as a symbol that names a function.  */
-
 static bfd_boolean
-elf32_arm_find_nearest_line
-  (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr)
-     bfd *abfd;
-     asection *section;
-     asymbol **symbols;
-     bfd_vma offset;
-     const char **filename_ptr;
-     const char **functionname_ptr;
-     unsigned int *line_ptr;
+is_arm_mapping_symbol_name (const char * name)
 {
-  bfd_boolean found;
-  const char *filename;
-  asymbol *func;
-  bfd_vma low_func;
-  asymbol **p;
-
-  if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
-                                    filename_ptr, functionname_ptr,
-                                    line_ptr, 0,
-                                    &elf_tdata (abfd)->dwarf2_find_line_info))
-    return TRUE;
-
-  if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
-                                            &found, filename_ptr,
-                                            functionname_ptr, line_ptr,
-                                            &elf_tdata (abfd)->line_info))
-    return FALSE;
-
-  if (found)
-    return TRUE;
+  return (name != NULL)
+    && (name[0] == '$')
+    && ((name[1] == 'a') || (name[1] == 't') || (name[1] == 'd'))
+    && (name[2] == 0);
+}
 
-  if (symbols == NULL)
-    return FALSE;
+/* This is a copy of elf_find_function() from elf.c except that
+   ARM mapping symbols are ignored when looking for function names
+   and STT_ARM_TFUNC is considered to a function type.  */
 
-  filename = NULL;
-  func = NULL;
-  low_func = 0;
+static bfd_boolean
+arm_elf_find_function (bfd *         abfd ATTRIBUTE_UNUSED,
+                      asection *    section,
+                      asymbol **    symbols,
+                      bfd_vma       offset,
+                      const char ** filename_ptr,
+                      const char ** functionname_ptr)
+{
+  const char * filename = NULL;
+  asymbol * func = NULL;
+  bfd_vma low_func = 0;
+  asymbol ** p;
 
   for (p = symbols; *p != NULL; p++)
     {
@@ -3208,9 +3037,14 @@ elf32_arm_find_nearest_line
        case STT_FILE:
          filename = bfd_asymbol_name (&q->symbol);
          break;
-       case STT_NOTYPE:
        case STT_FUNC:
        case STT_ARM_TFUNC:
+         /* Skip $a and $t symbols.  */
+         if ((q->symbol.flags & BSF_LOCAL)
+             && is_arm_mapping_symbol_name (q->symbol.name))
+           continue;
+         /* Fall through.  */
+       case STT_NOTYPE:
          if (q->symbol.section == section
              && q->symbol.value >= low_func
              && q->symbol.value <= offset)
@@ -3225,11 +3059,63 @@ elf32_arm_find_nearest_line
   if (func == NULL)
     return FALSE;
 
-  *filename_ptr = filename;
-  *functionname_ptr = bfd_asymbol_name (func);
-  *line_ptr = 0;
+  if (filename_ptr)
+    *filename_ptr = filename;
+  if (functionname_ptr)
+    *functionname_ptr = bfd_asymbol_name (func);
 
   return TRUE;
+}  
+
+
+/* Find the nearest line to a particular section and offset, for error
+   reporting.   This code is a duplicate of the code in elf.c, except
+   that it uses arm_elf_find_function.  */
+
+static bfd_boolean
+elf32_arm_find_nearest_line (bfd *          abfd,
+                            asection *     section,
+                            asymbol **     symbols,
+                            bfd_vma        offset,
+                            const char **  filename_ptr,
+                            const char **  functionname_ptr,
+                            unsigned int * line_ptr)
+{
+  bfd_boolean found = FALSE;
+
+  /* We skip _bfd_dwarf1_find_nearest_line since no known ARM toolchain uses it.  */
+
+  if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
+                                    filename_ptr, functionname_ptr,
+                                    line_ptr, 0,
+                                    & elf_tdata (abfd)->dwarf2_find_line_info))
+    {
+      if (!*functionname_ptr)
+       arm_elf_find_function (abfd, section, symbols, offset,
+                              *filename_ptr ? NULL : filename_ptr,
+                              functionname_ptr);
+
+      return TRUE;
+    }
+
+  if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
+                                            & found, filename_ptr,
+                                            functionname_ptr, line_ptr,
+                                            & elf_tdata (abfd)->line_info))
+    return FALSE;
+
+  if (found && (*functionname_ptr || *line_ptr))
+    return TRUE;
+
+  if (symbols == NULL)
+    return FALSE;
+
+  if (! arm_elf_find_function (abfd, section, symbols, offset,
+                              filename_ptr, functionname_ptr))
+    return FALSE;
+
+  *line_ptr = 0;
+  return TRUE;
 }
 
 /* Adjust a symbol defined by a dynamic object and referenced by a
@@ -3239,9 +3125,8 @@ elf32_arm_find_nearest_line
    understand.  */
 
 static bfd_boolean
-elf32_arm_adjust_dynamic_symbol (info, h)
-     struct bfd_link_info * info;
-     struct elf_link_hash_entry * h;
+elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
+                                struct elf_link_hash_entry * h)
 {
   bfd * dynobj;
   asection * s;
@@ -3334,7 +3219,7 @@ elf32_arm_adjust_dynamic_symbol (info, h)
 
       srel = bfd_get_section_by_name (dynobj, ".rel.bss");
       BFD_ASSERT (srel != NULL);
-      srel->_raw_size += sizeof (Elf32_External_Rel);
+      srel->size += sizeof (Elf32_External_Rel);
       h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
     }
 
@@ -3345,8 +3230,7 @@ elf32_arm_adjust_dynamic_symbol (info, h)
     power_of_two = 3;
 
   /* Apply the required alignment.  */
-  s->_raw_size = BFD_ALIGN (s->_raw_size,
-                           (bfd_size_type) (1 << power_of_two));
+  s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
   if (power_of_two > bfd_get_section_alignment (dynobj, s))
     {
       if (! bfd_set_section_alignment (dynobj, s, power_of_two))
@@ -3355,10 +3239,10 @@ elf32_arm_adjust_dynamic_symbol (info, h)
 
   /* Define the symbol as being at this point in the section.  */
   h->root.u.def.section = s;
-  h->root.u.def.value = s->_raw_size;
+  h->root.u.def.value = s->size;
 
   /* Increment the section size to make room for the symbol.  */
-  s->_raw_size += h->size;
+  s->size += h->size;
 
   return TRUE;
 }
@@ -3367,9 +3251,7 @@ elf32_arm_adjust_dynamic_symbol (info, h)
    dynamic relocs.  */
 
 static bfd_boolean
-allocate_dynrelocs (h, inf)
-     struct elf_link_hash_entry *h;
-     PTR inf;
+allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
 {
   struct bfd_link_info *info;
   struct elf32_arm_link_hash_table *htab;
@@ -3407,10 +3289,10 @@ allocate_dynrelocs (h, inf)
 
          /* If this is the first .plt entry, make room for the special
             first entry.  */
-         if (s->_raw_size == 0)
-           s->_raw_size += PLT_HEADER_SIZE;
+         if (s->size == 0)
+           s->size += PLT_HEADER_SIZE;
 
-         h->plt.offset = s->_raw_size;
+         h->plt.offset = s->size;
 
          /* If this symbol is not defined in a regular file, and we are
             not generating a shared library, then set the symbol to this
@@ -3425,14 +3307,14 @@ allocate_dynrelocs (h, inf)
            }
 
          /* Make room for this entry.  */
-         s->_raw_size += PLT_ENTRY_SIZE;
+         s->size += PLT_ENTRY_SIZE;
 
          /* We also need to make an entry in the .got.plt section, which
             will be placed in the .got section by the linker script.  */
-         htab->sgotplt->_raw_size += 4;
+         htab->sgotplt->size += 4;
 
          /* We also need to make an entry in the .rel.plt section.  */
-         htab->srelplt->_raw_size += sizeof (Elf32_External_Rel);
+         htab->srelplt->size += sizeof (Elf32_External_Rel);
        }
       else
        {
@@ -3461,14 +3343,14 @@ allocate_dynrelocs (h, inf)
        }
 
       s = htab->sgot;
-      h->got.offset = s->_raw_size;
-      s->_raw_size += 4;
+      h->got.offset = s->size;
+      s->size += 4;
       dyn = htab->root.dynamic_sections_created;
       if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
           || h->root.type != bfd_link_hash_undefweak)
          && (info->shared
              || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
-       htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
+       htab->srelgot->size += sizeof (Elf32_External_Rel);
     }
   else
     h->got.offset = (bfd_vma) -1;
@@ -3528,7 +3410,7 @@ allocate_dynrelocs (h, inf)
   for (p = eh->relocs_copied; p != NULL; p = p->next)
     {
       asection *sreloc = elf_section_data (p->section)->sreloc;
-      sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel);
+      sreloc->size += p->count * sizeof (Elf32_External_Rel);
     }
 
   return TRUE;
@@ -3537,9 +3419,8 @@ allocate_dynrelocs (h, inf)
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
-elf32_arm_size_dynamic_sections (output_bfd, info)
-     bfd * output_bfd ATTRIBUTE_UNUSED;
-     struct bfd_link_info * info;
+elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
+                                struct bfd_link_info * info)
 {
   bfd * dynobj;
   asection * s;
@@ -3559,7 +3440,7 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
        {
          s = bfd_get_section_by_name (dynobj, ".interp");
          BFD_ASSERT (s != NULL);
-         s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+         s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
        }
     }
@@ -3598,7 +3479,7 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
              else if (p->count != 0)
                {
                  srel = elf_section_data (p->section)->sreloc;
-                 srel->_raw_size += p->count * sizeof (Elf32_External_Rel);
+                 srel->size += p->count * sizeof (Elf32_External_Rel);
                  if ((p->section->output_section->flags & SEC_READONLY) != 0)
                    info->flags |= DF_TEXTREL;
                }
@@ -3618,10 +3499,10 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
        {
          if (*local_got > 0)
            {
-             *local_got = s->_raw_size;
-             s->_raw_size += 4;
+             *local_got = s->size;
+             s->size += 4;
              if (info->shared)
-               srel->_raw_size += sizeof (Elf32_External_Rel);
+               srel->size += sizeof (Elf32_External_Rel);
            }
          else
            *local_got = (bfd_vma) -1;
@@ -3630,7 +3511,7 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
 
   /* Allocate global sym .plt and .got entries, and space for global
      sym dynamic relocs.  */
-  elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info);
+  elf_link_hash_traverse (& htab->root, allocate_dynrelocs, info);
 
   /* The check_relocs and adjust_dynamic_symbol entry points have
      determined the sizes of the various dynamic sections.  Allocate
@@ -3653,7 +3534,7 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
 
       if (strcmp (name, ".plt") == 0)
        {
-         if (s->_raw_size == 0)
+         if (s->size == 0)
            {
              /* Strip this section if we don't need it; see the
                  comment below.  */
@@ -3667,7 +3548,7 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
        }
       else if (strncmp (name, ".rel", 4) == 0)
        {
-         if (s->_raw_size == 0)
+         if (s->size == 0)
            {
              /* If we don't need this section, strip it from the
                 output file.  This is mostly to handle .rel.bss and
@@ -3705,8 +3586,8 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
        }
 
       /* Allocate memory for the section contents.  */
-      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
-      if (s->contents == NULL && s->_raw_size != 0)
+      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
+      if (s->contents == NULL && s->size != 0)
        return FALSE;
     }
 
@@ -3759,11 +3640,8 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
    dynamic sections here.  */
 
 static bfd_boolean
-elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
-     bfd * output_bfd;
-     struct bfd_link_info * info;
-     struct elf_link_hash_entry * h;
-     Elf_Internal_Sym * sym;
+elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
+                                struct elf_link_hash_entry * h, Elf_Internal_Sym * sym)
 {
   bfd * dynobj;
 
@@ -3830,7 +3708,7 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
                  (splt->output_section->vma
                   + splt->output_offset),
                  sgot->contents + got_offset);
-      
+
       /* Fill in the entry in the .rel.plt section.  */
       rel.r_offset = (sgot->output_section->vma
                      + sgot->output_offset
@@ -3927,9 +3805,7 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
 /* Finish up the dynamic sections.  */
 
 static bfd_boolean
-elf32_arm_finish_dynamic_sections (output_bfd, info)
-     bfd * output_bfd;
-     struct bfd_link_info * info;
+elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info)
 {
   bfd * dynobj;
   asection * sgot;
@@ -3950,7 +3826,7 @@ elf32_arm_finish_dynamic_sections (output_bfd, info)
       BFD_ASSERT (splt != NULL && sdyn != NULL);
 
       dyncon = (Elf32_External_Dyn *) sdyn->contents;
-      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
 
       for (; dyncon < dynconend; dyncon++)
        {
@@ -3980,10 +3856,7 @@ elf32_arm_finish_dynamic_sections (output_bfd, info)
            case DT_PLTRELSZ:
              s = bfd_get_section_by_name (output_bfd, ".rel.plt");
              BFD_ASSERT (s != NULL);
-             if (s->_cooked_size != 0)
-               dyn.d_un.d_val = s->_cooked_size;
-             else
-               dyn.d_un.d_val = s->_raw_size;
+             dyn.d_un.d_val = s->size;
              bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
              break;
 
@@ -3999,12 +3872,7 @@ elf32_arm_finish_dynamic_sections (output_bfd, info)
                 about changing the DT_REL entry.  */
              s = bfd_get_section_by_name (output_bfd, ".rel.plt");
              if (s != NULL)
-               {
-                 if (s->_cooked_size != 0)
-                   dyn.d_un.d_val -= s->_cooked_size;
-                 else
-                   dyn.d_un.d_val -= s->_raw_size;
-               }
+               dyn.d_un.d_val -= s->size;
              bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
              break;
 
@@ -4036,7 +3904,7 @@ elf32_arm_finish_dynamic_sections (output_bfd, info)
        }
 
       /* Fill in the first entry in the procedure linkage table.  */
-      if (splt->_raw_size > 0)
+      if (splt->size > 0)
        {
          bfd_vma got_displacement;
 
@@ -4066,7 +3934,7 @@ elf32_arm_finish_dynamic_sections (output_bfd, info)
     }
 
   /* Fill in the first three entries in the global offset table.  */
-  if (sgot->_raw_size > 0)
+  if (sgot->size > 0)
     {
       if (sdyn == NULL)
        bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
@@ -4084,9 +3952,7 @@ elf32_arm_finish_dynamic_sections (output_bfd, info)
 }
 
 static void
-elf32_arm_post_process_headers (abfd, link_info)
-     bfd * abfd;
-     struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
+elf32_arm_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATTRIBUTE_UNUSED)
 {
   Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form.  */
   struct elf32_arm_link_hash_table *globals;
@@ -4105,8 +3971,7 @@ elf32_arm_post_process_headers (abfd, link_info)
 }
 
 static enum elf_reloc_type_class
-elf32_arm_reloc_type_class (rela)
-     const Elf_Internal_Rela *rela;
+elf32_arm_reloc_type_class (const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -4121,15 +3986,13 @@ elf32_arm_reloc_type_class (rela)
     }
 }
 
-static bfd_boolean elf32_arm_section_flags           PARAMS ((flagword *, const Elf_Internal_Shdr *));
-static void        elf32_arm_final_write_processing  PARAMS ((bfd *, bfd_boolean));
+static bfd_boolean elf32_arm_section_flags           (flagword *, const Elf_Internal_Shdr *);
+static void        elf32_arm_final_write_processing  (bfd *, bfd_boolean);
 
 /* Set the right machine number for an Arm ELF file.  */
 
 static bfd_boolean
-elf32_arm_section_flags (flags, hdr)
-     flagword *flags;
-     const Elf_Internal_Shdr *hdr;
+elf32_arm_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr)
 {
   if (hdr->sh_type == SHT_NOTE)
     *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS;
@@ -4138,9 +4001,7 @@ elf32_arm_section_flags (flags, hdr)
 }
 
 static void
-elf32_arm_final_write_processing (abfd, linker)
-     bfd *abfd;
-     bfd_boolean linker ATTRIBUTE_UNUSED;
+elf32_arm_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
 {
   bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
 }
@@ -4170,11 +4031,7 @@ elf32_arm_output_symbol_hook (struct bfd_link_info *info,
     return TRUE;
 
   /* We only want mapping symbols.  */
-  if (name == NULL
-      || name[0] != '$'
-      || (name[1] != 'a'
-         && name[1] != 't'
-         && name[1] != 'd'))
+  if (! is_arm_mapping_symbol_name (name))
     return TRUE;
 
   mapcount = ++(elf32_arm_section_data (input_sec)->mapcount);
@@ -4183,7 +4040,7 @@ elf32_arm_output_symbol_hook (struct bfd_link_info *info,
      mapping symbols per section.  */
   map = bfd_realloc (map, mapcount * sizeof (elf32_arm_section_map));
   elf32_arm_section_data (input_sec)->map = map;
-  
+
   map[mapcount - 1].vma = elfsym->st_value;
   map[mapcount - 1].type = name[1];
   return TRUE;
@@ -4231,7 +4088,7 @@ elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec,
   bfd_vma offset;
   bfd_byte tmp;
   int i;
-  
+
   mapcount = elf32_arm_section_data (sec)->mapcount;
   map = elf32_arm_section_data (sec)->map;
 
@@ -4246,10 +4103,10 @@ elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec,
   for (i = 0; i < mapcount; i++)
     {
       if (i == mapcount - 1)
-       end = bfd_section_size (output_bfd, sec);
+       end = sec->size;
       else
        end = map[i + 1].vma - offset;
-      
+
       switch (map[i].type)
        {
        case 'a':
@@ -4335,4 +4192,3 @@ elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec,
 #define elf_backend_got_header_size    12
 
 #include "elf32-target.h"
-
This page took 0.060116 seconds and 4 git commands to generate.