* [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
@ 2010-01-14 14:01 Matthew Gretton-Dann
2010-01-15 0:34 ` Alan Modra
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Gretton-Dann @ 2010-01-14 14:01 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 1807 bytes --]
Hi,
Please can someone review, approve, and commit the attached patch?
This patch fixes a bug in ld where it incorrectly reports 'relocation
truncated to fit: R_ARM_THM_JUMP24 ...' for certain relocation addends.
The following test case demonstrates the bug:
testcase.s:
.text
.syntax unified
.thumb_func
.global _start
.type _start,%function
_start:
b.w dest
.section destsect, "x"
.thumb_func
dest:
b dest
To demonstrate:
arm-none-linux-gnueabi-as -march=armv7-a -mthumb \
testcase.s -o testcase.o
arm-none-linux-gnueabi-ld -defsym _start=0x8000 \
--section-start destsect=0x00900000 \
testcase.o -o testcase
Output:
testcase.o: In function `_start':
(.text+0x0): relocation truncated to fit: R_ARM_THM_JUMP24 against
`dest'
This should never occur. Either the calculated branch offset for the
relocation should fit or ld should have created a veneer within range
and relocated to that.
In this particular case the branch is actually in range (and so no
veneer is needed), but the elf32_arm_howto_table_1 in bfd/elf32-arm.c
contains an incorrect value for the number of bits to be relocated (24
instead of 25). The fix is to just update the table.
The ChangeLog entries are as follows:
bfd/ChangeLog:
2010-01-14 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* elf32-arm.c (elf32_arm_howto_table_1): Correct bitsize of
R_ARM_THM_JUMP24 entry.
ld/testsuite/ChangeLog:
2010-01-14 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* ld-arm/jump-reloc-veneers-long.d: New test.
* ld-arm/jump-reloc-veneers-short1.d: Likewise.
* ld-arm/jump-reloc-veneers-short2.d: Likewise.
* ld-arm/jump-reloc-veneers.s: Likewise.
* ld-arm/arm-elf.exp (armelftests): Run them.
Thanks,
Matt
--
Matthew Gretton-Dann
Principal Engineer - Tools, PD Software
ARM Limited
[-- Attachment #2: 1001-jump-veneers.patch --]
[-- Type: text/x-patch, Size: 4247 bytes --]
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.218
diff -u -r1.218 elf32-arm.c
--- bfd/elf32-arm.c 28 Dec 2009 18:55:16 -0000 1.218
+++ bfd/elf32-arm.c 8 Jan 2010 15:27:57 -0000
@@ -508,7 +508,7 @@
HOWTO (R_ARM_THM_JUMP24, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 24, /* bitsize */
+ 25, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
Index: ld/testsuite/ld-arm/arm-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-arm/arm-elf.exp,v
retrieving revision 1.67
diff -u -r1.67 arm-elf.exp
--- ld/testsuite/ld-arm/arm-elf.exp 28 Dec 2009 18:55:16 -0000 1.67
+++ ld/testsuite/ld-arm/arm-elf.exp 8 Jan 2010 15:28:14 -0000
@@ -239,6 +239,24 @@
{"Relocation boundaries" "-defsym x=0 -defsym y=0 -defsym _start=0" "" {reloc-boundaries.s}
{{objdump -s reloc-boundaries.d}}
"reloc-boundaries"}
+ {"R_ARM_THM_JUMP24 Relocation veneers: Short 1"
+ "-defsym _start=0x8000 --section-start destsect=0x00009000"
+ "-march=armv7-a -mthumb"
+ {jump-reloc-veneers.s}
+ {{objdump -d jump-reloc-veneers-short1.d}}
+ "jump-reloc-veneers-short1"}
+ {"R_ARM_THM_JUMP24 Relocation veneers: Short 2"
+ "-defsym _start=0x8000 --section-start destsect=0x00900000"
+ "-march=armv7-a -mthumb"
+ {jump-reloc-veneers.s}
+ {{objdump -d jump-reloc-veneers-short2.d}}
+ "jump-reloc-veneers-short2"}
+ {"R_ARM_THM_JUMP24 Relocation veneers: Long"
+ "-defsym _start=0x8000 --section-start destsect=0x09000000"
+ "-march=armv7-a -mthumb"
+ {jump-reloc-veneers.s}
+ {{objdump -d jump-reloc-veneers-long.d}}
+ "jump-reloc-veneers-long"}
}
run_ld_link_tests $armelftests
Index: ld/testsuite/ld-arm/jump-reloc-veneers.s
===================================================================
diff -u /dev/null jump-reloc-veneers.s
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers.s 2010-01-08 10:58:48.054129000 +0000
@@ -0,0 +1,12 @@
+ .text
+ .syntax unified
+ .thumb_func
+ .global _start
+ .type _start,%function
+_start:
+ b.w dest
+
+ .section destsect, "x"
+ .thumb_func
+dest:
+ b dest
Index: ld/testsuite/ld-arm/jump-reloc-short1.d
===================================================================
diff -u /dev/null jump-reloc-veneers-short1.d
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers-short1.d 2010-01-08 11:23:43.572369000 +0000
@@ -0,0 +1,13 @@
+
+.*: file format.*
+
+
+Disassembly of section destsect:
+
+00009000 <[^>]*>:
+ 9000: e7fe b.n 9000 <dest>
+
+Disassembly of section .text:
+
+00008054 <[^>]*>:
+ 8054: f000 bfd4 b.w 9000 <dest>
Index: ld/testsuite/ld-arm/jump-reloc-short2.d
===================================================================
diff -u /dev/null jump-reloc-veneers-short2.d
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers-short2.d 2010-01-08 11:32:56.653566000 +0000
@@ -0,0 +1,13 @@
+
+.*: file format.*
+
+
+Disassembly of section destsect:
+
+00900000 <[^>]*>:
+ 900000: e7fe b.n 900000 <dest>
+
+Disassembly of section .text:
+
+00008054 <[^>]*>:
+ 8054: f0f7 9fd4 b.w 900000 <dest>
Index: ld/testsuite/ld-arm/jump-reloc-long.d
===================================================================
diff -u /dev/null jump-reloc-veneers-long.d
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers-long.d 2010-01-08 11:23:06.012845000 +0000
@@ -0,0 +1,21 @@
+
+.*: file format.*
+
+
+Disassembly of section destsect:
+
+09000000 <[^>]*>:
+ 9000000: e7fe b.n 9000000 <dest>
+
+Disassembly of section .text:
+
+00008058 <[^>]*>:
+ 8058: b802f000 .word 0xb802f000
+ 805c: 00000000 andeq r0, r0, r0
+
+00008060 <[^>]*>:
+ 8060: 4778 bx pc
+ 8062: 46c0 nop ; \(mov r8, r8\)
+ 8064: e59fc000 ldr ip, \[pc, #0\] ; 806c <__dest_veneer\+0xc>
+ 8068: e12fff1c bx ip
+ 806c: 09000001 .word 0x09000001
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-01-14 14:01 [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug Matthew Gretton-Dann
@ 2010-01-15 0:34 ` Alan Modra
2010-01-18 14:40 ` Matthew Gretton-Dann
[not found] ` <1263825396.18030.17.camel@cam03638.cambridge.arm.com>
0 siblings, 2 replies; 12+ messages in thread
From: Alan Modra @ 2010-01-15 0:34 UTC (permalink / raw)
To: Matthew Gretton-Dann; +Cc: binutils
On Thu, Jan 14, 2010 at 02:01:11PM +0000, Matthew Gretton-Dann wrote:
> HOWTO (R_ARM_THM_JUMP24, /* type */
> 1, /* rightshift */
> 2, /* size (0 = byte, 1 = short, 2 = long) */
> - 24, /* bitsize */
> + 25, /* bitsize */
> TRUE, /* pc_relative */
> 0, /* bitpos */
> complain_overflow_signed,/* complain_on_overflow */
This is odd. Normally, bitsize determines the allowed field value
after the rightshift has been applied. Hmm, I see elf32-arm.c does
it's own checking for these relocs and gets it wrong. It would be
better to leave bitsize as 24 and remove the right shift on the
reloc_signed_max calculation. You'd then need to adjust the
R_ARM_THM_JUMP24 howto.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-01-15 0:34 ` Alan Modra
@ 2010-01-18 14:40 ` Matthew Gretton-Dann
[not found] ` <1263825396.18030.17.camel@cam03638.cambridge.arm.com>
1 sibling, 0 replies; 12+ messages in thread
From: Matthew Gretton-Dann @ 2010-01-18 14:40 UTC (permalink / raw)
To: Alan Modra; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]
On Fri, 2010-01-15 at 11:04 +1030, Alan Modra wrote:
> On Thu, Jan 14, 2010 at 02:01:11PM +0000, Matthew Gretton-Dann wrote:
> > HOWTO (R_ARM_THM_JUMP24, /* type */
> > 1, /* rightshift */
> > 2, /* size (0 = byte, 1 = short, 2 = long) */
> > - 24, /* bitsize */
> > + 25, /* bitsize */
> > TRUE, /* pc_relative */
> > 0, /* bitpos */
> > complain_overflow_signed,/* complain_on_overflow */
>
> This is odd. Normally, bitsize determines the allowed field value
> after the rightshift has been applied. Hmm, I see elf32-arm.c does
> it's own checking for these relocs and gets it wrong. It would be
> better to leave bitsize as 24 and remove the right shift on the
> reloc_signed_max calculation. You'd then need to adjust the
> R_ARM_THM_JUMP24 howto.
Thank you for your comments. Please find attached an updated patch for
review and further comments.
As well as removing the right shift on the reloc_signed_max calculation
I reviewed the bitsize for the affected relocations - R_ARM_THM_JUMP24,
R_ARM_THM_CALL, R_ARM_THM_XPC22. This resulted in leaving the bitsize
for R_ARM_THM_JUMP24 and R_ARM_THM_XPC22 alone (at 24 and 22
respectively), whilst the bitsize for R_ARM_THM_CALL is now 24 (instead
of 25).
Suggested new ChangeLog entries look like:
bfd/ChangeLog:
2010-01-18 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* elf32-arm.c (elf32_arm_howto_table_1): Correct bitsize of
R_ARM_THM_CALL entry.
(elf32_arm_final_link_relocate): Correct calculation of
reloc_signed_max when doing a R_ARM_THM_CALL, R_ARM_THM_XPC22,
or R_ARM_THM_JUMP24 relocation.
ld/testsuite/ChangeLog:
2010-01-18 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* ld-arm/jump-reloc-veneers-long.d: New test.
* ld-arm/jump-reloc-veneers-short1.d: Likewise.
* ld-arm/jump-reloc-veneers-short2.d: Likewise.
* ld-arm/jump-reloc-veneers.s: Likewise.
* ld-arm/arm-elf.exp (armelftests): Run them.
Thanks,
Matt
--
Matthew Gretton-Dann
Principal Engineer - Tools, PD Software
ARM Limited
[-- Attachment #2: 1001-jump-veneers-4.patch --]
[-- Type: text/x-patch, Size: 4526 bytes --]
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.218
diff -u -r1.218 elf32-arm.c
--- bfd/elf32-arm.c 28 Dec 2009 18:55:16 -0000 1.218
+++ bfd/elf32-arm.c 18 Jan 2010 11:58:22 -0000
@@ -222,7 +222,7 @@
HOWTO (R_ARM_THM_CALL, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 25, /* bitsize */
+ 24, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
@@ -7552,7 +7552,7 @@
bitsize = howto->bitsize;
if (!thumb2)
bitsize -= 2;
- reloc_signed_max = ((1 << (bitsize - 1)) - 1) >> howto->rightshift;
+ reloc_signed_max = ((1 << (bitsize - 1)) - 1);
reloc_signed_min = ~reloc_signed_max;
/* Assumes two's complement. */
Index: ld/testsuite/ld-arm/arm-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-arm/arm-elf.exp,v
retrieving revision 1.68
diff -u -r1.68 arm-elf.exp
--- ld/testsuite/ld-arm/arm-elf.exp 13 Jan 2010 19:01:10 -0000 1.68
+++ ld/testsuite/ld-arm/arm-elf.exp 18 Jan 2010 11:58:24 -0000
@@ -241,6 +241,24 @@
{"Relocation boundaries" "-defsym x=0 -defsym y=0 -defsym _start=0" "" {reloc-boundaries.s}
{{objdump -s reloc-boundaries.d}}
"reloc-boundaries"}
+ {"R_ARM_THM_JUMP24 Relocation veneers: Short 1"
+ "-defsym _start=0x8000 --section-start destsect=0x00009000"
+ "-march=armv7-a -mthumb"
+ {jump-reloc-veneers.s}
+ {{objdump -d jump-reloc-veneers-short1.d}}
+ "jump-reloc-veneers-short1"}
+ {"R_ARM_THM_JUMP24 Relocation veneers: Short 2"
+ "-defsym _start=0x8000 --section-start destsect=0x00900000"
+ "-march=armv7-a -mthumb"
+ {jump-reloc-veneers.s}
+ {{objdump -d jump-reloc-veneers-short2.d}}
+ "jump-reloc-veneers-short2"}
+ {"R_ARM_THM_JUMP24 Relocation veneers: Long"
+ "-defsym _start=0x8000 --section-start destsect=0x09000000"
+ "-march=armv7-a -mthumb"
+ {jump-reloc-veneers.s}
+ {{objdump -d jump-reloc-veneers-long.d}}
+ "jump-reloc-veneers-long"}
}
run_ld_link_tests $armelftests
Index: ld/testsuite/ld-arm/jump-reloc-veneers.s
===================================================================
diff -u /dev/null jump-reloc-veneers.s
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers.s 2010-01-08 10:58:48.054129000 +0000
@@ -0,0 +1,12 @@
+ .text
+ .syntax unified
+ .thumb_func
+ .global _start
+ .type _start,%function
+_start:
+ b.w dest
+
+ .section destsect, "x"
+ .thumb_func
+dest:
+ b dest
Index: ld/testsuite/ld-arm/jump-reloc-short1.d
===================================================================
diff -u /dev/null jump-reloc-veneers-short1.d
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers-short1.d 2010-01-08 11:23:43.572369000 +0000
@@ -0,0 +1,13 @@
+
+.*: file format.*
+
+
+Disassembly of section destsect:
+
+00009000 <[^>]*>:
+ 9000: e7fe b.n 9000 <dest>
+
+Disassembly of section .text:
+
+00008054 <[^>]*>:
+ 8054: f000 bfd4 b.w 9000 <dest>
Index: ld/testsuite/ld-arm/jump-reloc-short2.d
===================================================================
diff -u /dev/null jump-reloc-veneers-short2.d
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers-short2.d 2010-01-08 11:32:56.653566000 +0000
@@ -0,0 +1,13 @@
+
+.*: file format.*
+
+
+Disassembly of section destsect:
+
+00900000 <[^>]*>:
+ 900000: e7fe b.n 900000 <dest>
+
+Disassembly of section .text:
+
+00008054 <[^>]*>:
+ 8054: f0f7 9fd4 b.w 900000 <dest>
Index: ld/testsuite/ld-arm/jump-reloc-long.d
===================================================================
diff -u /dev/null jump-reloc-veneers-long.d
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers-long.d 2010-01-08 11:23:06.012845000 +0000
@@ -0,0 +1,21 @@
+
+.*: file format.*
+
+
+Disassembly of section destsect:
+
+09000000 <[^>]*>:
+ 9000000: e7fe b.n 9000000 <dest>
+
+Disassembly of section .text:
+
+00008058 <[^>]*>:
+ 8058: b802f000 .word 0xb802f000
+ 805c: 00000000 andeq r0, r0, r0
+
+00008060 <[^>]*>:
+ 8060: 4778 bx pc
+ 8062: 46c0 nop ; \(mov r8, r8\)
+ 8064: e59fc000 ldr ip, \[pc, #0\] ; 806c <__dest_veneer\+0xc>
+ 8068: e12fff1c bx ip
+ 806c: 09000001 .word 0x09000001
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
[not found] ` <1263825396.18030.17.camel@cam03638.cambridge.arm.com>
@ 2010-01-19 4:02 ` Alan Modra
2010-01-25 12:00 ` Matthew Gretton-Dann
0 siblings, 1 reply; 12+ messages in thread
From: Alan Modra @ 2010-01-19 4:02 UTC (permalink / raw)
To: Matthew Gretton-Dann; +Cc: binutils
On Mon, Jan 18, 2010 at 02:36:36PM +0000, Matthew Gretton-Dann wrote:
> * elf32-arm.c (elf32_arm_howto_table_1): Correct bitsize of
> R_ARM_THM_CALL entry.
> (elf32_arm_final_link_relocate): Correct calculation of
> reloc_signed_max when doing a R_ARM_THM_CALL, R_ARM_THM_XPC22,
> or R_ARM_THM_JUMP24 relocation.
Applied.
> * ld-arm/jump-reloc-veneers-long.d: New test.
> * ld-arm/jump-reloc-veneers-short1.d: Likewise.
> * ld-arm/jump-reloc-veneers-short2.d: Likewise.
> * ld-arm/jump-reloc-veneers.s: Likewise.
> * ld-arm/arm-elf.exp (armelftests): Run them.
One of these tests fails on arm-linux with current mainline sources.
Please retest and fix.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-01-19 4:02 ` Alan Modra
@ 2010-01-25 12:00 ` Matthew Gretton-Dann
2010-01-29 14:49 ` Nick Clifton
2010-02-02 9:44 ` Christophe LYON
0 siblings, 2 replies; 12+ messages in thread
From: Matthew Gretton-Dann @ 2010-01-25 12:00 UTC (permalink / raw)
To: Alan Modra; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 1464 bytes --]
On Tue, 2010-01-19 at 14:32 +1030, Alan Modra wrote:
> On Mon, Jan 18, 2010 at 02:36:36PM +0000, Matthew Gretton-Dann wrote:
> > * ld-arm/jump-reloc-veneers-long.d: New test.
> > * ld-arm/jump-reloc-veneers-short1.d: Likewise.
> > * ld-arm/jump-reloc-veneers-short2.d: Likewise.
> > * ld-arm/jump-reloc-veneers.s: Likewise.
> > * ld-arm/arm-elf.exp (armelftests): Run them.
>
> One of these tests fails on arm-linux with current mainline sources.
> Please retest and fix.
Apologies for the delay in responding.
The failing test is because targets supporting the old ABI do not
support Thumb-2. Nor do I believe that there are any plans to add this
support.
The attached patch moves the new tests to only run under arm*-*-*eabi
targets.
There are other tests currently run for all ARM targets that make use of
Thumb-2 and therefore fail under the old ABI. If the current patch is
approved I will submit a second one which moves these tests so that they
only run under the new ABI.
Suggested ld/testsuite/ChangeLog entry is:
2010-01-18 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* ld-arm/jump-reloc-veneers-long.d: New test.
* ld-arm/jump-reloc-veneers-short1.d: Likewise.
* ld-arm/jump-reloc-veneers-short2.d: Likewise.
* ld-arm/jump-reloc-veneers.s: Likewise.
* ld-arm/arm-elf.exp (armelftests): Run them.
Thanks,
Matt
--
Matthew Gretton-Dann
Principal Engineer - Tools, PD Software
ARM Limited
[-- Attachment #2: 1001-jump-veneers-tests.patch --]
[-- Type: text/x-patch, Size: 3675 bytes --]
Index: ld/testsuite/ld-arm/arm-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-arm/arm-elf.exp,v
retrieving revision 1.68
diff -u -p -r1.68 arm-elf.exp
--- ld/testsuite/ld-arm/arm-elf.exp 13 Jan 2010 19:01:10 -0000 1.68
+++ ld/testsuite/ld-arm/arm-elf.exp 25 Jan 2010 11:51:07 -0000
@@ -433,6 +433,25 @@ set armeabitests {
{"Long branch with mixed text and data" "-T arm.ld" "" {farcall-data.s}
{{objdump -dr farcall-data.d}}
"farcall-data"}
+
+ {"R_ARM_THM_JUMP24 Relocation veneers: Short 1"
+ "-defsym _start=0x8000 --section-start destsect=0x00009000"
+ "-march=armv7-a -mthumb"
+ {jump-reloc-veneers.s}
+ {{objdump -d jump-reloc-veneers-short1.d}}
+ "jump-reloc-veneers-short1"}
+ {"R_ARM_THM_JUMP24 Relocation veneers: Short 2"
+ "-defsym _start=0x8000 --section-start destsect=0x00900000"
+ "-march=armv7-a -mthumb"
+ {jump-reloc-veneers.s}
+ {{objdump -d jump-reloc-veneers-short2.d}}
+ "jump-reloc-veneers-short2"}
+ {"R_ARM_THM_JUMP24 Relocation veneers: Long"
+ "-defsym _start=0x8000 --section-start destsect=0x09000000"
+ "-march=armv7-a -mthumb"
+ {jump-reloc-veneers.s}
+ {{objdump -d jump-reloc-veneers-long.d}}
+ "jump-reloc-veneers-long"}
}
run_ld_link_tests $armeabitests
Index: ld/testsuite/ld-arm/jump-reloc-veneers.s
===================================================================
diff -u /dev/null jump-reloc-veneers.s
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers.s 2010-01-08 10:58:48.054129000 +0000
@@ -0,0 +1,12 @@
+ .text
+ .syntax unified
+ .thumb_func
+ .global _start
+ .type _start,%function
+_start:
+ b.w dest
+
+ .section destsect, "x"
+ .thumb_func
+dest:
+ b dest
Index: ld/testsuite/ld-arm/jump-reloc-short1.d
===================================================================
diff -u /dev/null jump-reloc-veneers-short1.d
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers-short1.d 2010-01-08 11:23:43.572369000 +0000
@@ -0,0 +1,13 @@
+
+.*: file format.*
+
+
+Disassembly of section destsect:
+
+00009000 <[^>]*>:
+ 9000: e7fe b.n 9000 <dest>
+
+Disassembly of section .text:
+
+00008054 <[^>]*>:
+ 8054: f000 bfd4 b.w 9000 <dest>
Index: ld/testsuite/ld-arm/jump-reloc-short2.d
===================================================================
diff -u /dev/null jump-reloc-veneers-short2.d
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers-short2.d 2010-01-08 11:32:56.653566000 +0000
@@ -0,0 +1,13 @@
+
+.*: file format.*
+
+
+Disassembly of section destsect:
+
+00900000 <[^>]*>:
+ 900000: e7fe b.n 900000 <dest>
+
+Disassembly of section .text:
+
+00008054 <[^>]*>:
+ 8054: f0f7 9fd4 b.w 900000 <dest>
Index: ld/testsuite/ld-arm/jump-reloc-long.d
===================================================================
diff -u /dev/null jump-reloc-veneers-long.d
--- /dev/null 2009-05-17 13:34:33.498340648 +0100
+++ ld/testsuite/ld-arm/jump-reloc-veneers-long.d 2010-01-08 11:23:06.012845000 +0000
@@ -0,0 +1,21 @@
+
+.*: file format.*
+
+
+Disassembly of section destsect:
+
+09000000 <[^>]*>:
+ 9000000: e7fe b.n 9000000 <dest>
+
+Disassembly of section .text:
+
+00008058 <[^>]*>:
+ 8058: b802f000 .word 0xb802f000
+ 805c: 00000000 andeq r0, r0, r0
+
+00008060 <[^>]*>:
+ 8060: 4778 bx pc
+ 8062: 46c0 nop ; \(mov r8, r8\)
+ 8064: e59fc000 ldr ip, \[pc, #0\] ; 806c <__dest_veneer\+0xc>
+ 8068: e12fff1c bx ip
+ 806c: 09000001 .word 0x09000001
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-01-25 12:00 ` Matthew Gretton-Dann
@ 2010-01-29 14:49 ` Nick Clifton
2010-02-01 10:45 ` Ramana Radhakrishnan
2010-02-02 9:44 ` Christophe LYON
1 sibling, 1 reply; 12+ messages in thread
From: Nick Clifton @ 2010-01-29 14:49 UTC (permalink / raw)
To: Matthew Gretton-Dann; +Cc: Alan Modra, binutils
Hi Matt,
> There are other tests currently run for all ARM targets that make use of
> Thumb-2 and therefore fail under the old ABI. If the current patch is
> approved I will submit a second one which moves these tests so that they
> only run under the new ABI.
Please do so.
> 2010-01-18 Matthew Gretton-Dann<matthew.gretton-dann@arm.com>
>
> * ld-arm/jump-reloc-veneers-long.d: New test.
> * ld-arm/jump-reloc-veneers-short1.d: Likewise.
> * ld-arm/jump-reloc-veneers-short2.d: Likewise.
> * ld-arm/jump-reloc-veneers.s: Likewise.
> * ld-arm/arm-elf.exp (armelftests): Run them.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-01-29 14:49 ` Nick Clifton
@ 2010-02-01 10:45 ` Ramana Radhakrishnan
2010-02-01 11:14 ` Tristan Gingold
0 siblings, 1 reply; 12+ messages in thread
From: Ramana Radhakrishnan @ 2010-02-01 10:45 UTC (permalink / raw)
To: Nick Clifton, gingold; +Cc: Matthew Gretton-Dann, Alan Modra, binutils
>
> Approved - please apply.
Since Matthew doesn't have commit rights - I took care of committing
this into trunk for him .
Tristan : Can this and the previous bit that fixes this in bfd be
backported to the 2.20 branch ?
http://sourceware.org/ml/binutils/2010-01/msg00520.html
cheers
Ramana
>
> Cheers
> Nick
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-02-01 10:45 ` Ramana Radhakrishnan
@ 2010-02-01 11:14 ` Tristan Gingold
2010-02-19 14:48 ` Matthew Gretton-Dann
0 siblings, 1 reply; 12+ messages in thread
From: Tristan Gingold @ 2010-02-01 11:14 UTC (permalink / raw)
To: ramana.radhakrishnan
Cc: Nick Clifton, Matthew Gretton-Dann, Alan Modra, binutils
On Feb 1, 2010, at 11:44 AM, Ramana Radhakrishnan wrote:
>
>>
>> Approved - please apply.
>
> Since Matthew doesn't have commit rights - I took care of committing
> this into trunk for him .
>
> Tristan : Can this and the previous bit that fixes this in bfd be
> backported to the 2.20 branch ?
Sure.
Tristan.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-01-25 12:00 ` Matthew Gretton-Dann
2010-01-29 14:49 ` Nick Clifton
@ 2010-02-02 9:44 ` Christophe LYON
2010-02-02 14:22 ` Matthew Gretton-Dann
1 sibling, 1 reply; 12+ messages in thread
From: Christophe LYON @ 2010-02-02 9:44 UTC (permalink / raw)
To: Matthew Gretton-Dann; +Cc: binutils
Hello,
>
> 2010-01-18 Matthew Gretton-Dann<matthew.gretton-dann@arm.com>
>
> * ld-arm/jump-reloc-veneers-long.d: New test.
> * ld-arm/jump-reloc-veneers-short1.d: Likewise.
> * ld-arm/jump-reloc-veneers-short2.d: Likewise.
> * ld-arm/jump-reloc-veneers.s: Likewise.
> * ld-arm/arm-elf.exp (armelftests): Run them.
>
On a trunk extracted yesterday, I observe that all these tests fail
(target arm-none-eabi).
There seem to be a discrepancy between the start address defined as
-defsym _start=0x8000 in arm-elf.exp and expected to be
00008054 <[^>]*>:
8054: f000 bfd4 b.w 9000 <dest>
in jump-reloc-venners-short1.d for instance.
Am I missing something?
Christophe.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-02-02 9:44 ` Christophe LYON
@ 2010-02-02 14:22 ` Matthew Gretton-Dann
2010-02-03 13:41 ` Richard Earnshaw
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Gretton-Dann @ 2010-02-02 14:22 UTC (permalink / raw)
To: Christophe LYON; +Cc: binutils, Ramana Radhakrishnan
[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]
Hi,
On Tue, 2010-02-02 at 10:44 +0100, Christophe LYON wrote:
> > 2010-01-18 Matthew Gretton-Dann<matthew.gretton-dann@arm.com>
> >
> > * ld-arm/jump-reloc-veneers-long.d: New test.
> > * ld-arm/jump-reloc-veneers-short1.d: Likewise.
> > * ld-arm/jump-reloc-veneers-short2.d: Likewise.
> > * ld-arm/jump-reloc-veneers.s: Likewise.
> > * ld-arm/arm-elf.exp (armelftests): Run them.
> >
>
> On a trunk extracted yesterday, I observe that all these tests fail
> (target arm-none-eabi).
> There seem to be a discrepancy between the start address defined as
> -defsym _start=0x8000 in arm-elf.exp and expected to be
> 00008054 <[^>]*>:
> 8054: f000 bfd4 b.w 9000 <dest>
> in jump-reloc-venners-short1.d for instance.
>
> Am I missing something?
No - I didn't make the test cases cope with bare-metal targets properly.
Please find attached a patch which corrects the test cases to work with
arm-none-eabi as well as the other ARM targets. I have tested this on
arm-none-eabi, arm-none-elf, arm-linux, and arm-unknown-linux-gnueabi,
with no regressions.
Please can someone review and approve the patch, and then commit? A
suggested ChangeLog is
2010-02-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* ld-arm/jump-reloc-veneers-long.d: Correct testcase for
arm-none-eabi target.
* ld-arm/jump-reloc-veneers-short1.d: Likewise
* ld-arm/jump-reloc-veneers-short2.d: Likewise
Thanks,
Matt
--
Matthew Gretton-Dann
Principal Engineer - Tools, PD Software
ARM Limited
[-- Attachment #2: 1001-jump-veneers-test.patch --]
[-- Type: text/x-patch, Size: 2393 bytes --]
Index: ld/testsuite/ld-arm/jump-reloc-veneers-long.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-arm/jump-reloc-veneers-long.d,v
retrieving revision 1.1
diff -u -p -r1.1 jump-reloc-veneers-long.d
--- ld/testsuite/ld-arm/jump-reloc-veneers-long.d 1 Feb 2010 10:33:16 -0000 1.1
+++ ld/testsuite/ld-arm/jump-reloc-veneers-long.d 2 Feb 2010 13:44:33 -0000
@@ -9,13 +9,13 @@ Disassembly of section destsect:
Disassembly of section .text:
-00008058 <[^>]*>:
- 8058: b802f000 .word 0xb802f000
- 805c: 00000000 andeq r0, r0, r0
+000080.. <[^>]*>:
+ 80..: b802f000 .word 0xb802f000
+ 80..: 00000000 andeq r0, r0, r0
-00008060 <[^>]*>:
- 8060: 4778 bx pc
- 8062: 46c0 nop ; \(mov r8, r8\)
- 8064: e59fc000 ldr ip, \[pc, #0\] ; 806c <__dest_veneer\+0xc>
- 8068: e12fff1c bx ip
- 806c: 09000001 .word 0x09000001
+000080.. <[^>]*>:
+ 80..: 4778 bx pc
+ 80..: 46c0 nop ; \(mov r8, r8\)
+ 80..: e59fc000 ldr ip, \[pc, #0\] ; 80.. <__dest_veneer\+0xc>
+ 80..: e12fff1c bx ip
+ 80..: 09000001 .word 0x09000001
Index: ld/testsuite/ld-arm/jump-reloc-veneers-short1.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-arm/jump-reloc-veneers-short1.d,v
retrieving revision 1.1
diff -u -p -r1.1 jump-reloc-veneers-short1.d
--- ld/testsuite/ld-arm/jump-reloc-veneers-short1.d 1 Feb 2010 10:33:16 -0000 1.1
+++ ld/testsuite/ld-arm/jump-reloc-veneers-short1.d 2 Feb 2010 13:44:33 -0000
@@ -9,5 +9,5 @@ Disassembly of section destsect:
Disassembly of section .text:
-00008054 <[^>]*>:
- 8054: f000 bfd4 b.w 9000 <dest>
+000080.. <[^>]*>:
+ 80..: f000 bf.. b.w 9000 <dest>
Index: ld/testsuite/ld-arm/jump-reloc-veneers-short2.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-arm/jump-reloc-veneers-short2.d,v
retrieving revision 1.1
diff -u -p -r1.1 jump-reloc-veneers-short2.d
--- ld/testsuite/ld-arm/jump-reloc-veneers-short2.d 1 Feb 2010 10:33:16 -0000 1.1
+++ ld/testsuite/ld-arm/jump-reloc-veneers-short2.d 2 Feb 2010 13:44:33 -0000
@@ -9,5 +9,5 @@ Disassembly of section destsect:
Disassembly of section .text:
-00008054 <[^>]*>:
- 8054: f0f7 9fd4 b.w 900000 <dest>
+000080.. <[^>]*>:
+ 80..: f0f7 9f.. b.w 900000 <dest>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-02-02 14:22 ` Matthew Gretton-Dann
@ 2010-02-03 13:41 ` Richard Earnshaw
0 siblings, 0 replies; 12+ messages in thread
From: Richard Earnshaw @ 2010-02-03 13:41 UTC (permalink / raw)
To: Matthew Gretton-Dann; +Cc: Christophe LYON, binutils, Ramana Radhakrishnan
On Tue, 2010-02-02 at 14:22 +0000, Matthew Gretton-Dann wrote:
> Hi,
>
> On Tue, 2010-02-02 at 10:44 +0100, Christophe LYON wrote:
> > > 2010-01-18 Matthew Gretton-Dann<matthew.gretton-dann@arm.com>
> > >
> > > * ld-arm/jump-reloc-veneers-long.d: New test.
> > > * ld-arm/jump-reloc-veneers-short1.d: Likewise.
> > > * ld-arm/jump-reloc-veneers-short2.d: Likewise.
> > > * ld-arm/jump-reloc-veneers.s: Likewise.
> > > * ld-arm/arm-elf.exp (armelftests): Run them.
> > >
> >
> > On a trunk extracted yesterday, I observe that all these tests fail
> > (target arm-none-eabi).
> > There seem to be a discrepancy between the start address defined as
> > -defsym _start=0x8000 in arm-elf.exp and expected to be
> > 00008054 <[^>]*>:
> > 8054: f000 bfd4 b.w 9000 <dest>
> > in jump-reloc-venners-short1.d for instance.
> >
> > Am I missing something?
>
> No - I didn't make the test cases cope with bare-metal targets properly.
>
> Please find attached a patch which corrects the test cases to work with
> arm-none-eabi as well as the other ARM targets. I have tested this on
> arm-none-eabi, arm-none-elf, arm-linux, and arm-unknown-linux-gnueabi,
> with no regressions.
>
> Please can someone review and approve the patch, and then commit? A
> suggested ChangeLog is
>
> 2010-02-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
>
> * ld-arm/jump-reloc-veneers-long.d: Correct testcase for
> arm-none-eabi target.
> * ld-arm/jump-reloc-veneers-short1.d: Likewise
> * ld-arm/jump-reloc-veneers-short2.d: Likewise
This is OK, but could someone else please check it in.
R.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug
2010-02-01 11:14 ` Tristan Gingold
@ 2010-02-19 14:48 ` Matthew Gretton-Dann
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Gretton-Dann @ 2010-02-19 14:48 UTC (permalink / raw)
To: Tristan Gingold; +Cc: ramana.radhakrishnan, Nick Clifton, Alan Modra, binutils
On Mon, 2010-02-01 at 12:14 +0100, Tristan Gingold wrote:
> On Feb 1, 2010, at 11:44 AM, Ramana Radhakrishnan wrote:
>
> >
> >>
> >> Approved - please apply.
> >
> > Since Matthew doesn't have commit rights - I took care of committing
> > this into trunk for him .
> >
> > Tristan : Can this and the previous bit that fixes this in bfd be
> > backported to the 2.20 branch ?
>
> Sure.
>
> Tristan.
This has now been done.
Thanks,
Matt
--
Matthew Gretton-Dann
Principal Engineer - Tools, PD Software
ARM Limited
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-02-19 14:48 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-14 14:01 [Patch/RFA]: Patch to fix R_ARM_THM_JUMP24 relocation truncated bug Matthew Gretton-Dann
2010-01-15 0:34 ` Alan Modra
2010-01-18 14:40 ` Matthew Gretton-Dann
[not found] ` <1263825396.18030.17.camel@cam03638.cambridge.arm.com>
2010-01-19 4:02 ` Alan Modra
2010-01-25 12:00 ` Matthew Gretton-Dann
2010-01-29 14:49 ` Nick Clifton
2010-02-01 10:45 ` Ramana Radhakrishnan
2010-02-01 11:14 ` Tristan Gingold
2010-02-19 14:48 ` Matthew Gretton-Dann
2010-02-02 9:44 ` Christophe LYON
2010-02-02 14:22 ` Matthew Gretton-Dann
2010-02-03 13:41 ` Richard Earnshaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).