This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Need help with arm-wince-pe failures
- From: Zack Weinberg <zack at codesourcery dot com>
- To: binutils <binutils at sourceware dot org>
- Cc: Nick Clifton <nickc at redhat dot com>
- Date: Mon, 27 Jun 2005 19:35:40 -0700
- Subject: Re: Need help with arm-wince-pe failures
- References: <87br5rqofg.fsf@codesourcery.com>
Zack Weinberg <zack@codesourcery.com> writes:
> Since I rewrote tc-arm.c we've been getting these failures in the GAS
> testsuite for arm-wince-pe:
>
> FAIL: ARM basic instructions (WinCE version)
> FAIL: ARM arm7t (WinCE version)
> FAIL: ARM architecture 4t instructions
> FAIL: immediate expressions
> FAIL: OFFSET_IMM regression
After a little more spelunking and the restoration of three
#ifndef TE_WINCE blocks that got lost, I have instead the failures
FAIL: ARM ldr with immediate constant (WinCE version)
FAIL: ARM arm7t (WinCE version)
FAIL: ARM CoProcessor Instructions (WinCE version)
... and it is my belief that these three test cases are wrong; their
expectations should not differ from their non-WinCE counterparts.
Here is a cut-down version of all three tests:
.text
.align 0
l:
ldr r0, m
m:
ldr r0, n
n:
ldc p0, c8, o
o:
When assembled (after applying the appended patch) and disassembled
with objdump -dr -marmv5, targeting either arm-wince-pe or arm-elf,
the result is as follows:
Disassembly of section .text:
00000000 <l>:
0: e51f0004 ldr r0, [pc, #-4] ; 4 <m>
00000004 <m>:
4: e51f0004 ldr r0, [pc, #-4] ; 8 <n>
00000008 <n>:
8: ed1f8001 ldc 0, cr8, [pc, #-4]
It *appears*, based on inspection of the old tc-arm.c, that the WinCE
special case for PC-relative offsets is meant to apply only to branch
instructions. I could be wrong about that. However, even if it
isn't, surely it must only apply to relocations surviving into the
object file. As there are no relocations in this object file, the
offsets that are coded into the instructions should be correct for the
architecture -- in other words, they should be the same on
arm-wince-pe as on arm-elf.
Thoughts? If I am correct, I propose to apply the appended patch plus
a testsuite patch to cease special-casing the above tests.
zw
* gas/config/tc-arm.c (encode_arm_addr_mode_2)
(encode_arm_addr_mode_3, encode_arm_cp_address): Do not
adjust X_add_number by -8 for pc-relative when TE_WINCE is
defined.
===================================================================
Index: gas/config/tc-arm.c
--- gas/config/tc-arm.c 13 Jun 2005 15:34:37 -0000 1.210
+++ gas/config/tc-arm.c 28 Jun 2005 02:20:27 -0000
@@ -4075,8 +4075,10 @@ encode_arm_addr_mode_2 (int i, bfd_boole
{
if (inst.reloc.type == BFD_RELOC_UNUSED)
inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM;
+#ifndef TE_WINCE
if (inst.reloc.pc_rel)
inst.reloc.exp.X_add_number -= 8; /* pipeline offset */
+#endif
}
}
@@ -4107,8 +4109,10 @@ encode_arm_addr_mode_3 (int i, bfd_boole
inst.instruction |= HWOFFSET_IMM;
if (inst.reloc.type == BFD_RELOC_UNUSED)
inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM8;
+#ifndef TE_WINCE
if (inst.reloc.pc_rel)
inst.reloc.exp.X_add_number -= 8; /* pipeline offset */
+#endif
}
}
@@ -4161,8 +4165,10 @@ encode_arm_cp_address (int i, int wb_ok,
inst.reloc.type = reloc_override;
else
inst.reloc.type = BFD_RELOC_ARM_CP_OFF_IMM;
+#ifndef TE_WINCE
if (inst.reloc.pc_rel)
inst.reloc.exp.X_add_number -= 8;
+#endif
return SUCCESS;
}