@@ -976,57 +976,6 @@ discarded_section (const asection *sec)
&& sec->sec_info_type != SEC_INFO_TYPE_JUST_SYMS);
}
-#define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS) \
- /* name, next, prev, id, section_id, index, flags, user_set_vma, */ \
- { NAME, NULL, NULL, IDX, 0, 0, FLAGS, 0, \
- \
- /* linker_mark, linker_has_input, gc_mark, decompress_status, */ \
- 0, 0, 1, 0, \
- \
- /* segment_mark, sec_info_type, use_rela_p, mmapped_p, alloced, */ \
- 0, 0, 0, 0, 0, \
- \
- /* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5, */ \
- 0, 0, 0, 0, 0, 0, \
- \
- /* vma, lma, size, rawsize, compressed_size, */ \
- 0, 0, 0, 0, 0, \
- \
- /* output_offset, output_section, relocation, orelocation, */ \
- 0, &SEC, NULL, NULL, \
- \
- /* reloc_count, alignment_power, filepos, rel_filepos, */ \
- 0, 0, 0, 0, \
- \
- /* line_filepos, userdata, contents, lineno, lineno_count, */ \
- 0, NULL, NULL, NULL, 0, \
- \
- /* entsize, kept_section, moving_line_filepos, */ \
- 0, NULL, 0, \
- \
- /* target_index, used_by_bfd, constructor_chain, owner, */ \
- 0, NULL, NULL, NULL, \
- \
- /* symbol, */ \
- (struct bfd_symbol *) SYM, \
- \
- /* map_head, map_tail, already_assigned, type */ \
- { NULL }, { NULL }, NULL, 0 \
- \
- }
-
-/* We use a macro to initialize the static asymbol structures because
- traditional C does not permit us to initialize a union member while
- gcc warns if we don't initialize it.
- the_bfd, name, value, attr, section [, udata] */
-#ifdef __STDC__
-#define GLOBAL_SYM_INIT(NAME, SECTION) \
- { 0, NAME, 0, BSF_SECTION_SYM, SECTION, { 0 }}
-#else
-#define GLOBAL_SYM_INIT(NAME, SECTION) \
- { 0, NAME, 0, BSF_SECTION_SYM, SECTION }
-#endif
-
void bfd_section_list_clear (bfd *);
asection *bfd_get_section_by_name (bfd *abfd, const char *name);
@@ -18,6 +18,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
+extern asection _bfd_ecoff_scom_section;
+
extern bool bfd_ecoff_set_gp_value
(bfd *abfd, bfd_vma gp_value);
extern bool bfd_ecoff_set_regmasks
@@ -661,18 +661,6 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd,
/* ECOFF symbol table routines. The ECOFF symbol table is described
in gcc/mips-tfile.c. */
-/* ECOFF uses two common sections. One is the usual one, and the
- other is for small objects. All the small objects are kept
- together, and then referenced via the gp pointer, which yields
- faster assembler code. This is what we use for the small common
- section. */
-static asection ecoff_scom_section;
-static const asymbol ecoff_scom_symbol =
- GLOBAL_SYM_INIT (SCOMMON, &ecoff_scom_section);
-static asection ecoff_scom_section =
- BFD_FAKE_SECTION (ecoff_scom_section, &ecoff_scom_symbol,
- SCOMMON, 0, SEC_IS_COMMON | SEC_SMALL_DATA);
-
/* Create an empty symbol. */
asymbol *
@@ -813,7 +801,7 @@ ecoff_set_symbol_info (bfd *abfd,
}
/* Fall through. */
case scSCommon:
- asym->section = &ecoff_scom_section;
+ asym->section = &_bfd_ecoff_scom_section;
asym->flags = 0;
break;
case scVarRegister:
@@ -3441,7 +3429,7 @@ ecoff_link_add_externals (bfd *abfd,
}
/* Fall through. */
case scSCommon:
- section = &ecoff_scom_section;
+ section = &_bfd_ecoff_scom_section;
break;
case scSUndefined:
section = bfd_und_section_ptr;
@@ -32,7 +32,18 @@
#include "coff/ecoff.h"
#include "libcoff.h"
#include "libecoff.h"
-
+
+/* ECOFF uses two common sections. One is the usual one, and the
+ other is for small objects. All the small objects are kept
+ together, and then referenced via the gp pointer, which yields
+ faster assembler code. This is what we use for the small common
+ section. */
+static const asymbol ecoff_scom_symbol =
+ GLOBAL_SYM_INIT (SCOMMON, &_bfd_ecoff_scom_section);
+asection _bfd_ecoff_scom_section =
+ BFD_FAKE_SECTION (_bfd_ecoff_scom_section, &ecoff_scom_symbol,
+ SCOMMON, 0, SEC_IS_COMMON | SEC_SMALL_DATA);
+
/* Routines to swap auxiliary information in and out. I am assuming
that the auxiliary information format is always going to be target
independent. */
@@ -3668,6 +3668,49 @@ bool _bfd_unrecognized_reloc
unsigned int r_type) ATTRIBUTE_HIDDEN;
/* Extracted from section.c. */
+#define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS) \
+ /* name, next, prev, id, section_id, index, flags, user_set_vma, */ \
+ { NAME, NULL, NULL, IDX, 0, 0, FLAGS, 0, \
+ \
+ /* linker_mark, linker_has_input, gc_mark, decompress_status, */ \
+ 0, 0, 1, 0, \
+ \
+ /* segment_mark, sec_info_type, use_rela_p, mmapped_p, alloced, */ \
+ 0, 0, 0, 0, 0, \
+ \
+ /* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5, */ \
+ 0, 0, 0, 0, 0, 0, \
+ \
+ /* vma, lma, size, rawsize, compressed_size, */ \
+ 0, 0, 0, 0, 0, \
+ \
+ /* output_offset, output_section, relocation, orelocation, */ \
+ 0, &SEC, NULL, NULL, \
+ \
+ /* reloc_count, alignment_power, filepos, rel_filepos, */ \
+ 0, 0, 0, 0, \
+ \
+ /* line_filepos, userdata, contents, lineno, lineno_count, */ \
+ 0, NULL, NULL, NULL, 0, \
+ \
+ /* entsize, kept_section, moving_line_filepos, */ \
+ 0, NULL, 0, \
+ \
+ /* target_index, used_by_bfd, constructor_chain, owner, */ \
+ 0, NULL, NULL, NULL, \
+ \
+ /* symbol, */ \
+ (struct bfd_symbol *) SYM, \
+ \
+ /* map_head, map_tail, already_assigned, type */ \
+ { NULL }, { NULL }, NULL, 0 \
+ \
+ }
+
+#define GLOBAL_SYM_INIT(NAME, SECTION) \
+ /* the_bfd, name, value, attr, section, udata */ \
+ { 0, NAME, 0, BSF_SECTION_SYM, SECTION, { 0 } }
+
/* Extracted from stabs.c. */
bool _bfd_link_section_stabs
(bfd *, struct stab_info *, asection *, asection *, void **,
@@ -712,6 +712,7 @@ EXTERNAL
. && sec->sec_info_type != SEC_INFO_TYPE_JUST_SYMS);
.}
.
+INTERNAL
.#define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS) \
. {* name, next, prev, id, section_id, index, flags, user_set_vma, *} \
. { NAME, NULL, NULL, IDX, 0, 0, FLAGS, 0, \
@@ -749,19 +750,11 @@ EXTERNAL
. {* map_head, map_tail, already_assigned, type *} \
. { NULL }, { NULL }, NULL, 0 \
. \
-. }
-.
-.{* We use a macro to initialize the static asymbol structures because
-. traditional C does not permit us to initialize a union member while
-. gcc warns if we don't initialize it.
-. the_bfd, name, value, attr, section [, udata] *}
-.#ifdef __STDC__
-.#define GLOBAL_SYM_INIT(NAME, SECTION) \
-. { 0, NAME, 0, BSF_SECTION_SYM, SECTION, { 0 }}
-.#else
-.#define GLOBAL_SYM_INIT(NAME, SECTION) \
-. { 0, NAME, 0, BSF_SECTION_SYM, SECTION }
-.#endif
+. }
+.
+.#define GLOBAL_SYM_INIT(NAME, SECTION) \
+. {* the_bfd, name, value, attr, section, udata *} \
+. { 0, NAME, 0, BSF_SECTION_SYM, SECTION, { 0 } }
.
*/
@@ -36,6 +36,7 @@
#include "aout/stab_gnu.h"
#include "filenames.h"
#include "safe-ctype.h"
+#include "ecoff-bfd.h"
/* Why isn't this in coff/sym.h? */
#define ST_RFDESCAPE 0xfff
@@ -3549,13 +3550,6 @@ ecoff_stab (int what,
cur_file_ptr = save_file_ptr;
}
-static asection ecoff_scom_section;
-static const asymbol ecoff_scom_symbol =
- GLOBAL_SYM_INIT (SCOMMON, &ecoff_scom_section);
-static asection ecoff_scom_section =
- BFD_FAKE_SECTION (ecoff_scom_section, &ecoff_scom_symbol,
- SCOMMON, 0, SEC_IS_COMMON | SEC_SMALL_DATA);
-
/* Frob an ECOFF symbol. Small common symbols go into a special
.scommon section rather than bfd_com_section. */
@@ -3566,7 +3560,7 @@ ecoff_frob_symbol (symbolS *sym)
&& S_GET_VALUE (sym) > 0
&& S_GET_VALUE (sym) <= bfd_get_gp_size (stdoutput))
{
- S_SET_SEGMENT (sym, &ecoff_scom_section);
+ S_SET_SEGMENT (sym, &_bfd_ecoff_scom_section);
}
/* Double check weak symbols. */