This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: arm-wince-pe support resurrection
- From: Dmitry Semyonov <Dmitry dot Semyonov at oktet dot ru>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: <binutils at sources dot redhat dot com>
- Date: Fri, 5 Dec 2003 22:39:05 +0300 (MSK)
- Subject: Re: arm-wince-pe support resurrection
- Reply-to: <Dmitry dot Semyonov at oktet dot ru>
Nick,
On Mon, 1 Dec 2003, Nick Clifton wrote:
> > Attached patches are aimed to resurrect some broken or incompatible
> > with MS linker features of arm-wince-pe support:
> > - partial linking (ld -r)
> > - flags of special sections
> > - relocations
>
> These patches contain quite a few different changes/fixes, so I am
> going to go through them one by one over the next few days.
Please review one more patch. It fixes some more issues
with partial relocation. The patch should be applied after the mentioned
above 'ld -r' related one. (You have already applied it.)
2003-12-05 Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
* coff-arm.c (aoutarm_std_reloc_howto): [ARM_WINCE] Synchronize ARM_26D
relocation howto with ARM_26 one for consistency.
(coff_arm_relocate_section): Set partial_inplace for ARM_26 relocations
that will be converted to ARM_26D ones, since we always want 'done'
relocations to be reflected in section's data.
(coff_arm_relocate_section): [ARM_WINCE] Quick fix for BL instruction
offset.
(_bfd_final_link_relocate): Do not modify "inplace" data, if not
requested.
diff -rNc3pad binutils-031118.orig/bfd/coff-arm.c binutils-031118/bfd/coff-arm.c
*** binutils-031118.orig/bfd/coff-arm.c Mon Nov 24 18:39:44 2003
--- binutils-031118/bfd/coff-arm.c Mon Nov 24 16:29:26 2003
*************** static reloc_howto_type aoutarm_std_relo
*** 268,274 ****
2,
2,
24,
! FALSE,
0,
complain_overflow_dont,
aoutarm_fix_pcrel_26_done,
--- 268,274 ----
2,
2,
24,
! TRUE,
0,
complain_overflow_dont,
aoutarm_fix_pcrel_26_done,
*************** static reloc_howto_type aoutarm_std_relo
*** 276,282 ****
FALSE,
0x00ffffff,
0x0,
! FALSE),
HOWTO (ARM_32,
0,
2,
--- 276,282 ----
FALSE,
0x00ffffff,
0x0,
! PCRELOFFSET),
HOWTO (ARM_32,
0,
2,
*************** coff_arm_relocate_section (output_bfd, i
*** 1250,1256 ****
when doing a relocatable link. However, we want to convert
ARM_26 to ARM_26D relocs if possible. We return a fake howto in
this case without pcrel_offset set, and adjust the addend to
! compensate. */
if (rel->r_type == ARM_26
&& h != NULL
&& info->relocatable
--- 1250,1257 ----
when doing a relocatable link. However, we want to convert
ARM_26 to ARM_26D relocs if possible. We return a fake howto in
this case without pcrel_offset set, and adjust the addend to
! compensate. 'partial_inplace' is also set, since we want 'done'
! relocations to be reflected in section's data. */
if (rel->r_type == ARM_26
&& h != NULL
&& info->relocatable
*************** coff_arm_relocate_section (output_bfd, i
*** 1269,1280 ****
complain_overflow_signed,
aoutarm_fix_pcrel_26 ,
"ARM_26",
! FALSE,
0x00ffffff,
0x00ffffff,
! FALSE);
addend -= rel->r_vaddr - input_section->vma;
howto = &fake_arm26_reloc;
}
--- 1270,1286 ----
complain_overflow_signed,
aoutarm_fix_pcrel_26 ,
"ARM_26",
! TRUE, /* partial_inplace */
0x00ffffff,
0x00ffffff,
! FALSE); /* pcrel_offset */
addend -= rel->r_vaddr - input_section->vma;
+ #ifdef ARM_WINCE
+ /* FIXME: I don't know why, but the hack is necessary for correct
+ generation of bl's instruction offset. */
+ addend -= 8;
+ #endif
howto = &fake_arm26_reloc;
}
diff -rNc3pad binutils-031118.orig/bfd/reloc.c binutils-031118/bfd/reloc.c
*** binutils-031118.orig/bfd/reloc.c Fri Oct 31 08:32:46 2003
--- binutils-031118/bfd/reloc.c Sun Nov 23 21:33:24 2003
*************** _bfd_final_link_relocate (reloc_howto_ty
*** 1353,1358 ****
--- 1353,1361 ----
if (address > input_section->_raw_size)
return bfd_reloc_outofrange;
+ if (!howto->partial_inplace)
+ return bfd_reloc_ok; /* Do not modify "inplace" data, if not requested. */
+
/* This function assumes that we are dealing with a basic relocation
against a symbol. We want to compute the value of the symbol to
relocate to. This is just VALUE, the value of the symbol, plus
...Bye..Dmitry.