From: Ian Lance Taylor Date: Fri, 2 Feb 1996 17:46:05 +0000 (+0000) Subject: * write.c (write_relocs): Use S_IS_DEFINED and S_IS_COMMON rather X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e24cf2b556c64426980bc2ffcbce0da05284da4e;p=binutils-gdb.git * write.c (write_relocs): Use S_IS_DEFINED and S_IS_COMMON rather than comparing S_GET_SEGMENT to undefined_section. (write_object_file): Skip symbols which were equated to an undefined or common symbol. * symbols.c (resolve_symbol_value): Use S_IS_DEFINED and S_IS_COMMON rather than comparing S_GET_SEGMENT to undefined_section. (S_GET_VALUE): Likewise. Avoid recursion problems if S_IS_DEFINED or S_IS_COMMON call S_GET_VALUE. * config/obj-aout.h (S_IS_COMMON): Define if not BFD_ASSEMBLER. * config/obj-aout.c (obj_emit_relocations): If a reloc is equated to an undefined or common symbol, convert the reloc to be against the target symbol. (obj_crawl_symbol_chain): Skip symbols which were equated to an undefined or common symbol. * config/obj-bout.h (S_IS_COMMON): Define if not BFD_ASSEMBLER. * config/obj-bout.c (obj_emit_relocations): If a reloc is equated to an undefined or common symbol, convert the reloc to be against the target symbol. (obj_crawl_symbol_chain): Skip symbols which were equated to an undefined or common symbol. * config/obj-coff.c (do_relocs_for): Use S_IS_DEFINED and S_IS_COMMON rather than comparing S_GET_SEGMENT to undefined_section. (yank_symbols): Skip symbols which were equated to an undefined or common symbol. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 26b6990465b..6f20f6f3372 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,32 @@ +Fri Feb 2 12:32:15 1996 Ian Lance Taylor + + * write.c (write_relocs): Use S_IS_DEFINED and S_IS_COMMON rather + than comparing S_GET_SEGMENT to undefined_section. + (write_object_file): Skip symbols which were equated to an + undefined or common symbol. + * symbols.c (resolve_symbol_value): Use S_IS_DEFINED and + S_IS_COMMON rather than comparing S_GET_SEGMENT to + undefined_section. + (S_GET_VALUE): Likewise. Avoid recursion problems if S_IS_DEFINED + or S_IS_COMMON call S_GET_VALUE. + * config/obj-aout.h (S_IS_COMMON): Define if not BFD_ASSEMBLER. + * config/obj-aout.c (obj_emit_relocations): If a reloc is equated + to an undefined or common symbol, convert the reloc to be against + the target symbol. + (obj_crawl_symbol_chain): Skip symbols which were equated to an + undefined or common symbol. + * config/obj-bout.h (S_IS_COMMON): Define if not BFD_ASSEMBLER. + * config/obj-bout.c (obj_emit_relocations): If a reloc is equated + to an undefined or common symbol, convert the reloc to be against + the target symbol. + (obj_crawl_symbol_chain): Skip symbols which were equated to an + undefined or common symbol. + * config/obj-coff.c (do_relocs_for): Use S_IS_DEFINED and + S_IS_COMMON rather than comparing S_GET_SEGMENT to + undefined_section. + (yank_symbols): Skip symbols which were equated to an undefined or + common symbol. + Thu Feb 1 15:34:32 1996 Ian Lance Taylor * config/obj-aout.h (S_IS_LOCAL): Check for \002 as well as \001. diff --git a/gas/config/obj-bout.c b/gas/config/obj-bout.c index ba7cadc370d..0136c17c6e8 100644 --- a/gas/config/obj-bout.c +++ b/gas/config/obj-bout.c @@ -96,6 +96,14 @@ obj_emit_relocations (where, fixP, segment_address_in_file) if (fixP->fx_done == 0 || fixP->fx_r_type != NO_RELOC) { + symbolS *sym; + + sym = fixP->fx_addsy; + while (sym->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + sym = sym->sy_value.X_add_symbol; + fixP->fx_addsy = sym; + tc_bout_fix_to_chars (*where, fixP, segment_address_in_file); *where += sizeof (struct relocation_info); } /* if there's a symbol */ @@ -246,6 +254,15 @@ obj_crawl_symbol_chain (headers) resolve_symbol_value (symbolP); + /* Skip symbols which were equated to undefined or common + symbols. */ + if (symbolP->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP))) + { + *symbolPP = symbol_next (symbolP); + continue; + } + /* OK, here is how we decide which symbols go out into the brave new symtab. Symbols that do are: diff --git a/gas/config/obj-bout.h b/gas/config/obj-bout.h index 81621b96ece..947a140defc 100644 --- a/gas/config/obj-bout.h +++ b/gas/config/obj-bout.h @@ -181,6 +181,10 @@ struct relocation_info /* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */ #define S_IS_DEFINED(s) ((S_GET_TYPE(s) != N_UNDF) || (S_GET_DESC(s) != 0)) + +#define S_IS_COMMON(s) \ + (S_GET_TYPE (s) == N_UNDF && S_GET_VALUE (s) != 0) + #define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER) /* True if a debug special symbol entry */