aboutsummaryrefslogtreecommitdiff
path: root/gas/write.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@cygnus>1993-12-20 21:53:01 +0000
committerKen Raeburn <raeburn@cygnus>1993-12-20 21:53:01 +0000
commite67a0640a0e6c0a372fbccd492484445391ddbc5 (patch)
tree0ba222ef1dcc1497f5a77920b6483fe5560fe7e1 /gas/write.c
parentc4e349acbf57f4003bdf1f093742e94fc61fcb61 (diff)
downloadgdb-e67a0640a0e6c0a372fbccd492484445391ddbc5.zip
gdb-e67a0640a0e6c0a372fbccd492484445391ddbc5.tar.gz
gdb-e67a0640a0e6c0a372fbccd492484445391ddbc5.tar.bz2
* 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.
Diffstat (limited to 'gas/write.c')
-rw-r--r--gas/write.c23
1 files changed, 21 insertions, 2 deletions
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