aboutsummaryrefslogtreecommitdiff
path: root/gas/write.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1997-02-03 17:38:41 +0000
committerIan Lance Taylor <ian@airs.com>1997-02-03 17:38:41 +0000
commit3569064fb5f1bce22b31a3c9d425e7fffdd214c7 (patch)
tree7334c48a6b9669ae462f68d4b07c8c3739e43a82 /gas/write.c
parentbcb686ca093cb2d6a0e9496d108f2328cc65acd2 (diff)
downloadgdb-3569064fb5f1bce22b31a3c9d425e7fffdd214c7.zip
gdb-3569064fb5f1bce22b31a3c9d425e7fffdd214c7.tar.gz
gdb-3569064fb5f1bce22b31a3c9d425e7fffdd214c7.tar.bz2
* symbols.c (resolve_symbol_value): Don't change X_add_number for
an equated symbol. * write.c (write_relocs): Avoid looping on equated symbols. Adjust fx_offset by X_add_number for each symbol. * config/obj-coff.c (do_relocs_for): Avoid looping on equated symbols. (fixup_segment): Add a loop to track down equated symbols and adjust fx_offset appropriately.
Diffstat (limited to 'gas/write.c')
-rw-r--r--gas/write.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gas/write.c b/gas/write.c
index 0cd68c3..a67b34a 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -874,7 +874,17 @@ write_relocs (abfd, sec, xxx)
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;
+ {
+ symbolS *n;
+
+ /* We must avoid looping, as that can occur with a badly
+ written program. */
+ n = sym->sy_value.X_add_symbol;
+ if (n == sym)
+ break;
+ fixp->fx_offset += sym->sy_value.X_add_number;
+ sym = n;
+ }
fixp->fx_addsy = sym;
reloc = tc_gen_reloc (sec, fixp);