This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
ARM adrl test
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Thu, 5 Dec 2002 22:15:05 +1030
- Subject: ARM adrl test
You'd think by now that I'd know to pad out tests to a suitable
power of 2 so that nop filling difference between object flavours
didn't cause test failures. Ah well, the testsuite change cures
an arm-aout failure introduced by my recent update to the adrl
test. The tc-arm.c change makes arm-coff treat ARM_IMMEDIATE and
ARM_ADRL_IMMEDIATE relocations the same as arm-elf does.
Otherwise the updated test fails there too.
gas/testsuite/ChangeLog
* gas/arm/adrl.s: Pad end of .text.
* gas/arm/adrl.d: Adjust to suit.
gas/ChangeLog
* config/tc-arm.c (arm_force_relocation): Move out of #if OBJ_ELF.
Move OBJ_COFF TC_FORCE_RELOCATION code here so that COFF handles
ARM_IMMEDIATE and ARM_ADRL_IMMEDIATE relocs as for ELF.
* config/tc-arm.h (TC_FORCE_RELOCATION): Define for both ELF and
COFF to call arm_force_relocation.
Index: gas/testsuite/gas/arm/adrl.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/adrl.d,v
retrieving revision 1.5
diff -u -p -r1.5 adrl.d
--- gas/testsuite/gas/arm/adrl.d 3 Dec 2002 11:28:33 -0000 1.5
+++ gas/testsuite/gas/arm/adrl.d 5 Dec 2002 10:47:46 -0000
@@ -24,3 +24,4 @@ Disassembly of section .text:
...
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.4
diff -u -p -r1.4 adrl.s
--- gas/testsuite/gas/arm/adrl.s 3 Dec 2002 11:28:33 -0000 1.4
+++ gas/testsuite/gas/arm/adrl.s 5 Dec 2002 10:47:46 -0000
@@ -21,3 +21,4 @@ foo:
.globl X;
X:
+ .p2align 5,0
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.133
diff -u -p -r1.133 tc-arm.c
--- gas/config/tc-arm.c 3 Dec 2002 11:27:26 -0000 1.133
+++ gas/config/tc-arm.c 5 Dec 2002 10:47:37 -0000
@@ -11432,6 +11432,32 @@ arm_validate_fix (fixP)
}
}
+int
+arm_force_relocation (fixp)
+ struct fix * fixp;
+{
+#if defined (OBJ_COFF) && defined (TE_PE)
+ if (fixp->fx_r_type == BFD_RELOC_RVA)
+ return 1;
+#endif
+#ifdef OBJ_ELF
+ if ( fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+ || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
+ || fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH
+ || fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BLX
+ || fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BLX
+ || fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BRANCH23)
+ return 1;
+#endif
+
+ /* 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);
+}
+
#ifdef OBJ_COFF
/* This is a little hack to help the gas/arm/adrl.s test. It prevents
local labels from being added to the output symbol table when they
@@ -11448,6 +11474,7 @@ arm_fix_adjustable (fixP)
return 0;
}
#endif
+
#ifdef OBJ_ELF
/* Relocations against Thumb function names must be left unadjusted,
so that the linker can use this information to correctly set the
@@ -11512,26 +11539,6 @@ armelf_frob_symbol (symp, puntp)
int * puntp;
{
elf_frob_symbol (symp, puntp);
-}
-
-int
-arm_force_relocation (fixp)
- struct fix * fixp;
-{
- if ( fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH
- || fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BLX
- || fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BLX
- || 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);
}
static bfd_reloc_code_real_type
Index: gas/config/tc-arm.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.h,v
retrieving revision 1.18
diff -u -p -r1.18 tc-arm.h
--- gas/config/tc-arm.h 30 Nov 2002 08:39:43 -0000 1.18
+++ gas/config/tc-arm.h 5 Dec 2002 10:47:37 -0000
@@ -77,8 +77,6 @@ struct fix;
#ifdef OBJ_COFF
# if defined TE_PE
-# define TC_FORCE_RELOCATION(x) \
- ((x)->fx_r_type == BFD_RELOC_RVA || S_FORCE_RELOC ((x)->fx_addsy))
# ifdef TE_EPOC
# define TARGET_FORMAT (target_big_endian ? "epoc-pe-arm-big" : "epoc-pe-arm-little")
# else
@@ -92,10 +90,10 @@ struct fix;
#ifdef OBJ_ELF
# define TARGET_FORMAT elf32_arm_target_format()
extern const char * elf32_arm_target_format PARAMS ((void));
-
-# define TC_FORCE_RELOCATION(FIX) arm_force_relocation (FIX)
- extern int arm_force_relocation PARAMS ((struct fix *));
#endif
+
+#define TC_FORCE_RELOCATION(FIX) arm_force_relocation (FIX)
+extern int arm_force_relocation PARAMS ((struct fix *));
#define md_convert_frag(b, s, f) {as_fatal (_("arm convert_frag\n"));}
--
Alan Modra
IBM OzLabs - Linux Technology Centre