Change to coff-arm.c breaks binutils
Sean McNeil
sean@mcneil.com
Mon Apr 23 08:14:00 GMT 2001
Nick,
Sorry about the fact that there isn't a configuration for this. Here
are my full cvs differences for a working binutils cross to
arm-wrs-vxworks. There is one additional change to the ldscript in
order to collect sections that have been split-by-reloc. This is
because the current coff loader on the target cannot deal with multiple
segments. I do not feel that this change is to fix a binutils problem.
The coff-arm.c mod is a binutils problem, however, IMHO.
Thanks for looking into this.
Sean
Index: bfd/coff-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-arm.c,v
retrieving revision 1.26
diff -c -r1.26 coff-arm.c
*** coff-arm.c 2001/03/08 21:03:57 1.26
--- coff-arm.c 2001/04/23 15:07:56
***************
*** 1244,1250 ****
{
if (info->relocateable)
continue;
! #if 0 /* We must not ignore the symbol value. If the symbol is
within the same section, the relocation should have already
been fixed, but if it is not, we'll be handed a reloc into
the beginning of the symbol's section, so we must not cancel
--- 1244,1250 ----
{
if (info->relocateable)
continue;
! #if 1 /* We must not ignore the symbol value. If the symbol is
within the same section, the relocation should have already
been fixed, but if it is not, we'll be handed a reloc into
the beginning of the symbol's section, so we must not cancel
Index: bfd/config.bfd
===================================================================
RCS file: /cvs/src/src/bfd/config.bfd,v
retrieving revision 1.54
diff -c -r1.54 config.bfd
*** config.bfd 2001/04/08 05:11:47 1.54
--- config.bfd 2001/04/23 15:07:56
***************
*** 140,146 ****
targ_defvec=aout_arm_big_vec
targ_selvecs=aout_arm_little_vec
;;
! arm-*-coff)
targ_defvec=armcoff_little_vec
targ_selvecs=armcoff_big_vec
targ_underscore=yes
--- 140,146 ----
targ_defvec=aout_arm_big_vec
targ_selvecs=aout_arm_little_vec
;;
! arm-*-coff | arm-*-vxworks*)
targ_defvec=armcoff_little_vec
targ_selvecs=armcoff_big_vec
targ_underscore=yes
Index: gas/configure
===================================================================
RCS file: /cvs/src/src/gas/configure,v
retrieving revision 1.72
diff -c -r1.72 configure
*** configure 2001/04/17 01:36:23 1.72
--- configure 2001/04/23 15:08:00
***************
*** 2335,2340 ****
--- 2335,2341 ----
arm-*-wince) fmt=coff em=wince-pe ;;
arm-*-pe | thumb-*-pe) fmt=coff em=pe ;;
arm-*-riscix*) fmt=aout em=riscix ;;
+ arm-*-vxworks*) fmt=coff ;;
avr-*-*) fmt=elf bfd_gas=yes ;;
Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.65
diff -c -r1.65 configure.in
*** configure.in 2001/04/17 01:36:23 1.65
--- configure.in 2001/04/23 15:08:00
***************
*** 197,202 ****
--- 197,203 ----
arm-*-wince) fmt=coff em=wince-pe ;;
arm-*-pe | thumb-*-pe) fmt=coff em=pe ;;
arm-*-riscix*) fmt=aout em=riscix ;;
+ arm-*-vxworks*) fmt=coff ;;
avr-*-*) fmt=elf bfd_gas=yes ;;
Index: ld/configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.51
diff -c -r1.51 configure.tgt
*** configure.tgt 2001/04/08 05:13:57 1.51
--- configure.tgt 2001/04/23 15:08:02
***************
*** 185,190 ****
--- 185,191 ----
arm-*-aout | armel-*-aout) targ_emul=armaoutl ;;
armeb-*-aout) targ_emul=armaoutb ;;
arm-*-coff) targ_emul=armcoff ;;
+ arm-*-vxworks*) targ_emul=armcoff ;;
arm-*-freebsd*) targ_emul=armelf ;;
arm-*-netbsd*) targ_emul=armnbsd ;;
arm-*-rtems*) targ_emul=armelf ;;
Index: ld/scripttempl/armcoff.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/armcoff.sc,v
retrieving revision 1.2
diff -c -r1.2 armcoff.sc
*** armcoff.sc 1999/07/09 08:12:48 1.2
--- armcoff.sc 2001/04/23 15:08:02
***************
*** 20,26 ****
present): */
.text ${RELOCATING+ 0x8000} : {
*(.init)
! *(.text)
*(.glue_7t)
*(.glue_7)
*(.rdata)
--- 20,26 ----
present): */
.text ${RELOCATING+ 0x8000} : {
*(.init)
! *(.text*)
*(.glue_7t)
*(.glue_7)
*(.rdata)
***************
*** 30,39 ****
LONG (-1); *(.dtors); *(.dtor); LONG (0); }
*(.fini)
${RELOCATING+ etext = .;}
}
.data ${RELOCATING+${DATA_ADDR-0x40000 + (. & 0xfffc0fff)}} : {
${RELOCATING+ __data_start__ = . ;}
! *(.data)
${RELOCATING+ __data_end__ = . ;}
${RELOCATING+ edata = .;}
${RELOCATING+ _edata = .;}
--- 30,40 ----
LONG (-1); *(.dtors); *(.dtor); LONG (0); }
*(.fini)
${RELOCATING+ etext = .;}
+ ${RELOCATING+ _etext = .;}
}
.data ${RELOCATING+${DATA_ADDR-0x40000 + (. & 0xfffc0fff)}} : {
${RELOCATING+ __data_start__ = . ;}
! *(.data*)
${RELOCATING+ __data_end__ = . ;}
${RELOCATING+ edata = .;}
${RELOCATING+ _edata = .;}
On 23 Apr 2001 10:13:34 +0100, Nick Clifton wrote:
> Hi Sean,
>
> > The following entry in the ChangeLog for the BFD breaks relocs for my
> > final link:
> >
> > 2000-07-04 Alexandre Oliva <aoliva@redhat.com>
> >
> > * coff-arm.c (coff_arm_relocate_section): Do not ignore the symbol
> > value of PC-relative offsets.
> >
> >
> > The target is arm-wrs-vxworks and the code in question is...
> >
> > #if 0 /* We must not ignore the symbol value. If the symbol is
> > within the same section, the relocation should have already
> > been fixed, but if it is not, we'll be handed a reloc into
> > the beginning of the symbol's section, so we must not cancel
> > out the symbol's value, otherwise we'll be adding it in
> > twice. */
> > if (sym != NULL && sym->n_scnum != 0)
> > addend += sym->n_value;
> > #endif
> >
> > If I change this to an #if 1, then all is well. Can someone review and
> > fix? With this code fragment removed, many of my relocs are at a fixed
> > address as opposed to the proper location.
> >
> > for instance,
> >
> > 1608: ebfffe7c bl 1000 <STACK_REDZONE_NATIVE>
> >
> > instead of the proper
> >
> > 1608: eb06dbd1 bl 1b8554 <___divsi3>
>
> Interesting - there does not appear to be any entry in the mail
> archive explaining what problem Alexandre's patch was trying to fix.
>
> Alexandre has suggested that maybe this is something that needs to
> conditionally enabled, depending upon the target. Looking at
> config.bfd there does not appear to be support for an arm-wrs-vxworks
> target, so maybe one ought to be added ? [What binutils target are
> you currently using, just arm-coff ?]
>
> Cheers
> Nick
More information about the Binutils
mailing list