Replace all uses of bfd_abs_section, bfd_com_section, bfd_und_section
authorAlan Modra <amodra@gmail.com>
Sat, 5 May 2012 03:05:32 +0000 (03:05 +0000)
committerAlan Modra <amodra@gmail.com>
Sat, 5 May 2012 03:05:32 +0000 (03:05 +0000)
and bfd_ind_section with their _ptr variants, or use corresponding
bfd_is_* macros.

35 files changed:
bfd/ChangeLog
bfd/aout-arm.c
bfd/aout-ns32k.c
bfd/aout-tic30.c
bfd/coff-arm.c
bfd/coff-tic54x.c
bfd/cpu-ns32k.c
bfd/elf-attrs.c
bfd/elfcode.h
bfd/peicode.h
bfd/reloc.c
bfd/riscix.c
bfd/section.c
bfd/versados.c
binutils/ChangeLog
binutils/dlltool.c
gas/ChangeLog
gas/config/obj-aout.c
gas/config/obj-coff-seh.h
gas/config/tc-hppa.c
gas/config/tc-hppa.h
gas/config/tc-ia64.c
gas/config/tc-m32r.c
gas/config/tc-microblaze.c
gas/config/tc-mips.c
gas/config/tc-score.c
gas/config/tc-score7.c
gas/config/tc-tic6x.c
gas/ecoff.c
gas/symbols.c
gdb/ChangeLog
gdb/elfread.c
gdb/machoread.c
ld/ChangeLog
ld/pe-dll.c

index 733c546..21ecb1e 100644 (file)
@@ -1,3 +1,27 @@
+2012-05-05  Alan Modra  <amodra@gmail.com>
+
+       * aout-arm.c: Replace all uses of bfd_abs_section, bfd_com_section,
+       bfd_und_section and bfd_ind_section with their _ptr variants, or
+       use corresponding bfd_is_* macros.
+       * aout-ns32k.c: Likewise.
+       * aout-tic30.c: Likewise.
+       * coff-arm.c: Likewise.
+       * coff-tic54x.c: Likewise.
+       * cpu-ns32k.c: Likewise.
+       * elf-attrs.c: Likewise.
+       * elfcode.h: Likewise.
+       * peicode.h: Likewise.
+       * reloc.c: Likewise.
+       * riscix.c: Likewise.
+       * versados.c: Likewise.
+       * section.c: Likewise.
+       (bfd_abs_section, bfd_ind_section, bfd_com_section,
+       bfd_ind_section): Delete.
+       (std_section): New array replacing above.
+       (bfd_abs_section_ptr, bfd_ind_section_ptr, bfd_com_section_ptr,
+       bfd_ind_section_ptr, STD_SECTION): Update.
+       (BFD_FAKE_SECTION, GLOBAL_SYM_INIT): Remove unnecessary casts.
+
 2012-05-03  Sean Keys  <skeys@ipdatasys.com>
 
        * cpu-xgate.c: New file. Added XGATE support.
index fd93603..9eb9488 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for raw ARM a.out binaries.
    Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
-   2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+   2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
    Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -247,7 +247,7 @@ MY (fix_pcrel_26) (bfd *abfd,
   bfd_reloc_status_type flag = bfd_reloc_ok;
 
   /* If this is an undefined symbol, return error.  */
-  if (symbol->section == &bfd_und_section
+  if (bfd_is_und_section (symbol->section)
       && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
 
@@ -409,10 +409,10 @@ MY_swap_std_reloc_out (bfd *abfd,
      check for that here.  */
 
   if (bfd_is_com_section (output_section)
-      || output_section == &bfd_abs_section
-      || output_section == &bfd_und_section)
+      || bfd_is_abs_section (output_section)
+      || bfd_is_und_section (output_section))
     {
-      if (bfd_abs_section.symbol == sym)
+      if (bfd_abs_section_ptr->symbol == sym)
        {
          /* Whoops, looked like an abs symbol, but is really an offset
             from the abs section.  */
index 9a0737d..5cf5ad4 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for ns32k a.out-ish binaries.
    Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-   2002, 2003, 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
+   2002, 2003, 2005, 2006, 2007, 2010, 2012 Free Software Foundation, Inc.
    Contributed by Ian Dall (idall@eleceng.adelaide.edu.au).
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -303,10 +303,10 @@ MY_swap_std_reloc_out (bfd *abfd,
      from the abs section, or as a symbol which has an abs value.
      Check for that here.  */
   if (bfd_is_com_section (output_section)
-      || output_section == &bfd_abs_section
-      || output_section == &bfd_und_section)
+      || bfd_is_abs_section (output_section)
+      || bfd_is_und_section (output_section))
     {
-      if (bfd_abs_section.symbol == sym)
+      if (bfd_abs_section_ptr->symbol == sym)
        {
          /* Whoops, looked like an abs symbol, but is really an offset
             from the abs section.  */
index 0b01177..f3b0d36 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for TMS320C30 a.out binaries.
    Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009,
-   2010, 2011
+   2010, 2011, 2012
    Free Software Foundation, Inc.
    Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
 
@@ -189,7 +189,7 @@ tic30_aout_fix_16 (bfd *abfd,
   bfd_vma relocation;
 
   /* Make sure that the symbol's section is defined.  */
-  if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
+  if (bfd_is_und_section (symbol->section) && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
   /* Get the size of the input section and turn it into the TMS320C30
      32-bit address format.  */
@@ -214,7 +214,7 @@ tic30_aout_fix_32 (bfd *abfd,
   bfd_vma relocation;
 
   /* Make sure that the symbol's section is defined.  */
-  if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
+  if (bfd_is_und_section (symbol->section) && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
   /* Get the size of the input section and turn it into the TMS320C30
      32-bit address format.  */
index bdadfb2..4cdf1ac 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for ARM COFF files.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -599,7 +599,7 @@ aoutarm_fix_pcrel_26 (bfd *abfd,
   bfd_reloc_status_type flag = bfd_reloc_ok;
 
   /* If this is an undefined symbol, return error.  */
-  if (symbol->section == &bfd_und_section
+  if (bfd_is_und_section (symbol->section)
       && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
 
@@ -687,7 +687,7 @@ coff_thumb_pcrel_common (bfd *abfd,
     }
 
   /* If this is an undefined symbol, return error.  */
-  if (symbol->section == &bfd_und_section
+  if (bfd_is_und_section (symbol->section)
       && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
 
index 3c353da..e1b3ccb 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for TMS320C54X coff binaries.
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2011
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2011, 2012
    Free Software Foundation, Inc.
    Contributed by Timothy Wall (twall@cygnus.com)
 
@@ -111,12 +111,12 @@ bfd_ticoff_get_section_load_page (sect)
   int page;
 
   /* Provide meaningful defaults for predefined sections.  */
-  if (sect == &bfd_com_section)
+  if (sect == bfd_com_section_ptr)
     page = PG_DATA;
 
-  else if (sect == &bfd_und_section
-      || sect == &bfd_abs_section
-      || sect == &bfd_ind_section)
+  else if (bfd_is_und_section (sect)
+          || bfd_is_abs_section (sect)
+          || bfd_is_ind_section (sect))
     page = PG_PROG;
 
   else
index 28fff5a..4c2dce1 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD support for the ns32k architecture.
    Copyright 1990, 1991, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2007 Free Software Foundation, Inc.
+   2004, 2005, 2007, 2012 Free Software Foundation, Inc.
    Almost totally rewritten by Ian Dall from initial work
    by Andrew Cagney.
 
@@ -177,7 +177,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
   asection *reloc_target_output_section;
   bfd_byte *location;
 
-  if ((symbol->section == &bfd_abs_section)
+  if (bfd_is_abs_section (symbol->section)
       && output_bfd != (bfd *) NULL)
     {
       reloc_entry->address += input_section->output_offset;
@@ -187,7 +187,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
   /* If we are not producing relocatable output, return an error if
      the symbol is not defined.  An undefined weak symbol is
      considered to have a value of zero (SVR4 ABI, p. 4-27).  */
-  if (symbol->section == &bfd_und_section
+  if (bfd_is_und_section (symbol->section)
       && (symbol->flags & BSF_WEAK) == 0
       && output_bfd == (bfd *) NULL)
     flag = bfd_reloc_undefined;
index 569e846..4237af5 100644 (file)
@@ -1,5 +1,5 @@
 /* ELF attributes support (based on ARM EABI attributes).
-   Copyright 2005, 2006, 2007, 2009, 2010
+   Copyright 2005, 2006, 2007, 2009, 2010, 2012
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -428,7 +428,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
   bfd_byte *contents;
   bfd_byte *p;
   bfd_vma len;
-  const char *std_section;
+  const char *std_sec;
 
   contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
   if (!contents)
@@ -440,7 +440,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
       return;
     }
   p = contents;
-  std_section = get_elf_backend_data (abfd)->obj_attrs_vendor;
+  std_sec = get_elf_backend_data (abfd)->obj_attrs_vendor;
   if (*(p++) == 'A')
     {
       len = hdr->sh_size - 1;
@@ -455,11 +455,11 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
          if (section_len > len)
            section_len = len;
          len -= section_len;
-         namelen = strlen ((char *)p) + 1;
+         namelen = strlen ((char *) p) + 1;
          section_len -= namelen + 4;
-         if (std_section && strcmp ((char *)p, std_section) == 0)
+         if (std_sec && strcmp ((char *) p, std_sec) == 0)
            vendor = OBJ_ATTR_PROC;
-         else if (strcmp ((char *)p, "gnu") == 0)
+         else if (strcmp ((char *) p, "gnu") == 0)
            vendor = OBJ_ATTR_GNU;
          else
            {
index 2244874..c985c63 100644 (file)
@@ -1,6 +1,6 @@
 /* ELF executable support for BFD.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
    Free Software Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, from information published
@@ -1450,7 +1450,7 @@ elf_slurp_reloc_table_from_section (bfd *abfd,
          (*_bfd_error_handler)
            (_("%s(%s): relocation %d has invalid symbol index %ld"),
             abfd->filename, asect->name, i, ELF_R_SYM (rela.r_info));
-         relent->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
+         relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
        }
       else
        {
index 5d10029..e835792 100644 (file)
@@ -1,6 +1,7 @@
 /* Support for the generic parts of PE/PEI, for BFD.
    Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+   2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+   Free Software Foundation, Inc.
    Written by Cygnus Solutions.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -545,7 +546,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars *  vars,
   sprintf (vars->string_ptr, "%s%s", prefix, symbol_name);
 
   if (section == NULL)
-    section = (asection_ptr) & bfd_und_section;
+    section = bfd_und_section_ptr;
 
   /* Initialise the external symbol.  */
   H_PUT_32 (vars->abfd, vars->string_ptr - vars->string_table,
index 0ec1b61..29c54c8 100644 (file)
@@ -6448,7 +6448,7 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
              p = data + (*parent)->address * bfd_octets_per_byte (input_bfd);
              _bfd_clear_contents ((*parent)->howto, input_bfd, input_section,
                                   p);
-             (*parent)->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
+             (*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
              (*parent)->addend = 0;
              (*parent)->howto = &none_howto;
              r = bfd_reloc_ok;
index 0d07d01..7e24fd9 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for RISC iX (Acorn, arm) binaries.
    Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004,
-   2005, 2007, 2010 Free Software Foundation, Inc.
+   2005, 2007, 2010, 2012 Free Software Foundation, Inc.
    Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -207,7 +207,7 @@ riscix_fix_pcrel_26 (bfd *abfd,
   bfd_reloc_status_type flag = bfd_reloc_ok;
 
   /* If this is an undefined symbol, return error.  */
-  if (symbol->section == &bfd_und_section
+  if (bfd_is_und_section (symbol->section)
       && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
 
@@ -341,10 +341,10 @@ riscix_swap_std_reloc_out (bfd *abfd,
      check for that here.  */
 
   if (bfd_is_com_section (output_section)
-      || output_section == & bfd_abs_section
-      || output_section == & bfd_und_section)
+      || bfd_is_abs_section (output_section)
+      || bfd_is_und_section (output_section))
     {
-      if (bfd_abs_section.symbol == sym)
+      if (bfd_abs_section_ptr->symbol == sym)
        {
          /* Whoops, looked like an abs symbol, but is really an offset
             from the abs section.  */
index 9eb7f69..db7e239 100644 (file)
@@ -547,28 +547,25 @@ CODE_FRAGMENT
 .
 .{* These sections are global, and are managed by BFD.  The application
 .   and target back end are not permitted to change the values in
-.   these sections.  New code should use the section_ptr macros rather
-.   than referring directly to the const sections.  The const sections
-.   may eventually vanish.  *}
+.   these sections.  *}
+.extern asection std_section[4];
+.
 .#define BFD_ABS_SECTION_NAME "*ABS*"
 .#define BFD_UND_SECTION_NAME "*UND*"
 .#define BFD_COM_SECTION_NAME "*COM*"
 .#define BFD_IND_SECTION_NAME "*IND*"
 .
-.{* The absolute section.  *}
-.extern asection bfd_abs_section;
-.#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
-.#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-.{* Pointer to the undefined section.  *}
-.extern asection bfd_und_section;
-.#define bfd_und_section_ptr ((asection *) &bfd_und_section)
-.#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
 .{* Pointer to the common section.  *}
-.extern asection bfd_com_section;
-.#define bfd_com_section_ptr ((asection *) &bfd_com_section)
+.#define bfd_com_section_ptr (&std_section[0])
+.{* Pointer to the undefined section.  *}
+.#define bfd_und_section_ptr (&std_section[1])
+.{* Pointer to the absolute section.  *}
+.#define bfd_abs_section_ptr (&std_section[2])
 .{* Pointer to the indirect section.  *}
-.extern asection bfd_ind_section;
-.#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
+.#define bfd_ind_section_ptr (&std_section[3])
+.
+.#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
+.#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
 .#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
 .
 .#define bfd_is_const_section(SEC)             \
@@ -683,8 +680,8 @@ CODE_FRAGMENT
 .  {* vma, lma, size, rawsize, compressed_size, relax, relax_count, *} \
 .     0,   0,   0,    0,       0,               0,     0,              \
 .                                                                      \
-.  {* output_offset, output_section,              alignment_power,  *} \
-.     0,             (struct bfd_section *) &SEC, 0,                   \
+.  {* output_offset, output_section, alignment_power,               *} \
+.     0,             &SEC,           0,                                        \
 .                                                                      \
 .  {* relocation, orelocation, reloc_count, filepos, rel_filepos,   *} \
 .     NULL,       NULL,        0,           0,       0,                        \
@@ -716,10 +713,10 @@ CODE_FRAGMENT
  /* the_bfd, name, value, attr, section [, udata] */
 #ifdef __STDC__
 #define GLOBAL_SYM_INIT(NAME, SECTION) \
-  { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION, { 0 }}
+  { 0, NAME, 0, BSF_SECTION_SYM, SECTION, { 0 }}
 #else
 #define GLOBAL_SYM_INIT(NAME, SECTION) \
-  { 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION }
+  { 0, NAME, 0, BSF_SECTION_SYM, SECTION }
 #endif
 
 /* These symbols are global, not specific to any BFD.  Therefore, anything
@@ -727,20 +724,21 @@ CODE_FRAGMENT
 
 static const asymbol global_syms[] =
 {
-  GLOBAL_SYM_INIT (BFD_COM_SECTION_NAME, &bfd_com_section),
-  GLOBAL_SYM_INIT (BFD_UND_SECTION_NAME, &bfd_und_section),
-  GLOBAL_SYM_INIT (BFD_ABS_SECTION_NAME, &bfd_abs_section),
-  GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section)
+  GLOBAL_SYM_INIT (BFD_COM_SECTION_NAME, bfd_com_section_ptr),
+  GLOBAL_SYM_INIT (BFD_UND_SECTION_NAME, bfd_und_section_ptr),
+  GLOBAL_SYM_INIT (BFD_ABS_SECTION_NAME, bfd_abs_section_ptr),
+  GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, bfd_ind_section_ptr)
 };
 
-#define STD_SECTION(SEC, FLAGS, NAME, IDX)                             \
-  asection SEC = BFD_FAKE_SECTION(SEC, FLAGS, &global_syms[IDX],       \
-                                 NAME, IDX)
+#define STD_SECTION(NAME, IDX, FLAGS) \
+  BFD_FAKE_SECTION(std_section[IDX], FLAGS, &global_syms[IDX], NAME, IDX)
 
-STD_SECTION (bfd_com_section, SEC_IS_COMMON, BFD_COM_SECTION_NAME, 0);
-STD_SECTION (bfd_und_section, 0, BFD_UND_SECTION_NAME, 1);
-STD_SECTION (bfd_abs_section, 0, BFD_ABS_SECTION_NAME, 2);
-STD_SECTION (bfd_ind_section, 0, BFD_IND_SECTION_NAME, 3);
+asection std_section[] = {
+  STD_SECTION (BFD_COM_SECTION_NAME, 0, SEC_IS_COMMON),
+  STD_SECTION (BFD_UND_SECTION_NAME, 1, 0),
+  STD_SECTION (BFD_ABS_SECTION_NAME, 2, 0),
+  STD_SECTION (BFD_IND_SECTION_NAME, 3, 0)
+};
 #undef STD_SECTION
 
 /* Initialize an entry in the section hash table.  */
index 7f7766a..ae6f671 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for VERSAdos-E objects.
    Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+   2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
    Versados is a Motorola trademark.
@@ -287,7 +287,7 @@ process_esd (bfd *abfd, struct ext_esd *esd, int pass)
          sec->flags |= SEC_ALLOC;
          break;
        case ESD_XDEF_IN_ABS:
-         sec = (asection *) & bfd_abs_section;
+         sec = bfd_abs_section_ptr;
        case ESD_XDEF_IN_SEC:
          {
            int snum = VDATA (abfd)->def_idx++;
@@ -768,7 +768,7 @@ versados_canonicalize_reloc (bfd *abfd,
          int esdid = (int) (size_t) src[count].sym_ptr_ptr;
 
          if (esdid == 0)
-           src[count].sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
+           src[count].sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
          else if (esdid < ES_BASE)
            {
              /* Section relative thing.  */
index 693b100..30697c0 100644 (file)
@@ -1,3 +1,7 @@
+2012-05-05  Alan Modra  <amodra@gmail.com>
+
+       * dlltool.c (make_one_lib_file): Use bfd_und_section_ptr.
+
 2012-05-03  Sean Keys  <skeys@ipdatasys.com>
 
        * readelf.c: Add support for XGATE.
index 0c46c3a..6ed0f7a 100644 (file)
@@ -2530,7 +2530,7 @@ make_one_lib_file (export_type *exp, int i, int delay)
   iname_lab = bfd_make_empty_symbol (abfd);
 
   iname_lab->name = head_label;
-  iname_lab->section = (asection *) &bfd_und_section;
+  iname_lab->section = bfd_und_section_ptr;
   iname_lab->flags = 0;
   iname_lab->value = 0;
 
@@ -2563,7 +2563,7 @@ make_one_lib_file (export_type *exp, int i, int delay)
 
     toc_symbol = bfd_make_empty_symbol (abfd);
     toc_symbol->name = make_label (".", "toc");
-    toc_symbol->section = (asection *)&bfd_und_section;
+    toc_symbol->section = bfd_und_section_ptr;
     toc_symbol->flags = BSF_GLOBAL;
     toc_symbol->value = 0;
 
index d33b434..b199a17 100644 (file)
@@ -1,3 +1,21 @@
+2012-05-05  Alan Modra  <amodra@gmail.com>
+
+       * ecoff.c: Replace all uses of bfd_abs_section, bfd_com_section,
+       bfd_und_section and bfd_ind_section with their _ptr variants, or
+       use corresponding bfd_is_* macros.
+       * symbols.c: Likewise.
+       * config/obj-aout.c: Likewise.
+       * config/obj-coff-seh.h: Likewise.
+       * config/tc-hppa.c: Likewise.
+       * config/tc-hppa.h: Likewise.
+       * config/tc-ia64.c: Likewise.
+       * config/tc-m32r.c: Likewise.
+       * config/tc-microblaze.c: Likewise.
+       * config/tc-mips.c: Likewise.
+       * config/tc-score.c: Likewise.
+       * config/tc-score7.c: Likewise.
+       * config/tc-tic6x.c: Likewise.
+
 2012-05-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        * configure.tgt: Support x86_64-*-linux-gnux32.
index 32c68aa..ce72135 100644 (file)
@@ -1,6 +1,6 @@
 /* a.out object file format
    Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010
+   2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2012
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -42,7 +42,7 @@ obj_aout_frob_symbol (symbolS *sym, int *punt ATTRIBUTE_UNUSED)
   if (! (type & ~ (N_TYPE | N_EXT)))
     {
       if (type == (N_UNDF | N_EXT)
-         && sec == &bfd_abs_section)
+         && sec == bfd_abs_section_ptr)
        {
          sec = bfd_und_section_ptr;
          S_SET_SEGMENT (sym, sec);
@@ -54,8 +54,8 @@ obj_aout_frob_symbol (symbolS *sym, int *punt ATTRIBUTE_UNUSED)
          && (type & N_TYPE) != N_SETD
          && (type & N_TYPE) != N_SETB
          && type != N_WARNING
-         && (sec == &bfd_abs_section
-             || sec == &bfd_und_section))
+         && (sec == bfd_abs_section_ptr
+             || sec == bfd_und_section_ptr))
        return;
       if (flags & BSF_EXPORT)
        type |= N_EXT;
index 22267be..71c803f 100644 (file)
@@ -1,5 +1,5 @@
 /* seh pdata/xdata coff object file format
-   Copyright 2009
+   Copyright 2009, 2010, 2012
    Free Software Foundation, Inc.
 
    This file is part of GAS.
@@ -150,7 +150,7 @@ static void obj_coff_seh_proc  (int);
 static void obj_coff_seh_handler (int);
 static void obj_coff_seh_handlerdata (int);
 
-#define UNDSEC (asection *) &bfd_und_section
+#define UNDSEC bfd_und_section_ptr
 
 /* Check if x64 UNW_... macros are already defined.  */
 #ifndef PEX64_FLAG_NHANDLER
index e688f71..b36fc2c 100644 (file)
@@ -1,6 +1,6 @@
 /* tc-hppa.c -- Assemble for the PA
    Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -2207,7 +2207,7 @@ pa_parse_number (char **s, int is_float)
                 register, so...  */
              have_prefix = TRUE;
            }
-         else if (S_GET_SEGMENT (sym) == &bfd_abs_section)
+         else if (S_GET_SEGMENT (sym) == bfd_abs_section_ptr)
            num = S_GET_VALUE (sym);
          else if (!strict)
            {
index cd8c205..78d9edf 100644 (file)
@@ -1,6 +1,7 @@
 /* tc-hppa.h -- Header file for the PA
    Copyright 1989, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -137,8 +138,8 @@ int hppa_fix_adjustable (struct fix *);
    *not* end up in the symbol table.  Likewise for absolute symbols
    with local scope.  */
 #define tc_frob_symbol(sym,punt) \
-    if ((S_GET_SEGMENT (sym) == &bfd_und_section && ! symbol_used_p (sym)) \
-       || (S_GET_SEGMENT (sym) == &bfd_abs_section \
+    if ((S_GET_SEGMENT (sym) == bfd_und_section_ptr && ! symbol_used_p (sym)) \
+       || (S_GET_SEGMENT (sym) == bfd_abs_section_ptr \
            && ! S_IS_EXTERNAL (sym))) \
       punt = 1
 
@@ -178,7 +179,7 @@ int hppa_fix_adjustable (struct fix *);
 
 #define tc_frob_symbol(sym,punt) \
   { \
-    if ((S_GET_SEGMENT (sym) == &bfd_und_section \
+    if ((S_GET_SEGMENT (sym) == bfd_und_section_ptr \
          && ! symbol_used_p (sym) \
          && ELF_ST_VISIBILITY (S_GET_OTHER (sym)) == STV_DEFAULT) \
        || strcmp (S_GET_NAME (sym), "$global$") == 0 \
index cd3a1db..0366ac4 100644 (file)
@@ -1,6 +1,6 @@
 /* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture.
    Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-   2008, 2009, 2011   Free Software Foundation, Inc.
+   2008, 2009, 2011, 2012 Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
 
    This file is part of GAS, the GNU Assembler.
@@ -7785,9 +7785,9 @@ ia64_frob_label (struct symbol *sym)
 int
 ia64_frob_symbol (struct symbol *sym)
 {
-  if ((S_GET_SEGMENT (sym) == &bfd_und_section && ! symbol_used_p (sym) &&
+  if ((S_GET_SEGMENT (sym) == bfd_und_section_ptr && ! symbol_used_p (sym) &&
        ELF_ST_VISIBILITY (S_GET_OTHER (sym)) == STV_DEFAULT)
-      || (S_GET_SEGMENT (sym) == &bfd_abs_section
+      || (S_GET_SEGMENT (sym) == bfd_abs_section_ptr
          && ! S_IS_EXTERNAL (sym)))
     return 1;
   return 0;
index 426502f..c8a6584 100644 (file)
@@ -1,6 +1,6 @@
 /* tc-m32r.c -- Assembler for the Renesas M32R.
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2009 Free Software Foundation, Inc.
+   2006, 2007, 2009, 2011, 2012 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -723,12 +723,12 @@ md_begin (void)
 
   /* We must construct a fake section similar to bfd_com_section
      but with the name .scommon.  */
-  scom_section                = bfd_com_section;
+  scom_section                = *bfd_com_section_ptr;
   scom_section.name           = ".scommon";
   scom_section.output_section = & scom_section;
   scom_section.symbol         = & scom_symbol;
   scom_section.symbol_ptr_ptr = & scom_section.symbol;
-  scom_symbol                 = * bfd_com_section.symbol;
+  scom_symbol                 = * bfd_com_section_ptr->symbol;
   scom_symbol.name            = ".scommon";
   scom_symbol.section         = & scom_section;
 
index 7c6357e..440c88b 100644 (file)
@@ -1,6 +1,6 @@
 /* tc-microblaze.c -- Assemble code for Xilinx MicroBlaze
 
-   Copyright 2009, 2010 Free Software Foundation.
+   Copyright 2009, 2010, 2012 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -2101,7 +2101,7 @@ md_estimate_size_before_relax (fragS * fragP,
          else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor))
            {
               /* It is accessed using the small data read only anchor.  */
-              if ((S_GET_SEGMENT (fragP->fr_symbol) == &bfd_com_section)
+              if ((S_GET_SEGMENT (fragP->fr_symbol) == bfd_com_section_ptr)
                  || (S_GET_SEGMENT (fragP->fr_symbol) == sdata2_segment)
                  || (S_GET_SEGMENT (fragP->fr_symbol) == sbss2_segment)
                  || (! S_IS_DEFINED (fragP->fr_symbol)))
@@ -2125,7 +2125,7 @@ md_estimate_size_before_relax (fragS * fragP,
             }
          else if (streq (fragP->fr_opcode, str_microblaze_rw_anchor))
            {
-              if ((S_GET_SEGMENT (fragP->fr_symbol) == &bfd_com_section)
+              if ((S_GET_SEGMENT (fragP->fr_symbol) == bfd_com_section_ptr)
                  || (S_GET_SEGMENT (fragP->fr_symbol) == sdata_segment)
                  || (S_GET_SEGMENT (fragP->fr_symbol) == sbss_segment)
                  || (!S_IS_DEFINED (fragP->fr_symbol)))
index 449d8c3..d6b8ecb 100644 (file)
@@ -1,6 +1,6 @@
 /* tc-mips.c -- assemble code for a MIPS chip.
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
    Free Software Foundation, Inc.
    Contributed by the OSF and Ralph Campbell.
    Written by Keith Knowles and Ralph Campbell, working independently.
@@ -17009,8 +17009,8 @@ pic_need_relax (symbolS *sym, asection *segtype)
   symsec = S_GET_SEGMENT (sym);
 
   /* This must duplicate the test in adjust_reloc_syms.  */
-  return (symsec != &bfd_und_section
-         && symsec != &bfd_abs_section
+  return (!bfd_is_und_section (symsec)
+         && !bfd_is_abs_section (symsec)
          && !bfd_is_com_section (symsec)
          && !s_is_linkonce (sym, segtype)
 #ifdef OBJ_ELF
index 3d62002..822b9cf 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-score.c -- Assembler for Score
-   Copyright 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright 2006, 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
    Contributed by:
    Brain.lin (brain.lin@sunplusct.com)
    Mei Ligang (ligang@sunnorth.com.cn)
@@ -5316,9 +5316,9 @@ s3_pic_need_relax (symbolS *sym, asection *segtype)
     }
 
   /* This must duplicate the test in adjust_reloc_syms.  */
-  return (symsec != &bfd_und_section
-         && symsec != &bfd_abs_section
-         && ! bfd_is_com_section (symsec)
+  return (!bfd_is_und_section (symsec)
+         && !bfd_is_abs_section (symsec)
+         && !bfd_is_com_section (symsec)
          && !linkonce
 #ifdef OBJ_ELF
          /* A global or weak symbol is treated as external.  */
index c4ae5dd..520bd07 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-score7.c -- Assembler for Score7
-   Copyright 2009, 2011 Free Software Foundation, Inc.
+   Copyright 2009, 2011, 2012 Free Software Foundation, Inc.
    Contributed by:
    Brain.lin (brain.lin@sunplusct.com)
    Mei Ligang (ligang@sunnorth.com.cn)
@@ -5200,10 +5200,10 @@ s7_pic_need_relax (symbolS *sym, asection *segtype)
     }
 
   /* This must duplicate the test in adjust_reloc_syms.  */
-  return (symsec != &bfd_und_section
-           && symsec != &bfd_abs_section
-         && ! bfd_is_com_section (symsec)
-           && !linkonce
+  return (!bfd_is_und_section (symsec)
+         && !bfd_is_abs_section (symsec)
+         && !bfd_is_com_section (symsec)
+         && !linkonce
 #ifdef OBJ_ELF
          /* A global or weak symbol is treated as external.  */
          && (OUTPUT_FLAVOR != bfd_target_elf_flavour
index 017254a..ddbfb50 100644 (file)
@@ -1,5 +1,5 @@
 /* TI C6X assembler.
-   Copyright 2010, 2011
+   Copyright 2010, 2011, 2012
    Free Software Foundation, Inc.
    Contributed by Joseph Myers <joseph@codesourcery.com>
                  Bernd Schmidt  <bernds@codesourcery.com>
@@ -790,12 +790,12 @@ md_begin (void)
 
   /* We must construct a fake section similar to bfd_com_section
      but with the name .scommon.  */
-  scom_section                = bfd_com_section;
+  scom_section                = *bfd_com_section_ptr;
   scom_section.name           = ".scommon";
   scom_section.output_section = & scom_section;
   scom_section.symbol         = & scom_symbol;
   scom_section.symbol_ptr_ptr = & scom_section.symbol;
-  scom_symbol                 = * bfd_com_section.symbol;
+  scom_symbol                 = * bfd_com_section_ptr->symbol;
   scom_symbol.name            = ".scommon";
   scom_symbol.section         = & scom_section;
 }
index 102ce9e..348f98e 100644 (file)
@@ -1,6 +1,6 @@
 /* ECOFF debugging support.
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
    Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    This file was put together by Ian Lance Taylor <ian@cygnus.com>.  A
@@ -3589,12 +3589,12 @@ ecoff_frob_symbol (symbolS *sym)
          but with the name .scommon.  */
       if (scom_section.name == NULL)
        {
-         scom_section = bfd_com_section;
+         scom_section = *bfd_com_section_ptr;
          scom_section.name = ".scommon";
          scom_section.output_section = &scom_section;
          scom_section.symbol = &scom_symbol;
          scom_section.symbol_ptr_ptr = &scom_section.symbol;
-         scom_symbol = *bfd_com_section.symbol;
+         scom_symbol = *bfd_com_section_ptr->symbol;
          scom_symbol.name = ".scommon";
          scom_symbol.section = &scom_section;
        }
@@ -4076,7 +4076,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend,
                            sc = sc_Bss;
                          else if (strcmp (segname, ".sbss") == 0)
                            sc = sc_SBss;
-                         else if (seg == &bfd_abs_section)
+                         else if (seg == bfd_abs_section_ptr)
                            sc = sc_Abs;
                          else
                            {
index 679534d..1f325c4 100644 (file)
@@ -1,7 +1,7 @@
 /* symbols.c -symbol table-
    Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
    1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-   2011 Free Software Foundation, Inc.
+   2011, 2012 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -2778,7 +2778,7 @@ symbol_begin (void)
 
   memset ((char *) (&abs_symbol), '\0', sizeof (abs_symbol));
 #if defined (EMIT_SECTION_SYMBOLS) || !defined (RELOC_REQUIRES_SYMBOL)
-  abs_symbol.bsym = bfd_abs_section.symbol;
+  abs_symbol.bsym = bfd_abs_section_ptr->symbol;
 #endif
   abs_symbol.sy_value.X_op = O_constant;
   abs_symbol.sy_frag = &zero_address_frag;
index 6f1ef45..69270c7 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-05  Alan Modra  <amodra@gmail.com>
+
+       * elfread.c (elf_symtab_read): Use bfd_abs_section_ptr and
+       bfd_und_section_ptr.
+       * machoread.c (macho_symtab_add_minsym): Use bfd_abs_section_ptr
+       and bfd_com_section_ptr.
+
 2012-05-04  Joel Brobecker  <brobecker@adacore.com>
 
        * MAINTAINERS (Past Maintainers): Add Chris Faylor.
index d825d9a..d8dec38 100644 (file)
@@ -272,7 +272,7 @@ elf_symtab_read (struct objfile *objfile, int type,
 
       offset = ANOFFSET (objfile->section_offsets, sym->section->index);
       if (type == ST_DYNAMIC
-         && sym->section == &bfd_und_section
+         && sym->section == bfd_und_section_ptr
          && (sym->flags & BSF_FUNCTION))
        {
          struct minimal_symbol *msym;
@@ -367,7 +367,7 @@ elf_symtab_read (struct objfile *objfile, int type,
          symaddr = sym->value + sym->section->vma;
          /* Relocate all non-absolute and non-TLS symbols by the
             section offset.  */
-         if (sym->section != &bfd_abs_section
+         if (sym->section != bfd_abs_section_ptr
              && !(sym->section->flags & SEC_THREAD_LOCAL))
            {
              symaddr += offset;
@@ -375,7 +375,7 @@ elf_symtab_read (struct objfile *objfile, int type,
          /* For non-absolute symbols, use the type of the section
             they are relative to, to intuit text/data.  Bfd provides
             no way of figuring this out for absolute symbols.  */
-         if (sym->section == &bfd_abs_section)
+         if (sym->section == bfd_abs_section_ptr)
            {
              /* This is a hack to get the minimal symbol type
                 right for Irix 5, which has absolute addresses
@@ -517,7 +517,7 @@ elf_symtab_read (struct objfile *objfile, int type,
                      symaddr = sym->value + sym->section->vma;
                      /* Relocate non-absolute symbols by the
                         section offset.  */
-                     if (sym->section != &bfd_abs_section)
+                     if (sym->section != bfd_abs_section_ptr)
                        symaddr += offset;
                      sectinfo->sections[special_local_sect] = symaddr;
                      /* The special local symbols don't go in the
index 1986f54..22530ab 100644 (file)
@@ -126,11 +126,11 @@ macho_symtab_add_minsym (struct objfile *objfile, const asymbol *sym)
          interested in will have a section.  */
       /* Relocate all non-absolute and non-TLS symbols by the
          section offset.  */
-      if (sym->section != &bfd_abs_section
+      if (sym->section != bfd_abs_section_ptr
           && !(sym->section->flags & SEC_THREAD_LOCAL))
         symaddr += offset;
 
-      if (sym->section == &bfd_abs_section)
+      if (sym->section == bfd_abs_section_ptr)
         ms_type = mst_abs;
       else if (sym->section->flags & SEC_CODE)
         {
@@ -563,7 +563,7 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd,
           res = macho_resolve_oso_sym_with_minsym (main_objfile, sym);
           if (res != 0)
             {
-              sym->section = &bfd_com_section;
+              sym->section = bfd_com_section_ptr;
               sym->value = res;
             }
         }
index c80b07f..90fe1f6 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-05  Alan Modra  <amodra@gmail.com>
+
+       * pe-dll.c (process_def_file_and_drectve): Use bfd_und_section_ptr.
+       (generate_reloc): Use bfd_abs_section_ptr.
+
 2012-05-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        * configure.tgt: Support x86_64-*-linux-gnux32.
index 85bf2a7..b50a109 100644 (file)
@@ -720,9 +720,10 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
              /* We should export symbols which are either global or not
                 anything at all.  (.bss data is the latter)
                 We should not export undefined symbols.  */
-             bfd_boolean would_export = symbols[j]->section != &bfd_und_section
-                     && ((symbols[j]->flags & BSF_GLOBAL)
-                         || (symbols[j]->flags == 0));
+             bfd_boolean would_export
+               = (symbols[j]->section != bfd_und_section_ptr
+                  && ((symbols[j]->flags & BSF_GLOBAL)
+                      || (symbols[j]->flags == 0)));
              if (link_info.version_info && would_export)
                  would_export
                    = !bfd_hide_sym_by_version (link_info.version_info,
@@ -1351,7 +1352,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
 
          /* I don't know why there would be a reloc for these, but I've
             seen it happen - DJ  */
-         if (s->output_section == &bfd_abs_section)
+         if (s->output_section == bfd_abs_section_ptr)
            continue;
 
          if (s->output_section->vma == 0)
@@ -1408,7 +1409,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
                             no reason we'd want a reference to any absolute
                             address to get relocated during rebasing).  */
                          if (!h2 || h2->root.type == bfd_link_hash_undefined
-                               || h2->root.u.def.section == &bfd_abs_section)
+                               || h2->root.u.def.section == bfd_abs_section_ptr)
                            continue;
                        }
                      else if (!blhe || blhe->type != bfd_link_hash_defined)
@@ -1767,7 +1768,7 @@ static int tmp_seq2;
 static const char *dll_filename;
 static char *dll_symname;
 
-#define UNDSEC (asection *) &bfd_und_section
+#define UNDSEC bfd_und_section_ptr
 
 static asection *
 quick_section (bfd *abfd, const char *name, int flags, int align)