summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-09-11 15:26:22 +0000
committerIan Lance Taylor <ian@airs.com>1999-09-11 15:26:22 +0000
commit5fec578ce206a5c3acca9cdbe87f9364dad990c7 (patch)
tree9e3407c623a0a57d9eb707d0f35709893c706548 /bfd
parent0dd406e624d131a2f8719017fe3309ae66042e3f (diff)
downloadgdb-5fec578ce206a5c3acca9cdbe87f9364dad990c7.tar.gz
1999-09-11 Donn Terry <donn@interix.com>
* cofflink.c (coff_link_add_symbols): Don't warn about symbol type changes when the base type is unknown.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog3
-rw-r--r--bfd/cofflink.c60
2 files changed, 41 insertions, 22 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index dbc93dae71a..4028e7c5026 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,8 @@
1999-09-11 Donn Terry <donn@interix.com>
+ * cofflink.c (coff_link_add_symbols): Don't warn about symbol type
+ changes when the base type is unknown.
+
* coffgen.c (coff_print_symbol): Fix printing of aux record for
function symbols.
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 0b492ae8426..a4e18b32e8b 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -295,12 +295,9 @@ coff_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
-#if 0
- /* These aren't needed yet. */
unsigned int n_tmask = coff_data (abfd)->local_n_tmask;
unsigned int n_btshft = coff_data (abfd)->local_n_btshft;
unsigned int n_btmask = coff_data (abfd)->local_n_btmask;
-#endif
boolean keep_syms;
boolean default_copy;
bfd_size_type symcount;
@@ -452,25 +449,44 @@ coff_link_add_symbols (abfd, info)
if (info->hash->creator->flavour == bfd_get_flavour (abfd))
{
- if (((*sym_hash)->class == C_NULL
- && (*sym_hash)->type == T_NULL)
- || sym.n_scnum != 0
- || (sym.n_value != 0
- && (*sym_hash)->root.type != bfd_link_hash_defined
- && (*sym_hash)->root.type != bfd_link_hash_defweak))
- {
- (*sym_hash)->class = sym.n_sclass;
- if (sym.n_type != T_NULL)
- {
- if ((*sym_hash)->type != T_NULL
- && (*sym_hash)->type != sym.n_type)
- (*_bfd_error_handler)
- (_("Warning: type of symbol `%s' changed from %d to %d in %s"),
- name, (*sym_hash)->type, sym.n_type,
- bfd_get_filename (abfd));
- (*sym_hash)->type = sym.n_type;
- }
- (*sym_hash)->auxbfd = abfd;
+ /* If we don't have any symbol information currently in
+ the hash table, or if we are looking at a symbol
+ definition, then update the symbol class and type in
+ the hash table. */
+ if (((*sym_hash)->class == C_NULL
+ && (*sym_hash)->type == T_NULL)
+ || sym.n_scnum != 0
+ || (sym.n_value != 0
+ && (*sym_hash)->root.type != bfd_link_hash_defined
+ && (*sym_hash)->root.type != bfd_link_hash_defweak))
+ {
+ (*sym_hash)->class = sym.n_sclass;
+ if (sym.n_type != T_NULL)
+ {
+ /* We want to warn if the type changed, but not
+ if it changed from an unspecified type.
+ Testing the whole type byte may work, but the
+ change from (e.g.) a function of unspecified
+ type to function of known type also wants to
+ skip the warning. */
+ if ((*sym_hash)->type != T_NULL
+ && (*sym_hash)->type != sym.n_type
+ && !(DTYPE ((*sym_hash)->type) == DTYPE (sym.n_type)
+ && (BTYPE ((*sym_hash)->type) == T_NULL
+ || BTYPE (sym.n_type) == T_NULL)))
+ (*_bfd_error_handler)
+ (_("Warning: type of symbol `%s' changed from %d to %d in %s"),
+ name, (*sym_hash)->type, sym.n_type,
+ bfd_get_filename (abfd));
+
+ /* We don't want to change from a meaningful
+ base type to a null one, but if we know
+ nothing, take what little we might now know. */
+ if (BTYPE (sym.n_type) != T_NULL
+ || (*sym_hash)->type == T_NULL)
+ (*sym_hash)->type = sym.n_type;
+ }
+ (*sym_hash)->auxbfd = abfd;
if (sym.n_numaux != 0)
{
union internal_auxent *alloc;