This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [ARM] gas miscompiles ADR statement
Hi Nick,
Here's what I committed.
gas/ChangeLog
* config/tc-arm.c (arm_force_relocation): Return 0 for ARM_IMMEDIATE
and ARM_ADRL_IMMEDIATE.
gas/testsuite/ChangeLog
* gas/arm/adrl.s: Test behaviour against globals too.
* gas/arm/adrl.d: Adjust.
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.132
diff -u -p -r1.132 tc-arm.c
--- gas/config/tc-arm.c 30 Nov 2002 08:39:42 -0000 1.132
+++ gas/config/tc-arm.c 3 Dec 2002 08:01:28 -0000
@@ -11526,6 +11526,11 @@ arm_force_relocation (fixp)
|| fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BRANCH23)
return 1;
+ /* Resolve these relocations even if the symbol is extern or weak. */
+ if (fixp->fx_r_type == BFD_RELOC_ARM_IMMEDIATE
+ || fixp->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE)
+ return 0;
+
return S_FORCE_RELOC (fixp->fx_addsy);
}
Index: gas/testsuite/gas/arm/adrl.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/adrl.d,v
retrieving revision 1.4
diff -u -p -r1.4 adrl.d
--- gas/testsuite/gas/arm/adrl.d 21 Jun 2001 19:46:54 -0000 1.4
+++ gas/testsuite/gas/arm/adrl.d 3 Dec 2002 11:24:26 -0000
@@ -17,4 +17,10 @@ Disassembly of section .text:
0+201c <.*> e1a00000 nop \(mov r0,r0\)
0+2020 <.*> 028f0000 addeq r0, pc, #0 ; 0x0
0+2024 <.*> e1a00000 nop \(mov r0,r0\)
+0+2028 <.*> e24f0030 sub r0, pc, #48 ; 0x30
+0+202c <.*> e2400c20 sub r0, r0, #8192 ; 0x2000
+0+2030 <.*> e28f0c21 add r0, pc, #8448 ; 0x2100
+0+2034 <.*> e1a00000 nop \(mov r0,r0\)
+ ...
+0+4030 <.*> e28fec01 add lr, pc, #256 ; 0x100
...
Index: gas/testsuite/gas/arm/adrl.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/adrl.s,v
retrieving revision 1.3
diff -u -p -r1.3 adrl.s
--- gas/testsuite/gas/arm/adrl.s 21 Jun 2001 19:46:54 -0000 1.3
+++ gas/testsuite/gas/arm/adrl.s 3 Dec 2002 11:24:26 -0000
@@ -1,7 +1,8 @@
@ test ADRL pseudo-op
-.text
-foo:
-.align 0
+ .text
+ .global foo
+foo:
+ .align 0
1:
.space 8192
2:
@@ -11,5 +12,12 @@ foo:
adrl r0, 2f
adrEQl r0, 2f
2:
- .space 8200
+ adrl r0, foo
+ adrl r0, X
+ .space 8184
1:
+ adral lr, X
+ .space 0x0104
+
+ .globl X;
+X:
--
Alan Modra
IBM OzLabs - Linux Technology Centre