From 12d6b0b7ba4c753349cc4a87986ef093959e3a77 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 10 Nov 2010 13:36:31 +0000 Subject: [PATCH] gas/ * config/tc-arm.c (do_t_branch): Treat (PLT) branches as wide. gas/testsuite/ * gas/arm/plt-1.s, gas/arm/plt-1.d: New test. --- gas/ChangeLog | 4 ++++ gas/config/tc-arm.c | 6 ++++-- gas/testsuite/ChangeLog | 4 ++++ gas/testsuite/gas/arm/plt-1.d | 38 +++++++++++++++++++++++++++++++++++ gas/testsuite/gas/arm/plt-1.s | 27 +++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 gas/testsuite/gas/arm/plt-1.d create mode 100644 gas/testsuite/gas/arm/plt-1.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 8433afde61..9fee273103 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2010-11-10 Richard Sandiford + + * config/tc-arm.c (do_t_branch): Treat (PLT) branches as wide. + 2010-11-05 Nick Clifton * config/tc-cr16.c (getprocreg_image): Fix typo MAX_PREG -> diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 8dd342bdec..9a8734293c 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -2213,7 +2213,7 @@ create_neon_reg_alias (char *newname, char *p) struct reg_entry mybasereg; struct neon_type ntype; struct neon_typed_alias typeinfo; - char *namebuf, *nameend; + char *namebuf, *nameend ATTRIBUTE_UNUSED; int namelen; typeinfo.defined = 0; @@ -9683,7 +9683,9 @@ do_t_branch (void) else opcode = inst.instruction; - if (unified_syntax && inst.size_req == 4) + if (unified_syntax + && (inst.size_req == 4 + || (inst.size_req != 2 && inst.operands[0].hasreloc))) { inst.instruction = THUMB_OP32(opcode); if (cond == COND_ALWAYS) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 7c4bdc2184..b6e621903f 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-11-10 Richard Sandiford + + * gas/arm/plt-1.s, gas/arm/plt-1.d: New test. + 2010-11-08 Thomas Schwinge * lib/gas-defs.exp (is_elf_format): Consider for *-*-gnu*, too. diff --git a/gas/testsuite/gas/arm/plt-1.d b/gas/testsuite/gas/arm/plt-1.d new file mode 100644 index 0000000000..ba25f8de19 --- /dev/null +++ b/gas/testsuite/gas/arm/plt-1.d @@ -0,0 +1,38 @@ +# name: Thumb branch to PLT +# as: +# objdump: -dr +# This test is only valid on ELF based ports. +#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* + +.*: +file format .*arm.* + + +Disassembly of section \.text: + +0+000 : + 0: f7ff bffe b\.w 12 + 0: R_ARM_THM_JUMP24 Strong2 + 4: f7ff bffe b\.w 12 + 4: R_ARM_THM_JUMP24 Strong2 + 8: e7fe b\.n 12 + 8: R_ARM_THM_JUMP11 Strong2 + a: e7fe b\.n 12 + a: R_ARM_THM_JUMP11 Strong2 + c: f7ff bffe b\.w 12 + c: R_ARM_THM_JUMP24 Strong2 + 10: e7fe b\.n 12 + 10: R_ARM_THM_JUMP11 Strong2 + +0+012 : + 12: f7ff bffe b\.w 0 + 12: R_ARM_THM_JUMP24 Strong1 + 16: f7ff bffe b\.w 0 + 16: R_ARM_THM_JUMP24 Strong1 + 1a: e7fe b\.n 0 + 1a: R_ARM_THM_JUMP11 Strong1 + 1c: e7fe b\.n 0 + 1c: R_ARM_THM_JUMP11 Strong1 + 1e: f7ff bffe b\.w 0 + 1e: R_ARM_THM_JUMP24 Strong1 + 22: e7fe b\.n 0 + 22: R_ARM_THM_JUMP11 Strong1 diff --git a/gas/testsuite/gas/arm/plt-1.s b/gas/testsuite/gas/arm/plt-1.s new file mode 100644 index 0000000000..262980a9f3 --- /dev/null +++ b/gas/testsuite/gas/arm/plt-1.s @@ -0,0 +1,27 @@ + .syntax unified + .text + .thumb + + .globl Strong1 + .thumb_func + .type Strong1, %function +Strong1: + b Strong2(PLT) + b.w Strong2(PLT) + b.n Strong2(PLT) + b Strong2 + b.w Strong2 + b.n Strong2 + .size Strong1,.-Strong1 + + .globl Strong2 + .thumb_func + .type Strong2, %function +Strong2: + b Strong1(PLT) + b.w Strong1(PLT) + b.n Strong1(PLT) + b Strong1 + b.w Strong1 + b.n Strong1 + .size Strong2, .-Strong2 -- 2.34.1