aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.h
diff options
context:
space:
mode:
authorRichard Earnshaw <richard.earnshaw@arm.com>2002-03-21 15:26:03 +0000
committerRichard Earnshaw <richard.earnshaw@arm.com>2002-03-21 15:26:03 +0000
commitee29b9fb005bee46f4d2504ad3a106421c4b882a (patch)
tree592cf481baad34d241f2fa39ee5ddd556c28ef43 /bfd/elf32-arm.h
parent8b5790f2babc86674fdc8b731cb7a6df7897d40e (diff)
downloadgdb-ee29b9fb005bee46f4d2504ad3a106421c4b882a.zip
gdb-ee29b9fb005bee46f4d2504ad3a106421c4b882a.tar.gz
gdb-ee29b9fb005bee46f4d2504ad3a106421c4b882a.tar.bz2
* elf32-arm.h (elf32_arm_final_link_relocate case R_ARM_GOTOFF)
(case R_ARM_GOT): Handle relocations to Thumb functions.
Diffstat (limited to 'bfd/elf32-arm.h')
-rw-r--r--bfd/elf32-arm.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index a452465..0496541 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -1560,6 +1560,12 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
if (sgot == NULL)
return bfd_reloc_notsupported;
+ /* If we are addressing a Thumb function, we need to adjust the
+ address by one, so that attempts to call the function pointer will
+ correctly interpret it as Thumb code. */
+ if (sym_flags == STT_ARM_TFUNC)
+ value += 1;
+
/* Note that sgot->output_offset is not involved in this
calculation. We always want the start of .got. If we
define _GLOBAL_OFFSET_TABLE in a different way, as is
@@ -1612,6 +1618,13 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
off &= ~1;
else
{
+ /* If we are addressing a Thumb function, we need to
+ adjust the address by one, so that attempts to
+ call the function pointer will correctly
+ interpret it as Thumb code. */
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
+
bfd_put_32 (output_bfd, value, sgot->contents + off);
h->got.offset |= 1;
}