Attempt to fix remaining test suite failures on arm-* -- stuck

Richard Earnshaw rearnsha@arm.com
Thu Jun 30 14:03:00 GMT 2005


On Thu, 2005-06-30 at 07:42, Zack Weinberg wrote:
> The appended patch is my attempt to fix all the remaining binutils
> testsuite failures for the following targets:
> 
> arm-aout
> arm-epoc-pe
> arm-nto
> arm-vxworks
> arm-wince-pe
> arm-symbianelf
> arm-none-eabi
> xscale-coff
> xscale-elf
> 
> I have gotten it down to this set:
> 
> arm-none-eabi:FAIL: Simple non-PIC shared library
> arm-none-eabi:FAIL: Simple PIC shared library
> arm-none-eabi:FAIL: Simple dynamic application
> arm-none-eabi:FAIL: Simple static application
> arm-none-eabi:FAIL: Mixed ARM/Thumb shared library
> arm-none-eabi:FAIL: Mixed ARM/Thumb dynamic application
> arm-vxworks:FAIL: Unwind table generation
> arm-vxworks:FAIL: TLS
> 
> The arm-none-eabi failures are all to do with ld's input (i.e. the
> object files produced by GAS) containing BL instructions with the
> wrong addend.  I *think* someone who thoroughly understands relocation
> processing in GAS could fix this with an additional line or two in
> tc-arm.c:md_pcrel_from_section, but I'm at my wits' end.
> 
> The arm-vxworks failures *appear* to be a case of the test suite
> expecting relocations to be in REL format, not RELA (VxWorks is, iirc,
> the only ARM RELA target).  I could be wrong about this.
> 
> The approach taken in the patch is to attempt to iron out all the
> differences between OBJ_ELF and !OBJ_ELF fixup handling, and
> furthermore to cease to encode pipeline offsets in the instructions.
> It would be nice if this approach could be preserved, since it allows
> substantial simplification of md_apply_fix.  However, I did post
> another patch a couple days ago which merely adds more #ifdefs and
> deletes some suspected-bogus WinCE variant tests; that patch shows
> only the VxWorks failures.
> 

I think the problem is that md_pcrel_from_section is adding in the base
address to symbols that the assembler is not going to finish
relocating.  The base address then leaks into the addend field used by
the linker rather than the pipeline compensation.

Changing the test that zeros the base to read:

  /* If this is pc-relative and we are going to emit a relocation
     then we just want to put out any pipeline compensation that the linker
     will need.  */
  if (fixP->fx_pcrel 
      && ((fixP->fx_addsy && S_GET_SEGMENT (fixP->fx_addsy) != seg)
	  || arm_force_relocation (fixP)))
    base = 0;

fixes all the eabi failures bar one.  The one failure not fixed is the
plt-in-shared-library test.  The problem here is that the relocation is
not marked pc-relative, so md_pcrel_from_section does not get called. 
This appears to be incorrect: with your new model I think plt
relocations should be marked pc-relative, so the change is to make
encode_branch unconditionally set inst.reloc.pc_rel to 1.

I've attached a revised diff for tc-arm.c: it passes all the tests on
arm-none-eabi.  However, I haven't had chance to try it on the other
targets.

R.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tc-arm.patch
Type: text/x-patch
Size: 38575 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20050630/07b27a6a/attachment.bin>


More information about the Binutils mailing list