+1999-12-09 Nick Clifton <nickc@cygnus.com>
+
+ * elflink.h (elf_link_add_archive_symbols): Add an archive
+ element even if contains a symbol which is currently only
+ considered to be a common.
+
+ * targets.c (struct bfd_target): Add new field
+ _bfd_allow_commons_in_armap.
+ * bfd-in2.h:Regenerate.
+
+ * libbfd-in2.h (_bfd_noarchive_allow_commons_in_armap):
+ Define.
+ (_bfd_archive_bsd_allow_commons_in_armap): Define.
+ * libbfd.h: Regenerate.
+
+ * elfxx-target.h: If using COFF archive map, override
+ definition of allow_commons_in_armap and replace with
+ bfd_false.
+
+ * archive.c (bfd_compute_and_write_armap): Do not place common
+ symbols into the archive map unless _bfd_allow_commons_in_armap
+ returns true.
+
+ * aout-target.h (MY_allow_commons_in_armap): Define.
+ * aout-tic30.h (MY_allow_commons_in_armap): Define.
+ * bfd.c (bfd_allow_commons_in_armap): Define.
+ * coff-alpha.h (alpha_ecoff_allow_commons_in_armap): Define.
+ * coff-rs6000.h (xcoff_allow_commons_in_armap): Define.
+ * elf64-mips.c (bfd_elf64_allow_commons_in_armap): Define.
+ * ieee.c (ieee_ecoff_allow_commons_in_armap): Define.
+ * libecoff.h (_bfd_ecoff_allow_commons_in_armap): Define.
+ * oasys.c (oasys_allow_commons_in_armap): Define.
+ * som.c (som_allow_commons_in_armap): Define.
+ * vms.c (vms_allow_commons_in_armap): Define.
+
1999-12-07 Jim Blandy <jimb@cygnus.com>
Add support for SSE registers in ELF core files.
#ifndef MY_update_armap_timestamp
#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
#endif
+#ifndef MY_allow_commons_in_armap
+#define MY_allow_commons_in_armap _bfd_archive_bsd_allow_commons_in_armap
+#endif
/* No core file defined here -- configure in trad-core.c separately. */
#ifndef MY_core_file_failing_command
#ifndef MY_update_armap_timestamp
#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
#endif
+#ifndef MY_allow_commons_in_armap
+#define MY_allow_commons_in_armap _bfd_archive_bsd_allow_commons_in_armap
+#endif
/* No core file defined here -- configure in trad-core.c separately. */
#ifndef MY_core_file_failing_command
{
flagword flags = (syms[src_count])->flags;
asection *sec = syms[src_count]->section;
+ size_t namelen;
+ struct orl *new_map;
- if ((flags & BSF_GLOBAL ||
- flags & BSF_WEAK ||
- flags & BSF_INDIRECT ||
- bfd_is_com_section (sec))
- && ! bfd_is_und_section (sec))
+ if (bfd_is_und_section (sec))
+ continue;
+ else if (bfd_is_com_section (sec))
{
- size_t namelen;
- struct orl *new_map;
-
+ if (! bfd_allow_commons_in_armap (arch))
+ continue;
+ }
+ else if ((flags & (BSF_GLOBAL | BSF_WEAK | BSF_INDIRECT)) == 0)
+ continue;
+
/* This symbol will go into the archive header */
if (orl_count == orl_max)
{
stridx += namelen + 1;
++orl_count;
- }
}
}
#define bfd_update_armap_timestamp(abfd) \
BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
+#define bfd_allow_commons_in_armap(abfd) \
+ BFD_SEND (abfd, _bfd_allow_commons_in_armap, (abfd))
+
#define bfd_set_arch_mach(abfd, arch, mach)\
BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
CAT(NAME,_openr_next_archived_file),\
CAT(NAME,_get_elt_at_index),\
CAT(NAME,_generic_stat_arch_elt),\
-CAT(NAME,_update_armap_timestamp)
+CAT(NAME,_update_armap_timestamp), \
+CAT(NAME,_allow_commons_in_armap)
boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
boolean (*_bfd_construct_extended_name_table)
struct orl *map,
unsigned int orl_count,
int stridx));
- PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
+ PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
-
+ boolean (*_bfd_allow_commons_in_armap) PARAMS ((bfd *));
+
/* Entry points used for symbols. */
#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
CAT(NAME,_get_symtab_upper_bound),\
.#define bfd_update_armap_timestamp(abfd) \
. BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
.
+.#define bfd_allow_commons_in_armap(abfd) \
+. BFD_SEND (abfd, _bfd_allow_commons_in_armap, (abfd))
+.
.#define bfd_set_arch_mach(abfd, arch, mach)\
. BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
.
#define alpha_ecoff_write_armap _bfd_ecoff_write_armap
#define alpha_ecoff_generic_stat_arch_elt _bfd_ecoff_generic_stat_arch_elt
#define alpha_ecoff_update_armap_timestamp _bfd_ecoff_update_armap_timestamp
+#define alpha_ecoff_allow_commons_in_armap _bfd_true
+
/* A compressed file uses this instead of ARFMAG. */
/* XCOFF archives do not have a timestamp. */
#define xcoff_update_armap_timestamp bfd_true
+#define xcoff_allow_commons_in_armap bfd_true
/* Read in the armap of an XCOFF archive. */
_bfd_archive_coff_generic_stat_arch_elt
#define bfd_elf64_archive_update_armap_timestamp \
_bfd_archive_coff_update_armap_timestamp
+#define _bfd_elf64_allow_commons_in_armap bfd_false
#include "elf64-target.h"
if (h == NULL)
continue;
- if (h->root.type != bfd_link_hash_undefined)
+ /* We have changed the GNU archiver so that it will only place
+ non-common symbols into its archive map. Thus if we come across
+ a symbol in the archive map, which is currently considered to be
+ a common symbol, we can safely assume that we should link the
+ element in, in order to get in the definition of the symbol.
+
+ Previous versions of the archiver would place common symbols into
+ the archive map. This meant that in order to only link in an
+ element if it contained a *definition* of a common symbol, it
+ would be necessary to read in the element and scan its symbol
+ table - a slow and wasteful process.
+
+ In fact previous versions of this code did not even do that,
+ instead it just unilaterally ignored any symbols in the archive
+ map which were currently marked as common. So in order to link
+ in an archive element containing the definition of a common
+ symbol it was necessary to have that element also contain the
+ defintion of a currently undefined symbol. */
+ if (h->root.type != bfd_link_hash_undefined
+ && h->root.type != bfd_link_hash_common)
{
if (h->root.type != bfd_link_hash_undefweak)
defined[i] = true;
#ifdef bfd_elfNN_archive_functions
BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
#else
+ /* For ELF based targets we do not want to put common symbols into the
+ archive map. This is a change from the old behaviour, and it is
+ being done because of a corresponding change in the linker, whereby
+ it will link in any archive element that contains a symbol which is
+ currently common. (See elflink.h:elf_link_add_archive_symbol). */
+#undef _bfd_archive_coff_allow_commons_in_armap
+#define _bfd_archive_coff_allow_commons_in_armap bfd_false
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
#endif
BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
#ifdef bfd_elfNN_archive_functions
BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
#else
+#undef _bfd_archive_coff_allow_commons_in_armap
+#define _bfd_archive_coff_allow_commons_in_armap bfd_false
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
#endif
BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
bfd_true)
#define ieee_read_ar_hdr bfd_nullvoidptr
#define ieee_update_armap_timestamp bfd_true
+#define ieee_allow_commons_in_armap bfd_true
#define ieee_get_elt_at_index _bfd_generic_get_elt_at_index
#define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name
((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr)
#define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define _bfd_noarchive_update_armap_timestamp bfd_false
+#define _bfd_noarchive_allow_commons_in_armap bfd_true
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style
archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */
#define _bfd_archive_bsd_generic_stat_arch_elt \
bfd_generic_stat_arch_elt
extern boolean _bfd_archive_bsd_update_armap_timestamp PARAMS ((bfd *));
+#define _bfd_archive_bsd_allow_commons_in_armap bfd_true
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */
#define _bfd_archive_coff_generic_stat_arch_elt \
bfd_generic_stat_arch_elt
#define _bfd_archive_coff_update_armap_timestamp bfd_true
+#define _bfd_archive_coff_allow_commons_in_armap bfd_true
/* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr)
#define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define _bfd_noarchive_update_armap_timestamp bfd_false
+#define _bfd_noarchive_allow_commons_in_armap bfd_true
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style
archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */
#define _bfd_archive_bsd_generic_stat_arch_elt \
bfd_generic_stat_arch_elt
extern boolean _bfd_archive_bsd_update_armap_timestamp PARAMS ((bfd *));
+#define _bfd_archive_bsd_allow_commons_in_armap bfd_true
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */
#define _bfd_archive_coff_generic_stat_arch_elt \
bfd_generic_stat_arch_elt
#define _bfd_archive_coff_update_armap_timestamp bfd_true
+#define _bfd_archive_coff_allow_commons_in_armap bfd_true
/* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
#define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index
#define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define _bfd_ecoff_update_armap_timestamp bfd_true
+#define _bfd_ecoff_allow_commons_in_armap bfd_true
extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
extern long _bfd_ecoff_get_symtab PARAMS ((bfd *abfd, asymbol **alocation));
#define oasys_read_ar_hdr bfd_nullvoidptr
#define oasys_get_elt_at_index _bfd_generic_get_elt_at_index
#define oasys_update_armap_timestamp bfd_true
+#define oasys_allow_commons_in_armap bfd_true
#define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name
#define oasys_get_lineno _bfd_nosymbols_get_lineno
#define som_construct_extended_name_table \
_bfd_archive_coff_construct_extended_name_table
#define som_update_armap_timestamp bfd_true
+#define som_allow_commons_in_armap bfd_true
#define som_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
#define som_get_lineno _bfd_nosymbols_get_lineno
.CAT(NAME,_openr_next_archived_file),\
.CAT(NAME,_get_elt_at_index),\
.CAT(NAME,_generic_stat_arch_elt),\
-.CAT(NAME,_update_armap_timestamp)
+.CAT(NAME,_update_armap_timestamp), \
+.CAT(NAME,_allow_commons_in_armap)
. boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
. boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
. boolean (*_bfd_construct_extended_name_table)
. struct orl *map,
. unsigned int orl_count,
. int stridx));
-. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
+. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
. bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
.#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
. bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
. int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
. boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
+. boolean (*_bfd_allow_commons_in_armap) PARAMS ((bfd *));
.
. {* Entry points used for symbols. *}
.#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
static boolean vms_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
#define vms_make_empty_symbol _bfd_vms_make_empty_symbol
+#define vms_allow_commons_in_armap bfd_true
\f
/*===========================================================================*/