This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
bfd_com_section, bfd_abs_section et al.
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org, gdb-patches at sourceware dot org
- Date: Sat, 5 May 2012 12:56:05 +0930
- Subject: bfd_com_section, bfd_abs_section et al.
We've been threatening to get rid of bfd_com_section et al for over 13
years. This patch does the deed. No real changes here, but this
should make is easier to, for example, make these sections per-bfd.
bfd/
* 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.
binutils/
* dlltool.c (make_one_lib_file): Use bfd_und_section_ptr.
gas/
* 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.
gdb/
* 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.
ld/
* pe-dll.c (process_def_file_and_drectve): Use bfd_und_section_ptr.
(generate_reloc): Use bfd_abs_section_ptr.
Index: bfd/aout-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-arm.c,v
retrieving revision 1.22
diff -u -p -r1.22 aout-arm.c
--- bfd/aout-arm.c 6 Jun 2011 01:26:01 -0000 1.22
+++ bfd/aout-arm.c 4 May 2012 12:42:51 -0000
@@ -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: bfd/aout-ns32k.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-ns32k.c,v
retrieving revision 1.22
diff -u -p -r1.22 aout-ns32k.c
--- bfd/aout-ns32k.c 25 Aug 2010 07:02:40 -0000 1.22
+++ bfd/aout-ns32k.c 4 May 2012 12:42:51 -0000
@@ -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: bfd/aout-tic30.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-tic30.c,v
retrieving revision 1.43
diff -u -p -r1.43 aout-tic30.c
--- bfd/aout-tic30.c 11 Jul 2011 15:03:03 -0000 1.43
+++ bfd/aout-tic30.c 4 May 2012 12:42:51 -0000
@@ -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: bfd/coff-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-arm.c,v
retrieving revision 1.79
diff -u -p -r1.79 coff-arm.c
--- bfd/coff-arm.c 25 Aug 2010 07:02:40 -0000 1.79
+++ bfd/coff-arm.c 4 May 2012 12:42:53 -0000
@@ -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: bfd/coff-tic54x.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-tic54x.c,v
retrieving revision 1.25
diff -u -p -r1.25 coff-tic54x.c
--- bfd/coff-tic54x.c 6 Jun 2011 01:26:02 -0000 1.25
+++ bfd/coff-tic54x.c 4 May 2012 12:42:53 -0000
@@ -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: bfd/cpu-ns32k.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-ns32k.c,v
retrieving revision 1.22
diff -u -p -r1.22 cpu-ns32k.c
--- bfd/cpu-ns32k.c 31 Jan 2012 17:54:35 -0000 1.22
+++ bfd/cpu-ns32k.c 4 May 2012 12:42:56 -0000
@@ -177,7 +177,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbo
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, symbo
/* 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: bfd/elf-attrs.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-attrs.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf-attrs.c
--- bfd/elf-attrs.c 5 Nov 2010 13:02:09 -0000 1.14
+++ bfd/elf-attrs.c 4 May 2012 12:42:57 -0000
@@ -428,7 +428,7 @@ _bfd_elf_parse_attributes (bfd *abfd, El
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, El
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, El
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: bfd/elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.111
diff -u -p -r1.111 elfcode.h
--- bfd/elfcode.h 14 Dec 2011 16:12:13 -0000 1.111
+++ bfd/elfcode.h 4 May 2012 12:42:57 -0000
@@ -1450,7 +1450,7 @@ elf_slurp_reloc_table_from_section (bfd
(*_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: bfd/peicode.h
===================================================================
RCS file: /cvs/src/src/bfd/peicode.h,v
retrieving revision 1.63
diff -u -p -r1.63 peicode.h
--- bfd/peicode.h 9 Sep 2011 16:28:12 -0000 1.63
+++ bfd/peicode.h 4 May 2012 12:42:57 -0000
@@ -545,7 +545,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * var
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: bfd/reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.227
diff -u -p -r1.227 reloc.c
--- bfd/reloc.c 3 May 2012 13:11:55 -0000 1.227
+++ bfd/reloc.c 4 May 2012 12:42:58 -0000
@@ -6448,7 +6448,7 @@ bfd_generic_get_relocated_section_conten
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: bfd/riscix.c
===================================================================
RCS file: /cvs/src/src/bfd/riscix.c,v
retrieving revision 1.19
diff -u -p -r1.19 riscix.c
--- bfd/riscix.c 25 Aug 2010 07:02:40 -0000 1.19
+++ bfd/riscix.c 4 May 2012 12:42:58 -0000
@@ -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: bfd/section.c
===================================================================
RCS file: /cvs/src/src/bfd/section.c,v
retrieving revision 1.112
diff -u -p -r1.112 section.c
--- bfd/section.c 24 Apr 2012 05:12:39 -0000 1.112
+++ bfd/section.c 4 May 2012 12:42:59 -0000
@@ -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)
-
-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);
+#define STD_SECTION(NAME, IDX, FLAGS) \
+ BFD_FAKE_SECTION(std_section[IDX], FLAGS, &global_syms[IDX], NAME, IDX)
+
+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: bfd/versados.c
===================================================================
RCS file: /cvs/src/src/bfd/versados.c,v
retrieving revision 1.41
diff -u -p -r1.41 versados.c
--- bfd/versados.c 11 Jul 2011 15:03:07 -0000 1.41
+++ bfd/versados.c 4 May 2012 12:42:59 -0000
@@ -287,7 +287,7 @@ process_esd (bfd *abfd, struct ext_esd *
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: binutils/dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.105
diff -u -p -r1.105 dlltool.c
--- binutils/dlltool.c 21 Feb 2012 16:10:12 -0000 1.105
+++ binutils/dlltool.c 4 May 2012 12:43:04 -0000
@@ -2530,7 +2530,7 @@ make_one_lib_file (export_type *exp, int
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
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: gas/ecoff.c
===================================================================
RCS file: /cvs/src/src/gas/ecoff.c,v
retrieving revision 1.30
diff -u -p -r1.30 ecoff.c
--- gas/ecoff.c 2 Mar 2011 17:23:09 -0000 1.30
+++ gas/ecoff.c 4 May 2012 12:43:07 -0000
@@ -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_
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: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.115
diff -u -p -r1.115 symbols.c
--- gas/symbols.c 21 Feb 2012 09:13:01 -0000 1.115
+++ gas/symbols.c 4 May 2012 12:43:07 -0000
@@ -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: gas/config/obj-aout.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-aout.c,v
retrieving revision 1.30
diff -u -p -r1.30 obj-aout.c
--- gas/config/obj-aout.c 25 Oct 2010 12:38:42 -0000 1.30
+++ gas/config/obj-aout.c 4 May 2012 12:43:08 -0000
@@ -42,7 +42,7 @@ obj_aout_frob_symbol (symbolS *sym, int
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
&& (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: gas/config/obj-coff-seh.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-coff-seh.h,v
retrieving revision 1.4
diff -u -p -r1.4 obj-coff-seh.h
--- gas/config/obj-coff-seh.h 15 Sep 2010 19:43:54 -0000 1.4
+++ gas/config/obj-coff-seh.h 4 May 2012 12:43:08 -0000
@@ -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: gas/config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.151
diff -u -p -r1.151 tc-hppa.c
--- gas/config/tc-hppa.c 31 Dec 2010 16:43:46 -0000 1.151
+++ gas/config/tc-hppa.c 4 May 2012 12:43:09 -0000
@@ -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: gas/config/tc-hppa.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.h,v
retrieving revision 1.42
diff -u -p -r1.42 tc-hppa.h
--- gas/config/tc-hppa.h 3 Mar 2009 23:21:52 -0000 1.42
+++ gas/config/tc-hppa.h 4 May 2012 12:43:09 -0000
@@ -137,8 +137,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 +178,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: gas/config/tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.218
diff -u -p -r1.218 tc-ia64.c
--- gas/config/tc-ia64.c 20 Apr 2012 10:21:33 -0000 1.218
+++ gas/config/tc-ia64.c 4 May 2012 12:43:11 -0000
@@ -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: gas/config/tc-m32r.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32r.c,v
retrieving revision 1.56
diff -u -p -r1.56 tc-m32r.c
--- gas/config/tc-m32r.c 17 May 2011 16:15:59 -0000 1.56
+++ gas/config/tc-m32r.c 4 May 2012 12:43:11 -0000
@@ -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: gas/config/tc-microblaze.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-microblaze.c,v
retrieving revision 1.6
diff -u -p -r1.6 tc-microblaze.c
--- gas/config/tc-microblaze.c 25 Aug 2010 11:51:07 -0000 1.6
+++ gas/config/tc-microblaze.c 4 May 2012 12:43:12 -0000
@@ -2101,7 +2101,7 @@ md_estimate_size_before_relax (fragS * f
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 * f
}
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: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.504
diff -u -p -r1.504 tc-mips.c
--- gas/config/tc-mips.c 24 Mar 2012 01:09:27 -0000 1.504
+++ gas/config/tc-mips.c 4 May 2012 12:43:15 -0000
@@ -17009,8 +17009,8 @@ pic_need_relax (symbolS *sym, asection *
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: gas/config/tc-score.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-score.c,v
retrieving revision 1.18
diff -u -p -r1.18 tc-score.c
--- gas/config/tc-score.c 13 Jun 2011 09:45:28 -0000 1.18
+++ gas/config/tc-score.c 4 May 2012 12:43:16 -0000
@@ -5316,9 +5316,9 @@ s3_pic_need_relax (symbolS *sym, asectio
}
/* 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: gas/config/tc-score7.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-score7.c,v
retrieving revision 1.7
diff -u -p -r1.7 tc-score7.c
--- gas/config/tc-score7.c 13 Jun 2011 09:45:28 -0000 1.7
+++ gas/config/tc-score7.c 4 May 2012 12:43:17 -0000
@@ -5200,10 +5200,10 @@ s7_pic_need_relax (symbolS *sym, asectio
}
/* 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: gas/config/tc-tic6x.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tic6x.c,v
retrieving revision 1.16
diff -u -p -r1.16 tc-tic6x.c
--- gas/config/tc-tic6x.c 20 May 2011 10:09:58 -0000 1.16
+++ gas/config/tc-tic6x.c 4 May 2012 12:43:18 -0000
@@ -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: gdb/elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.128
diff -u -p -r1.128 elfread.c
--- gdb/elfread.c 27 Apr 2012 20:47:53 -0000 1.128
+++ gdb/elfread.c 4 May 2012 12:43:22 -0000
@@ -272,7 +272,7 @@ elf_symtab_read (struct objfile *objfile
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
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
/* 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
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: gdb/machoread.c
===================================================================
RCS file: /cvs/src/src/gdb/machoread.c,v
retrieving revision 1.36
diff -u -p -r1.36 machoread.c
--- gdb/machoread.c 27 Apr 2012 20:47:55 -0000 1.36
+++ gdb/machoread.c 4 May 2012 12:43:23 -0000
@@ -126,11 +126,11 @@ macho_symtab_add_minsym (struct objfile
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
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: ld/pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.142
diff -u -p -r1.142 pe-dll.c
--- ld/pe-dll.c 14 Mar 2012 19:00:03 -0000 1.142
+++ ld/pe-dll.c 4 May 2012 12:43:29 -0000
@@ -720,9 +720,10 @@ process_def_file_and_drectve (bfd *abfd
/* 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_li
/* 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_li
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)
--
Alan Modra
Australia Development Lab, IBM