From e67a0640a0e6c0a372fbccd492484445391ddbc5 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 20 Dec 1993 21:53:01 +0000 Subject: * write.c (adjust_reloc_syms) [RELOC_REQUIRES_SYMBOL]: If no symbol is present (i.e., relocation against absolute), create a phony local symbol, and use it in the reloc. (fixup_segment): When adjusting a reloc with an absolute symbol, have TC_FORCE_RELOCATION control clearing add_symbolP too. * config/tc-sparc.h (RELOC_REQUIRES_SYMBOL): Define. --- gas/write.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'gas/write.c') diff --git a/gas/write.c b/gas/write.c index 8b920a9..4ec756d 100644 --- a/gas/write.c +++ b/gas/write.c @@ -578,6 +578,23 @@ adjust_reloc_syms (abfd, sec, xxx) fixp->fx_addsy = section_symbol (symsec); fixp->fx_addsy->sy_used_in_reloc = 1; } +#ifdef RELOC_REQUIRES_SYMBOL + else + { + /* There was no symbol required by this relocation. However, + BFD doesn't really handle relocations without symbols well. + (At least, the COFF support doesn't.) So for now we fake up + a local symbol in the absolute section. */ + static symbolS *abs_sym; + if (!abs_sym) + { + abs_sym = symbol_new ("*absolute0zero*", &bfd_abs_section, 0, + &zero_address_frag); + abs_sym->sy_used_in_reloc = 1; + } + fixp->fx_addsy = abs_sym; + } +#endif dump_section_relocs (abfd, sec, stderr); } @@ -1968,8 +1985,10 @@ fixup_segment (fixP, this_segment_type) as to whether or not a relocation will be needed to handle this fixup. */ if (!TC_FORCE_RELOCATION (fixP)) - fixP->fx_addsy = NULL; - add_symbolP = NULL; + { + fixP->fx_addsy = NULL; + add_symbolP = NULL; + } } else if (add_symbol_segment == undefined_section #ifdef BFD_ASSEMBLER -- cgit v1.1