aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-arm.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-03-17 22:12:08 +0000
committerNick Clifton <nickc@redhat.com>2000-03-17 22:12:08 +0000
commit43f0557653880cb719739df472b62a33cd173126 (patch)
tree0679a9cdffdfed1f50f3504b8c390d918c771dc2 /gas/config/tc-arm.c
parent1cc26dd06aeda2ee10bfea1b4db511a101b5b545 (diff)
downloadgdb-43f0557653880cb719739df472b62a33cd173126.zip
gdb-43f0557653880cb719739df472b62a33cd173126.tar.gz
gdb-43f0557653880cb719739df472b62a33cd173126.tar.bz2
Fix adr pseudo op for Thumb.
Diffstat (limited to 'gas/config/tc-arm.c')
-rw-r--r--gas/config/tc-arm.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 57f8faa..58dd3cf 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -2642,8 +2642,7 @@ do_adr (str, flags)
unsigned long flags;
{
/* This is a pseudo-op of the form "adr rd, label" to be converted
- into a relative address of the form "add rd, pc, #label-.-8" */
-
+ into a relative address of the form "add rd, pc, #label-.-8". */
skip_whitespace (str);
if (reg_required_here (&str, 12) == FAIL
@@ -2654,10 +2653,11 @@ do_adr (str, flags)
inst.error = BAD_ARGS;
return;
}
+
/* Frag hacking will turn this into a sub instruction if the offset turns
out to be negative. */
inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE;
- inst.reloc.exp.X_add_number -= 8; /* PC relative adjust */
+ inst.reloc.exp.X_add_number -= 8; /* PC relative adjust. */
inst.reloc.pc_rel = 1;
inst.instruction |= flags;
end_of_line (str);
@@ -4905,11 +4905,15 @@ static void
do_t_adr (str)
char * str;
{
+ int reg;
+
/* This is a pseudo-op of the form "adr rd, label" to be converted
- into a relative address of the form "add rd, pc, #label-.-4" */
+ into a relative address of the form "add rd, pc, #label-.-4". */
skip_whitespace (str);
- if (reg_required_here (&str, 4) == FAIL /* Store Rd in temporary location inside instruction. */
+ /* Store Rd in temporary location inside instruction. */
+ if ((reg = reg_required_here (&str, 4)) == FAIL
+ || (reg > 7) /* For Thumb reg must be r0..r7. */
|| skip_past_comma (&str) == FAIL
|| my_get_expression (&inst.reloc.exp, &str))
{
@@ -4919,9 +4923,10 @@ do_t_adr (str)
}
inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD;
- inst.reloc.exp.X_add_number -= 4; /* PC relative adjust */
+ inst.reloc.exp.X_add_number -= 4; /* PC relative adjust. */
inst.reloc.pc_rel = 1;
- inst.instruction |= REG_PC; /* Rd is already placed into the instruction */
+ inst.instruction |= REG_PC; /* Rd is already placed into the instruction. */
+
end_of_line (str);
}