From 118e8d1c7d5adbb9024c792b1feaf0286c92f7f5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 6 Jun 1994 21:54:54 +0000 Subject: [PATCH] Better indirect and warning symbol handling inspired by Stuart Quick . * linker.c (enum link_action): Add REF, MIND, CWARN, REFC. (link_action): Change UNDEF_ROW/def and UNDEFW_ROW/def from NOACT to REF. Change UNDEF_ROW/indr and UNDEFW_ROW/indr from CYCLE to REFC. Change DEF_ROW/indr and COMMON_ROW/indr from CYCLE to MDEF. Change DEFW_ROW/indr from CYCLE to NOACT. Change INDR_ROW/indr from MDEF to MIND. Change INDR_ROW/warn from WARNC to CYCLE. Change WARN_ROW/def and WARN_ROW/indr from MWARN to CWARN. Change WARN_ROW/com from MWARN to WARN. Change WARN_ROW/warn from NOACT to CYCLE. Change SET_ROW/warn from WARNC to CYCLE> (_bfd_generic_link_add_one_symbol): Handle REF, MIND, CWARN and REFC. If a new indirect symbol has been referenced, push the reference down to the symbol it points to. FIx handling of WARN. * aoutx.h (translate_from_native_sym_flags): If N_WARNING, don't clobber e_type of next symbol. (translate_to_native_sym_flags): Likewise. (aout_link_write_symbols): Loop on bfd_link_hash_warning as well as bfd_link_hash_indirect. --- bfd/ChangeLog | 20 ++++++++++++++++++++ bfd/aoutx.h | 7 ++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2086cf02e1..0969b76834 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,25 @@ Mon Jun 6 10:57:28 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + Better indirect and warning symbol handling inspired by Stuart + Quick . + * linker.c (enum link_action): Add REF, MIND, CWARN, REFC. + (link_action): Change UNDEF_ROW/def and UNDEFW_ROW/def from NOACT + to REF. Change UNDEF_ROW/indr and UNDEFW_ROW/indr from CYCLE to + REFC. Change DEF_ROW/indr and COMMON_ROW/indr from CYCLE to MDEF. + Change DEFW_ROW/indr from CYCLE to NOACT. Change INDR_ROW/indr + from MDEF to MIND. Change INDR_ROW/warn from WARNC to CYCLE. + Change WARN_ROW/def and WARN_ROW/indr from MWARN to CWARN. Change + WARN_ROW/com from MWARN to WARN. Change WARN_ROW/warn from NOACT + to CYCLE. Change SET_ROW/warn from WARNC to CYCLE> + (_bfd_generic_link_add_one_symbol): Handle REF, MIND, CWARN and + REFC. If a new indirect symbol has been referenced, push the + reference down to the symbol it points to. FIx handling of WARN. + * aoutx.h (translate_from_native_sym_flags): If N_WARNING, don't + clobber e_type of next symbol. + (translate_to_native_sym_flags): Likewise. + (aout_link_write_symbols): Loop on bfd_link_hash_warning as well + as bfd_link_hash_indirect. + * libaout.h (struct aout_link_hash_entry): New field written. * aoutx.h (NAME(aout,link_hash_newfunc)): Initialize written. (aout_link_write_symbols): Use written, not root.written. diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 2af2d19623..68368c66c1 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -1288,9 +1288,6 @@ translate_from_native_sym_flags (sym_pointer, cache_ptr, abfd) pick one arbitrarily. */ cache_ptr->symbol.section = &bfd_abs_section; - /* We furgle with the next symbol in place. - We don't want it to be undefined, we'll trample the type */ - (sym_pointer + 1)->e_type[0] = 0xff; break; } if ((cache_ptr->type | N_EXT) == (N_INDR | N_EXT)) @@ -1453,7 +1450,6 @@ translate_to_native_sym_flags (sym_pointer, cache_ptr, abfd) if (cache_ptr->flags & (BSF_WARNING)) { sym_pointer->e_type[0] = N_WARNING; - (sym_pointer+1)->e_type[0] = 1; } if (cache_ptr->flags & BSF_DEBUGGING) { @@ -3720,7 +3716,8 @@ aout_link_write_symbols (finfo, input_bfd, symbol_map) || h->root.type == bfd_link_hash_warning)) { hresolve = (struct aout_link_hash_entry *) h->root.u.i.link; - while (hresolve->root.type == bfd_link_hash_indirect) + while (hresolve->root.type == bfd_link_hash_indirect + || hresolve->root.type == bfd_link_hash_warning) hresolve = ((struct aout_link_hash_entry *) hresolve->root.u.i.link); *sym_hash = hresolve;