public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] : Correct ARM_RVA32 value in pe images generation for arm  Windows CE.
@ 2006-07-04 13:28 Pedro Alves
  2006-07-05  0:44 ` Daniel Jacobowitz
  0 siblings, 1 reply; 13+ messages in thread
From: Pedro Alves @ 2006-07-04 13:28 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]

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.


[-- Attachment #2: ld-rva.diff --]
[-- Type: text/plain, Size: 650 bytes --]

--- 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,

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-08-22 11:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-04 13:28 [PATCH] : Correct ARM_RVA32 value in pe images generation for arm Windows CE Pedro Alves
2006-07-05  0:44 ` Daniel Jacobowitz
2006-08-08  9:58   ` Pedro Alves
2006-08-08  9:59   ` Pedro Alves
2006-08-08 10:05     ` Nick Clifton
2006-08-09 20:55       ` [PATCH] Properly split arm-pe / arm-wince-pe Pedro Alves
2006-08-11 13:57         ` Pedro Alves
2006-08-11 14:04           ` Nick Clifton
2006-08-16  8:30         ` [PATCH] Properly split arm-pe / arm-wince-pe. (take 2) Pedro Alves
2006-08-21  8:53           ` Nick Clifton
2006-08-21 10:47             ` Pedro Alves
2006-08-22  0:50             ` [PATCH] Properly split arm-pe / arm-wince-pe. (take 2.1) Pedro Alves
2006-08-22 12:26               ` Nick Clifton

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).