aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2006-05-09 11:47:48 +0000
committerNick Clifton <nickc@redhat.com>2006-05-09 11:47:48 +0000
commit337ff0a5afa6511854390af9ca41f5de27a40cbc (patch)
tree38e8857ee32895684af844e8d224bb2a21bfd6d5
parent8c9f705ebb4a261be2fcf9e032e45fb90123d1d7 (diff)
downloadgdb-337ff0a5afa6511854390af9ca41f5de27a40cbc.zip
gdb-337ff0a5afa6511854390af9ca41f5de27a40cbc.tar.gz
gdb-337ff0a5afa6511854390af9ca41f5de27a40cbc.tar.bz2
* config/tc-arm.c (arm_fix_adjustable): For COFF, convert fixups against
symbols which are not going to be placed into the symbol table. * coffcode.h (coff_write_relocs): Produce an error message if a an out-of-range symbol index is detected in a reloc.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/coffcode.h12
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-arm.c30
4 files changed, 43 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cf6d030..3c8c505 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-09 Nick Clifton <nickc@redhat.com>
+
+ * coffcode.h (coff_write_relocs): Produce an error message if a an
+ out-of-range symbol index is detected in a reloc.
+
2006-05-09 Ben Elliston <bje@au.ibm.com>
* elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Remove unused
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 6eae4a3..badb214 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -2532,11 +2532,15 @@ coff_write_relocs (bfd * abfd, int first_undef)
else
{
n.r_symndx = get_index ((*(q->sym_ptr_ptr)));
- /* Take notice if the symbol reloc points to a symbol
- we don't have in our symbol table. What should we
- do for this?? */
+ /* Check to see if the symbol reloc points to a symbol
+ we don't have in our symbol table. */
if (n.r_symndx > obj_conv_table_size (abfd))
- abort ();
+ {
+ bfd_set_error (bfd_error_bad_value);
+ _bfd_error_handler (_("%B: reloc against a non-existant symbol index: %ld"),
+ abfd, n.r_symndx);
+ return FALSE;
+ }
}
}
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c099fb0..b72aa5b 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2006-05-09 Nick Clifton <nickc@redhat.com>
+
+ * config/tc-arm.c (arm_fix_adjustable): For COFF, convert fixups
+ against symbols which are not going to be placed into the symbol
+ table.
+
2006-05-09 Ben Elliston <bje@au.ibm.com>
* expr.c (operand): Remove `if (0 && ..)' statement and
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 47f39a8..fe24ab2 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -17003,17 +17003,35 @@ arm_force_relocation (struct fix * fixp)
}
#ifdef OBJ_COFF
-/* This is a little hack to help the gas/arm/adrl.s test. It prevents
- local labels from being added to the output symbol table when they
- are used with the ADRL pseudo op. The ADRL relocation should always
- be resolved before the binbary is emitted, so it is safe to say that
- it is adjustable. */
-
bfd_boolean
arm_fix_adjustable (fixS * fixP)
{
+ /* This is a little hack to help the gas/arm/adrl.s test. It prevents
+ local labels from being added to the output symbol table when they
+ are used with the ADRL pseudo op. The ADRL relocation should always
+ be resolved before the binbary is emitted, so it is safe to say that
+ it is adjustable. */
if (fixP->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE)
return 1;
+
+ /* This is a hack for the gas/all/redef2.s test. This test causes symbols
+ to be cloned, and without this test relocs would still be generated
+ against the original pre-cloned symbol. Such symbols would not appear
+ in the symbol table however, and so a valid reloc could not be
+ generated. So check to see if the fixup is against a symbol which has
+ been removed from the symbol chain, and if it is, then allow it to be
+ adjusted into a reloc against a section symbol. */
+ if (fixP->fx_addsy != NULL)
+ {
+ symbolS * sym;
+
+ for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym))
+ if (sym == fixP->fx_addsy)
+ break;
+ if (sym == NULL)
+ return 1;
+ }
+
return 0;
}
#endif