This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] : Correct ARM_RVA32 value in pe images generation for arm Windows CE.
- From: Pedro Alves <pedro_alves at portugalmail dot pt>
- To: binutils at sourceware dot org
- Date: Tue, 04 Jul 2006 14:28:01 +0100
- Subject: [PATCH] : Correct ARM_RVA32 value in pe images generation for arm Windows CE.
Hi all,
Please find attached a patch against ld/pe-dll.c that fixes pei .reloc
section generation for arm Windows CE targets.
The problem was that the wrong ARM_RVA32 value was filled in the
pe_details->imagebase_reloc for ARM targets.
The PE Coff specification states:
Constant - IMAGE_REL_ARM_ADDR32NB
Value - 0x0002
Description - The 32-bit RVA of the target.
And indeed the correct values are defined in bfd/coff-arm.c:
#ifdef ARM_WINCE
...
#define ARM_26D 0
#define ARM_32 1
#define ARM_RVA32 2
#define ARM_26 3
#define ARM_THUMB12 4
#define ARM_SECTION 14
#define ARM_SECREL 15
#endif
And for all other coff arm targets:
#define ARM_RVA32 11
But since those defines are not in a header, the pe-dll.c value
bitrotted.
This is one of those bugs that makes you hate magic constants to
the gut ;)
I have caught this while fixing --enable-runtime-pseudo-reloc for
arm-wince-pe, so I am quite sure it works correctly for that target.
The PE_ARCH_arm_epoc I am not sure, but it I guess the
reloc values should come from the PE COFF specification too.
Can anyone point me to a list of which platforms use arm-pe?
What is this epoc arm target used for?
Cheers,
Pedro Alves
---
2006-07-04 Pedro Alves <pedro_alves@portugalmail.pt>
* pe-dll.c (pe_detail_list): Use correct ARM_RVA32 value for
PE_ARCH_arm, and PE_ARCH_arm_epoc cases.
--- ld/pe-dll.c.org 2006-07-04 13:55:54.000000000 +0100
+++ ld/pe-dll.c 2006-07-04 14:04:20.000000000 +0100
@@ -240,7 +240,7 @@ static pe_details_type pe_detail_list[]
{
"pei-arm-little",
"pe-arm-little",
- 11 /* ARM_RVA32 */,
+ 2 /* ARM_RVA32, or IMAGE_REL_ARM_ADDR32NB in PE & COFF specification. */
PE_ARCH_arm,
bfd_arch_arm,
TRUE,
@@ -249,7 +249,7 @@ static pe_details_type pe_detail_list[]
{
"epoc-pei-arm-little",
"epoc-pe-arm-little",
- 11 /* ARM_RVA32 */,
+ 2 /* ARM_RVA32, or IMAGE_REL_ARM_ADDR32NB in PE & COFF specification. */
PE_ARCH_arm_epoc,
bfd_arch_arm,
FALSE,