bfd_asymbol_* macros
authorAlan Modra <amodra@gmail.com>
Wed, 18 Sep 2019 06:55:19 +0000 (16:25 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 18 Sep 2019 13:37:31 +0000 (23:07 +0930)
The main point of this patch is to give bfd_get_section a better name,
bfd_asymbol_section.

bfd/
* bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section.
(bfd_get_output_section): Delete.
(bfd_asymbol_base): Delete.
(bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy.
(bfd_set_asymbol_name): New macro.
* bfd-in2.h: Regenerate.
* aout-cris.c: Update throughout to use bfd_asymbol_section.
* aoutx.h: Likewise.
* cofflink.c: Likewise.
* dwarf2.c: Likewise.
* ecoff.c: Likewise.
* elf.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-mips.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elfn32-mips.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfxx-mips.c: Likewise.
* linker.c: Likewise.
* pdp11.c: Likewise.
* elf64-mmix.c (mmix_elf_reloc): Expand bfd_get_output_section.
binutils/
* nm.c: Update bfd_get_section to bfd_asymbol_section throughout.
* objcopy.c: Likewise.
* objdump.c: Likewise.
* rdcoff.c: Likewise.
* objcopy.c (create_new_symbol): Use bfd_set_asymbol_name.
(filter_symbols): Likewise.
gas/
* symbols.c (S_IS_LOCAL): Update bfd_get_section to
bfd_asymbol_section.
gdb/
* arm-tdep.c (arm_record_special_symbol): Update bfd_get_section
to bfd_asymbol_section.
ld/
* ldcref.c (check_reloc_refs): Update bfd_get_section to
bfd_asymbol_section.

30 files changed:
bfd/ChangeLog
bfd/aout-cris.c
bfd/aoutx.h
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/cofflink.c
bfd/dwarf2.c
bfd/ecoff.c
bfd/elf.c
bfd/elf32-arm.c
bfd/elf32-mips.c
bfd/elf32-score.c
bfd/elf32-score7.c
bfd/elf64-mmix.c
bfd/elfn32-mips.c
bfd/elfnn-aarch64.c
bfd/elfxx-mips.c
bfd/linker.c
bfd/pdp11.c
binutils/ChangeLog
binutils/nm.c
binutils/objcopy.c
binutils/objdump.c
binutils/rdcoff.c
gas/ChangeLog
gas/symbols.c
gdb/ChangeLog
gdb/arm-tdep.c
ld/ChangeLog
ld/ldcref.c

index 86ea499c0e9fb71d7381c87c09db02c826d920db..63f6c4c33ff98be15fe1ced8aea49fdfb3a7e187 100644 (file)
@@ -1,3 +1,29 @@
+2019-09-18  Alan Modra  <amodra@gmail.com>
+
+       * bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section.
+       (bfd_get_output_section): Delete.
+       (bfd_asymbol_base): Delete.
+       (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
+       (bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy.
+       (bfd_set_asymbol_name): New macro.
+       * bfd-in2.h: Regenerate.
+       * aout-cris.c: Update throughout to use bfd_asymbol_section.
+       * aoutx.h: Likewise.
+       * cofflink.c: Likewise.
+       * dwarf2.c: Likewise.
+       * ecoff.c: Likewise.
+       * elf.c: Likewise.
+       * elf32-arm.c: Likewise.
+       * elf32-mips.c: Likewise.
+       * elf32-score.c: Likewise.
+       * elf32-score7.c: Likewise.
+       * elfn32-mips.c: Likewise.
+       * elfnn-aarch64.c: Likewise.
+       * elfxx-mips.c: Likewise.
+       * linker.c: Likewise.
+       * pdp11.c: Likewise.
+       * elf64-mmix.c (mmix_elf_reloc): Part expand bfd_get_output_section.
+
 2019-09-18  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * Makefile.in: Re-generate.
index feed5ed585e1553b091b66a0ee5a0f5c9676f32d..31b003520dc9d6e31105eea2da8206c4f1f6c396 100644 (file)
@@ -169,14 +169,14 @@ MY (swap_ext_reloc_out) (bfd *abfd,
      from the abs section, or as a symbol which has an abs value.
      check for that here.  */
 
-  if (bfd_is_abs_section (bfd_get_section (sym)))
+  if (bfd_is_abs_section (bfd_asymbol_section (sym)))
     {
       r_extern = 0;
       r_index = N_ABS;
     }
   else if ((sym->flags & BSF_SECTION_SYM) == 0)
     {
-      if (bfd_is_und_section (bfd_get_section (sym))
+      if (bfd_is_und_section (bfd_asymbol_section (sym))
          /* Remember to check for weak symbols; they count as global.  */
          || (sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
        r_extern = 1;
index cd50b44e60af2fce7c4edb580a25216625e59697..859153be1000fdbae96d595f2b7eb5013e020214 100644 (file)
@@ -1570,7 +1570,7 @@ translate_to_native_sym_flags (bfd *abfd,
      to another.  */
   sym_pointer->e_type[0] &= ~N_TYPE;
 
-  sec = bfd_get_section (cache_ptr);
+  sec = bfd_asymbol_section (cache_ptr);
   off = 0;
 
   if (sec == NULL)
@@ -2064,14 +2064,14 @@ NAME (aout, swap_ext_reloc_out) (bfd *abfd,
      Absolute symbols can come in in two ways, either as an offset
      from the abs section, or as a symbol which has an abs value.
      check for that here.  */
-  if (bfd_is_abs_section (bfd_get_section (sym)))
+  if (bfd_is_abs_section (bfd_asymbol_section (sym)))
     {
       r_extern = 0;
       r_index = N_ABS;
     }
   else if ((sym->flags & BSF_SECTION_SYM) == 0)
     {
-      if (bfd_is_und_section (bfd_get_section (sym))
+      if (bfd_is_und_section (bfd_asymbol_section (sym))
          || (sym->flags & BSF_GLOBAL) != 0)
        r_extern = 1;
       else
index 6c72acb705944e0ff70bbe14c3ed169f766ebc3c..5a303443501902af4c0e016d351e8234fb9795a6 100644 (file)
@@ -240,18 +240,15 @@ typedef unsigned long symindex;
 /* General purpose part of a symbol X;
    target specific parts are in libcoff.h, libaout.h, etc.  */
 
-#define bfd_get_section(x) ((x)->section)
-#define bfd_get_output_section(x) ((x)->section->output_section)
-#define bfd_set_section(x,y) ((x)->section) = (y)
-#define bfd_asymbol_base(x) ((x)->section->vma)
-#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
-#define bfd_asymbol_name(x) ((x)->name)
-/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
-#define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x)                 \
-  (((x)->flags & BSF_SYNTHETIC) != 0           \
+#define bfd_asymbol_section(sy) ((sy)->section)
+#define bfd_asymbol_value(sy) ((sy)->section->vma + (sy)->value)
+#define bfd_asymbol_name(sy) ((sy)->name)
+#define bfd_asymbol_bfd(sy) ((sy)->the_bfd)
+#define bfd_asymbol_flavour(sy)                        \
+  (((sy)->flags & BSF_SYNTHETIC) != 0          \
    ? bfd_target_unknown_flavour                        \
-   : bfd_asymbol_bfd (x)->xvec->flavour)
+   : (sy)->the_bfd->xvec->flavour)
+#define bfd_set_asymbol_name(sy, n) do { (sy)->name = (n); } while (0)
 
 /* A canonical archive symbol.  */
 /* This is a type pun with struct ranlib on purpose!  */
index aec2143ea605ef85251d2c5f2fb20b66be14b39e..6542d403e06ddd79659b08e3b177ba393cfdf95a 100644 (file)
@@ -247,18 +247,15 @@ typedef unsigned long symindex;
 /* General purpose part of a symbol X;
    target specific parts are in libcoff.h, libaout.h, etc.  */
 
-#define bfd_get_section(x) ((x)->section)
-#define bfd_get_output_section(x) ((x)->section->output_section)
-#define bfd_set_section(x,y) ((x)->section) = (y)
-#define bfd_asymbol_base(x) ((x)->section->vma)
-#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
-#define bfd_asymbol_name(x) ((x)->name)
-/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
-#define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x)                 \
-  (((x)->flags & BSF_SYNTHETIC) != 0           \
+#define bfd_asymbol_section(sy) ((sy)->section)
+#define bfd_asymbol_value(sy) ((sy)->section->vma + (sy)->value)
+#define bfd_asymbol_name(sy) ((sy)->name)
+#define bfd_asymbol_bfd(sy) ((sy)->the_bfd)
+#define bfd_asymbol_flavour(sy)                        \
+  (((sy)->flags & BSF_SYNTHETIC) != 0          \
    ? bfd_target_unknown_flavour                        \
-   : bfd_asymbol_bfd (x)->xvec->flavour)
+   : (sy)->the_bfd->xvec->flavour)
+#define bfd_set_asymbol_name(sy, n) do { (sy)->name = (n); } while (0)
 
 /* A canonical archive symbol.  */
 /* This is a type pun with struct ranlib on purpose!  */
index 34d68c93b5da2525cd509c6d07f8d9e814b46d4b..7bcc1ca77da436f38ce46a3606605e8f0374bac9 100644 (file)
@@ -902,7 +902,7 @@ _bfd_coff_final_link (bfd *abfd,
                                        bfd_asymbol_name(sym), FALSE, FALSE)
                       == NULL))
                  || (((flaginfo.info->discard == discard_sec_merge
-                       && (bfd_get_section (sym)->flags & SEC_MERGE)
+                       && (bfd_asymbol_section (sym)->flags & SEC_MERGE)
                        && ! bfd_link_relocatable (flaginfo.info))
                       || flaginfo.info->discard == discard_l)
                      && bfd_is_local_label_name (sub, bfd_asymbol_name(sym))))
index ed6dcd48c7f8aefb8f415d84c38f85f850181c61..575b082e1dcbff689f04d1bfca84f63b2e45f7b6 100644 (file)
@@ -2736,7 +2736,7 @@ lookup_symbol_in_function_table (struct comp_unit *unit,
   bfd_vma best_fit_len = 0;
   struct arange *arange;
   const char *name = bfd_asymbol_name (sym);
-  asection *sec = bfd_get_section (sym);
+  asection *sec = bfd_asymbol_section (sym);
 
   for (each_func = unit->function_table;
        each_func;
@@ -2784,7 +2784,7 @@ lookup_symbol_in_variable_table (struct comp_unit *unit,
                                 unsigned int *linenumber_ptr)
 {
   const char *name = bfd_asymbol_name (sym);
-  asection *sec = bfd_get_section (sym);
+  asection *sec = bfd_asymbol_section (sym);
   struct varinfo* each;
 
   for (each = unit->variable_table; each; each = each->prev_var)
@@ -4048,7 +4048,7 @@ info_hash_lookup_funcinfo (struct info_hash_table *hash_table,
   struct info_list_node *node;
   struct arange *arange;
   const char *name = bfd_asymbol_name (sym);
-  asection *sec = bfd_get_section (sym);
+  asection *sec = bfd_asymbol_section (sym);
 
   for (node = lookup_info_hash_table (hash_table, name);
        node;
@@ -4096,7 +4096,7 @@ info_hash_lookup_varinfo (struct info_hash_table *hash_table,
                          unsigned int *linenumber_ptr)
 {
   const char *name = bfd_asymbol_name (sym);
-  asection *sec = bfd_get_section (sym);
+  asection *sec = bfd_asymbol_section (sym);
   struct varinfo* each;
   struct info_list_node *node;
 
@@ -4695,7 +4695,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
   if (do_line)
     {
       BFD_ASSERT (section == NULL && offset == 0 && functionname_ptr == NULL);
-      section = bfd_get_section (symbol);
+      section = bfd_asymbol_section (symbol);
       addr = symbol->value;
     }
   else
index 1e6f4d219cde7bc8056fc49109856c9114198fcd..c06fa5ec7f99eddf53c84a05f39b5e5a0624d915 100644 (file)
@@ -2312,7 +2312,7 @@ ecoff_get_extr (asymbol *sym, EXTR *esym)
      symbol.  */
   if ((esym->asym.sc == scUndefined
        || esym->asym.sc == scSUndefined)
-      && ! bfd_is_und_section (bfd_get_section (sym)))
+      && ! bfd_is_und_section (bfd_asymbol_section (sym)))
     esym->asym.sc = scAbs;
 
   /* Adjust the FDR index for the symbol by that used for the input
@@ -2719,7 +2719,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
                    { _RCONST, RELOC_SECTION_RCONST }
                  };
 
-                 name = bfd_get_section_name (abfd, bfd_get_section (sym));
+                 name = bfd_get_section_name (abfd, bfd_asymbol_section (sym));
 
                  for (j = 0; j < ARRAY_SIZE (section_symndx); j++)
                    if (streq (name, section_symndx[j].name))
index ecd348e1a5093bf32ce6daa51c054705350dacc2..1a1eed908573d1b616cd20083289fd9a8c16a217 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4057,8 +4057,8 @@ sym_is_global (bfd *abfd, asymbol *sym)
     return (*bed->elf_backend_sym_is_global) (abfd, sym);
 
   return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0
-         || bfd_is_und_section (bfd_get_section (sym))
-         || bfd_is_com_section (bfd_get_section (sym)));
+         || bfd_is_und_section (bfd_asymbol_section (sym))
+         || bfd_is_com_section (bfd_asymbol_section (sym)));
 }
 
 /* Filter global symbols of ABFD to include in the import library.  All
index b675fc60c1ac82393a1cb05e67a3f4ec2c4b84cc..e29a60abf19557f12834a4a3d98d4e44074f6e56 100644 (file)
@@ -16076,7 +16076,7 @@ arm_elf_find_function (bfd *         abfd,
                    BFD_ARM_SPECIAL_SYM_TYPE_ANY))
            continue;
          /* Fall through.  */
-         if (bfd_get_section (&q->symbol) == section
+         if (bfd_asymbol_section (&q->symbol) == section
              && q->symbol.value >= low_func
              && q->symbol.value <= offset)
            {
index 9f8f2bdc260d3131b85bbfeb97cc03cc6ff79066..74300a11e95698a2ec7fe6200c0721b9c2339e23 100644 (file)
@@ -2281,8 +2281,8 @@ mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
     return (sym->flags & BSF_SECTION_SYM) == 0;
   else
     return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0
-           || bfd_is_und_section (bfd_get_section (sym))
-           || bfd_is_com_section (bfd_get_section (sym)));
+           || bfd_is_und_section (bfd_asymbol_section (sym))
+           || bfd_is_com_section (bfd_asymbol_section (sym)));
 }
 \f
 /* Set the right machine number for a MIPS ELF file.  */
index 6390309f52cbec727a3b18eca7c255cb16fd08d5..1bbf64fe6dc6b537a479df4555d2c6a63dd547d5 100644 (file)
@@ -596,8 +596,8 @@ score_elf_got15_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
                       bfd *output_bfd, char **error_message)
 {
   if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
-      || bfd_is_und_section (bfd_get_section (symbol))
-      || bfd_is_com_section (bfd_get_section (symbol)))
+      || bfd_is_und_section (bfd_asymbol_section (symbol))
+      || bfd_is_com_section (bfd_asymbol_section (symbol)))
     /* The relocation is against a global symbol.  */
     return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
                                  input_section, output_bfd,
index ea0ccd04e9e65003de0d04951da91ce250fcfb9c..51a5fb106d7559c46660dfa9e8b72cf052c07391 100644 (file)
@@ -497,8 +497,8 @@ score_elf_got15_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
                       bfd *output_bfd, char **error_message)
 {
   if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
-      || bfd_is_und_section (bfd_get_section (symbol))
-      || bfd_is_com_section (bfd_get_section (symbol)))
+      || bfd_is_und_section (bfd_asymbol_section (symbol))
+      || bfd_is_com_section (bfd_asymbol_section (symbol)))
     /* The relocation is against a global symbol.  */
     return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
                                  input_section, output_bfd,
index 839bd45b4a6715198976afaa448f4d16c0359e74..18ed456c2bf27d48e9458f8aaf4499054a3f672d 100644 (file)
@@ -1315,7 +1315,7 @@ mmix_elf_reloc (bfd *abfd,
   else
     relocation = symbol->value;
 
-  reloc_target_output_section = bfd_get_output_section (symbol);
+  reloc_target_output_section = bfd_asymbol_section (symbol)->output_section;
 
   /* Here the variable relocation holds the final address of the symbol we
      are relocating against, plus any addend.  */
index 58d66ce63cd4940a33f55e783a0435830c4f926b..8927e9825bde7483c07532c0062f087877d5a47c 100644 (file)
@@ -3841,8 +3841,8 @@ mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
     return (sym->flags & BSF_SECTION_SYM) == 0;
   else
     return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0
-           || bfd_is_und_section (bfd_get_section (sym))
-           || bfd_is_com_section (bfd_get_section (sym)));
+           || bfd_is_und_section (bfd_asymbol_section (sym))
+           || bfd_is_com_section (bfd_asymbol_section (sym)));
 }
 \f
 /* Set the right machine number for a MIPS ELF file.  */
index fd44505da4a0ae43537a5bf2a5aaa4522f860687..7132b6bc7330c0d5d0cdeac1bd11c0817cdac245 100644 (file)
@@ -8042,7 +8042,7 @@ aarch64_elf_find_function (bfd *          abfd,
                  (q->symbol.name, BFD_AARCH64_SPECIAL_SYM_TYPE_ANY)))
            continue;
          /* Fall through.  */
-         if (bfd_get_section (&q->symbol) == section
+         if (bfd_asymbol_section (&q->symbol) == section
              && q->symbol.value >= low_func && q->symbol.value <= offset)
            {
              func = (asymbol *) q;
index e3054043df3b3a2ad73a72af1efbc4783ca7a0f3..8ad5268520b9b1cb3ea5fcce1049602e3dffa19b 100644 (file)
@@ -2531,8 +2531,8 @@ _bfd_mips_elf_got16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
                           bfd *output_bfd, char **error_message)
 {
   if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
-      || bfd_is_und_section (bfd_get_section (symbol))
-      || bfd_is_com_section (bfd_get_section (symbol)))
+      || bfd_is_und_section (bfd_asymbol_section (symbol))
+      || bfd_is_com_section (bfd_asymbol_section (symbol)))
     /* The relocation is against a global symbol.  */
     return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
                                        input_section, output_bfd,
index 8aec0d23588d2934111bfc733fcc6177e77e4ac3..2518371f247e2f81c3cd09a29414d8d7bc704c03 100644 (file)
@@ -1163,9 +1163,9 @@ generic_link_add_symbol_list (bfd *abfd,
                       | BSF_GLOBAL
                       | BSF_CONSTRUCTOR
                       | BSF_WEAK)) != 0
-         || bfd_is_und_section (bfd_get_section (p))
-         || bfd_is_com_section (bfd_get_section (p))
-         || bfd_is_ind_section (bfd_get_section (p)))
+         || bfd_is_und_section (bfd_asymbol_section (p))
+         || bfd_is_com_section (bfd_asymbol_section (p))
+         || bfd_is_ind_section (bfd_asymbol_section (p)))
        {
          const char *name;
          const char *string;
@@ -1191,7 +1191,7 @@ generic_link_add_symbol_list (bfd *abfd,
 
          bh = NULL;
          if (! (_bfd_generic_link_add_one_symbol
-                (info, abfd, name, p->flags, bfd_get_section (p),
+                (info, abfd, name, p->flags, bfd_asymbol_section (p),
                  p->value, string, FALSE, FALSE, &bh)))
            return FALSE;
          h = (struct generic_link_hash_entry *) bh;
@@ -1218,15 +1218,15 @@ generic_link_add_symbol_list (bfd *abfd,
          if (info->output_bfd->xvec == abfd->xvec)
            {
              if (h->sym == NULL
-                 || (! bfd_is_und_section (bfd_get_section (p))
-                     && (! bfd_is_com_section (bfd_get_section (p))
-                         || bfd_is_und_section (bfd_get_section (h->sym)))))
+                 || (! bfd_is_und_section (bfd_asymbol_section (p))
+                     && (! bfd_is_com_section (bfd_asymbol_section (p))
+                         || bfd_is_und_section (bfd_asymbol_section (h->sym)))))
                {
                  h->sym = p;
                  /* BSF_OLD_COMMON is a hack to support COFF reloc
                     reading, and it should go away when the COFF
                     linker is switched to the new version.  */
-                 if (bfd_is_com_section (bfd_get_section (p)))
+                 if (bfd_is_com_section (bfd_asymbol_section (p)))
                    p->flags |= BSF_OLD_COMMON;
                }
            }
@@ -2026,9 +2026,9 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
                         | BSF_GLOBAL
                         | BSF_CONSTRUCTOR
                         | BSF_WEAK)) != 0
-         || bfd_is_und_section (bfd_get_section (sym))
-         || bfd_is_com_section (bfd_get_section (sym))
-         || bfd_is_ind_section (bfd_get_section (sym)))
+         || bfd_is_und_section (bfd_asymbol_section (sym))
+         || bfd_is_com_section (bfd_asymbol_section (sym))
+         || bfd_is_ind_section (bfd_asymbol_section (sym)))
        {
          if (sym->udata.p != NULL)
            h = (struct generic_link_hash_entry *) sym->udata.p;
@@ -2044,7 +2044,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
                 the relocs in the output format being used.  */
              h = NULL;
            }
-         else if (bfd_is_und_section (bfd_get_section (sym)))
+         else if (bfd_is_und_section (bfd_asymbol_section (sym)))
            h = ((struct generic_link_hash_entry *)
                 bfd_wrapped_link_hash_lookup (output_bfd, info,
                                               bfd_asymbol_name (sym),
@@ -2601,15 +2601,15 @@ default_indirect_link_order (bfd *output_bfd,
                             | BSF_GLOBAL
                             | BSF_CONSTRUCTOR
                             | BSF_WEAK)) != 0
-             || bfd_is_und_section (bfd_get_section (sym))
-             || bfd_is_com_section (bfd_get_section (sym))
-             || bfd_is_ind_section (bfd_get_section (sym)))
+             || bfd_is_und_section (bfd_asymbol_section (sym))
+             || bfd_is_com_section (bfd_asymbol_section (sym))
+             || bfd_is_ind_section (bfd_asymbol_section (sym)))
            {
              /* sym->udata may have been set by
                 generic_link_add_symbol_list.  */
              if (sym->udata.p != NULL)
                h = (struct bfd_link_hash_entry *) sym->udata.p;
-             else if (bfd_is_und_section (bfd_get_section (sym)))
+             else if (bfd_is_und_section (bfd_asymbol_section (sym)))
                h = bfd_wrapped_link_hash_lookup (output_bfd, info,
                                                  bfd_asymbol_name (sym),
                                                  FALSE, FALSE, TRUE);
index f7f31284095a8cc7b2595d5e2dc7235c0d8bb3df..238f5144d4cb3c089535cd78c0fb32aa9594fea2 100644 (file)
@@ -1352,7 +1352,7 @@ translate_to_native_sym_flags (bfd *abfd,
      to another.  */
   sym_pointer->e_type[0] &= ~N_TYPE;
 
-  sec = bfd_get_section (cache_ptr);
+  sec = bfd_asymbol_section (cache_ptr);
   off = 0;
 
   if (sec == NULL)
index c26d2789fdbe9a4ae3b2264c5e08d34782b80f7b..9c791f6d6565ca7321e40c45f54d6f43eff4ec59 100644 (file)
@@ -1,3 +1,12 @@
+2019-09-18  Alan Modra  <amodra@gmail.com>
+
+       * nm.c: Update bfd_get_section to bfd_asymbol_section throughout.
+       * objcopy.c: Likewise.
+       * objdump.c: Likewise.
+       * rdcoff.c: Likewise.
+       * objcopy.c (create_new_symbol): Use bfd_set_asymbol_name.
+       (filter_symbols): Likewise.
+
 2019-09-18  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * doc/Makefile.am (MOSTLYCLEANFILES): Clean all man pages,
index 67b7ac7b1252024b206429f21c6586c4e7e3f758..0bded073912680c0965409b43316c320b717061d 100644 (file)
@@ -592,8 +592,8 @@ numeric_forward (const void *P_x, const void *P_y)
   if (x == NULL || y == NULL)
     bfd_fatal (bfd_get_filename (sort_bfd));
 
-  xs = bfd_get_section (x);
-  ys = bfd_get_section (y);
+  xs = bfd_asymbol_section (x);
+  ys = bfd_asymbol_section (y);
 
   if (bfd_is_und_section (xs))
     {
@@ -645,8 +645,8 @@ size_forward1 (const void *P_x, const void *P_y)
   if (x == NULL || y == NULL)
     bfd_fatal (bfd_get_filename (sort_bfd));
 
-  xs = bfd_get_section (x);
-  ys = bfd_get_section (y);
+  xs = bfd_asymbol_section (x);
+  ys = bfd_asymbol_section (y);
 
   if (bfd_is_und_section (xs))
     abort ();
@@ -774,7 +774,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
       else
        next = NULL;
 
-      sec = bfd_get_section (sym);
+      sec = bfd_asymbol_section (sym);
 
       /* Synthetic symbols don't have a full type set of data available, thus
         we can't rely on that information for the symbol size.  Ditto for
@@ -788,7 +788,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
       else
        {
          if (from + size < fromend
-             && sec == bfd_get_section (next))
+             && sec == bfd_asymbol_section (next))
            sz = valueof (next) - valueof (sym);
          else
            sz = (bfd_get_section_vma (abfd, sec)
@@ -895,7 +895,7 @@ print_symbol (bfd *        abfd,
       if ((sym->flags & (BSF_SECTION_SYM | BSF_SYNTHETIC)) == 0)
        version_string = bfd_get_symbol_version_string (abfd, sym, &hidden);
 
-      if (bfd_is_und_section (bfd_get_section (sym)))
+      if (bfd_is_und_section (bfd_asymbol_section (sym)))
        hidden = TRUE;
 
       if (version_string && *version_string != '\0')
@@ -931,7 +931,7 @@ print_symbol (bfd *        abfd,
          lineno_cache_bfd = abfd;
        }
 
-      if (bfd_is_und_section (bfd_get_section (sym)))
+      if (bfd_is_und_section (bfd_asymbol_section (sym)))
        {
          static asection **secs;
          static arelent ***relocs;
@@ -1001,10 +1001,10 @@ print_symbol (bfd *        abfd,
                }
            }
        }
-      else if (bfd_get_section (sym)->owner == abfd)
+      else if (bfd_asymbol_section (sym)->owner == abfd)
        {
          if ((bfd_find_line (abfd, syms, sym, &filename, &lineno)
-              || bfd_find_nearest_line (abfd, bfd_get_section (sym),
+              || bfd_find_nearest_line (abfd, bfd_asymbol_section (sym),
                                         syms, sym->value, &filename,
                                         &functionname, &lineno))
              && filename != NULL
index ebb99339aaa8023ca360e566be8a994947e6ea49..ce4a4afa55c6fb49d9530319c00b4821fa5affc9 100644 (file)
@@ -1465,7 +1465,7 @@ create_new_symbol (struct addsym_node *ptr, bfd *obfd)
 {
   asymbol *sym = bfd_make_empty_symbol (obfd);
 
-  bfd_asymbol_name (sym) = ptr->symdef;
+  bfd_set_asymbol_name (sym, ptr->symdef);
   sym->value = ptr->symval;
   sym->flags = ptr->flags;
   if (ptr->section)
@@ -1503,7 +1503,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
       bfd_boolean rem_leading_char;
       bfd_boolean add_leading_char;
 
-      undefined = bfd_is_und_section (bfd_get_section (sym));
+      undefined = bfd_is_und_section (bfd_asymbol_section (sym));
 
       if (add_sym_list)
        {
@@ -1521,7 +1521,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
          if (new_name == name
              && (flags & BSF_SECTION_SYM) != 0)
            new_name = (char *) find_section_rename (name, NULL);
-         bfd_asymbol_name (sym) = new_name;
+         bfd_set_asymbol_name (sym, new_name);
          name = new_name;
        }
 
@@ -1532,7 +1532,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
            || (remove_leading_char
                && ((flags & (BSF_GLOBAL | BSF_WEAK)) != 0
                    || undefined
-                   || bfd_is_com_section (bfd_get_section (sym)))));
+                   || bfd_is_com_section (bfd_asymbol_section (sym)))));
 
       /* Check if we will add a new leading character.  */
       add_leading_char =
@@ -1545,14 +1545,14 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
       if (rem_leading_char && add_leading_char && !prefix_symbols_string)
        {
          name[0] = bfd_get_symbol_leading_char (obfd);
-         bfd_asymbol_name (sym) = name;
+         bfd_set_asymbol_name (sym, name);
          rem_leading_char = FALSE;
          add_leading_char = FALSE;
        }
 
       /* Remove leading char.  */
       if (rem_leading_char)
-       bfd_asymbol_name (sym) = ++name;
+       bfd_set_asymbol_name (sym, ++name);
 
       /* Add new leading char and/or prefix.  */
       if (add_leading_char || prefix_symbols_string)
@@ -1571,7 +1571,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
            }
 
          strcpy (ptr, name);
-         bfd_asymbol_name (sym) = n;
+         bfd_set_asymbol_name (sym, n);
          name = n;
        }
 
@@ -1579,7 +1579,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
        keep = FALSE;
       else if ((flags & BSF_KEEP) != 0         /* Used in relocation.  */
               || ((flags & BSF_SECTION_SYM) != 0
-                  && ((*bfd_get_section (sym)->symbol_ptr_ptr)->flags
+                  && ((*bfd_asymbol_section (sym)->symbol_ptr_ptr)->flags
                       & BSF_KEEP) != 0))
        {
          keep = TRUE;
@@ -1587,7 +1587,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
        }
       else if (relocatable                     /* Relocatable file.  */
               && ((flags & (BSF_GLOBAL | BSF_WEAK)) != 0
-                  || bfd_is_com_section (bfd_get_section (sym))))
+                  || bfd_is_com_section (bfd_asymbol_section (sym))))
        keep = TRUE;
       else if (bfd_decode_symclass (sym) == 'I')
        /* Global symbols in $idata sections need to be retained
@@ -1598,13 +1598,13 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
       else if ((flags & BSF_GLOBAL) != 0       /* Global symbol.  */
               || (flags & BSF_WEAK) != 0
               || undefined
-              || bfd_is_com_section (bfd_get_section (sym)))
+              || bfd_is_com_section (bfd_asymbol_section (sym)))
        keep = strip_symbols != STRIP_UNNEEDED;
       else if ((flags & BSF_DEBUGGING) != 0)   /* Debugging symbol.  */
        keep = (strip_symbols != STRIP_DEBUG
                && strip_symbols != STRIP_UNNEEDED
                && ! convert_debugging);
-      else if (bfd_coff_get_comdat_section (abfd, bfd_get_section (sym)))
+      else if (bfd_coff_get_comdat_section (abfd, bfd_asymbol_section (sym)))
        /* COMDAT sections store special information in local
           symbols, so we cannot risk stripping any of them.  */
        keep = TRUE;
@@ -1637,7 +1637,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
              || is_specified_symbol (name, keep_specific_htab)))
        keep = TRUE;
 
-      if (keep && is_strip_section (abfd, bfd_get_section (sym)))
+      if (keep && is_strip_section (abfd, bfd_asymbol_section (sym)))
        keep = FALSE;
 
       if (keep)
index 00541cbec5ffbca109751d7d851ca0780b86f8eb..4a7c8f9a74bf0518bfcb5e5c72a2c53e8bb4eeb5 100644 (file)
@@ -995,7 +995,7 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *inf,
   if ((sym->flags & (BSF_SECTION_SYM | BSF_SYNTHETIC)) == 0)
     version_string = bfd_get_symbol_version_string (abfd, sym, &hidden);
 
-  if (bfd_is_und_section (bfd_get_section (sym)))
+  if (bfd_is_und_section (bfd_asymbol_section (sym)))
     hidden = TRUE;
 
   name = sanitize_string (name);
@@ -1351,7 +1351,7 @@ objdump_print_addr (bfd_vma vma,
       /* Adjust the vma to the reloc.  */
       vma += bfd_asymbol_value (sym);
 
-      if (bfd_is_und_section (bfd_get_section (sym)))
+      if (bfd_is_und_section (bfd_asymbol_section (sym)))
        skip_find = TRUE;
     }
 
@@ -2234,7 +2234,7 @@ disassemble_bytes (struct disassemble_info * inf,
                    {
                      asection *sym_sec;
 
-                     sym_sec = bfd_get_section (*q->sym_ptr_ptr);
+                     sym_sec = bfd_asymbol_section (*q->sym_ptr_ptr);
                      sym_name = bfd_get_section_name (aux->abfd, sym_sec);
                      if (sym_name == NULL || *sym_name == '\0')
                        sym_name = "*unknown*";
index 7e585691eb6e13194fd14a303d1c464a3fabf8dd..cbb5db1b94bf6f83883856a78aeba0bfa56d08b8 100644 (file)
@@ -816,7 +816,7 @@ parse_coff (bfd *abfd, asymbol **syms, long symcount, void *dhandle)
                  else
                    base = auxent.x_sym.x_misc.x_lnsz.x_lnno - 1;
 
-                 addr = bfd_get_section_vma (abfd, bfd_get_section (sym));
+                 addr = bfd_get_section_vma (abfd, bfd_asymbol_section (sym));
 
                  ++linenos;
 
index 673501779213371916819d52611aa21b0d52e720..3d61530a9b372297dad4d3007cf72a38b2a44865 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-18  Alan Modra  <amodra@gmail.com>
+
+       * symbols.c (S_IS_LOCAL): Update bfd_get_section to
+       bfd_asymbol_section.
+
 2019-09-18  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * Makefile.in: Re-generate.
index 918028f87505ee84ad6d27e87bd9f1797297ebe8..34ec145ad0426c0deacf9b06079516a07778bd31 100644 (file)
@@ -2310,14 +2310,14 @@ S_IS_LOCAL (symbolS *s)
   if ((flags & BSF_LOCAL) && (flags & BSF_GLOBAL))
     abort ();
 
-  if (bfd_get_section (s->bsym) == reg_section)
+  if (bfd_asymbol_section (s->bsym) == reg_section)
     return 1;
 
   if (flag_strip_local_absolute
       /* Keep BSF_FILE symbols in order to allow debuggers to identify
         the source file even when the object file is stripped.  */
       && (flags & (BSF_GLOBAL | BSF_FILE)) == 0
-      && bfd_get_section (s->bsym) == absolute_section)
+      && bfd_asymbol_section (s->bsym) == absolute_section)
     return 1;
 
   name = S_GET_NAME (s);
index 5e0e37bcfaff2e362ebf4ee8dc657c9ea3b9383f..421b26a004f5316c5989459af26b781ffb521ae1 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-18  Alan Modra  <amodra@gmail.com>
+
+       * arm-tdep.c (arm_record_special_symbol): Update bfd_get_section
+       to bfd_asymbol_section.
+
 2019-09-18  Alan Modra  <amodra@gmail.com>
 
        * amd64-dicos-tdep.c (amd64_dicos_osabi_sniffer): Constify target.
index 0650485bf04e6ee81c930babd9a1ff07e140a35a..5c494c8ed2850bd615b44b165351724dd6155d81 100644 (file)
@@ -8575,7 +8575,7 @@ arm_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile,
     data = arm_objfile_data_key.emplace (objfile,
                                         objfile->obfd->section_count);
   arm_mapping_symbol_vec &map
-    = data->section_maps[bfd_get_section (sym)->index];
+    = data->section_maps[bfd_asymbol_section (sym)->index];
 
   new_map_sym.value = sym->value;
   new_map_sym.type = name[1];
index b6ac44e1f8bda8f7f40d339c2fe1519b0ccaf0ff..e8f9ed736590ab51ffb0584d036e33af1efaf89d 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-18  Alan Modra  <amodra@gmail.com>
+
+       * ldcref.c (check_reloc_refs): Update bfd_get_section to
+       bfd_asymbol_section.
+
 2019-09-18  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * Makefile.in: Re-generate.
index 12cb2942e6ec49531505ef4dd70143f9758242a7..fff852a89ab9fd3f09f693b114bbacf495cb044d 100644 (file)
@@ -705,14 +705,14 @@ check_reloc_refs (bfd *abfd, asection *sec, void *iarg)
       if (q->sym_ptr_ptr != NULL
          && *q->sym_ptr_ptr != NULL
          && ((global
-              && (bfd_is_und_section (bfd_get_section (*q->sym_ptr_ptr))
-                  || bfd_is_com_section (bfd_get_section (*q->sym_ptr_ptr))
+              && (bfd_is_und_section (bfd_asymbol_section (*q->sym_ptr_ptr))
+                  || bfd_is_com_section (bfd_asymbol_section (*q->sym_ptr_ptr))
                   || ((*q->sym_ptr_ptr)->flags & (BSF_GLOBAL
                                                   | BSF_WEAK)) != 0))
              || (!global
                  && ((*q->sym_ptr_ptr)->flags & (BSF_LOCAL
                                                  | BSF_SECTION_SYM)) != 0
-                 && bfd_get_section (*q->sym_ptr_ptr) == info->defsec))
+                 && bfd_asymbol_section (*q->sym_ptr_ptr) == info->defsec))
          && (symname != NULL
              ? strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), symname) == 0
              : ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0))
This page took 0.065777 seconds and 4 git commands to generate.