This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: R_ARC_B22_PCREL relocs busted?


Hi Nick,

I did try this as one of my early fixes, but it didn't seem to work.  I
think the problem is that assembler calls bfd_install_relocation, which
checks the pcrel_offset flag and "undoes" what you want to happen in
bfd_perform_relocation from the linker.  With this flag set to true (and the
call to arc_elff_pcrel_reloc removed), I get the following disassembly:

a.out:     file format elf32-littlearc

Disassembly of section .text:

00000074 <main>:
  74:   ff ff ff 7f     7fffffff     nop
  78:   ff ff ff 7f     7fffffff     nop
  7c:   80 ff ff 2f     2fffff80     bl         7c <main+0x8>

  80:   00 fe ff 27     27fffe00     b          74 <main>


00000084 <_myfunc>:
  84:   00 81 0f 38     380f8100     j.f        [blink]

Note that if you just re-link the original objects after patching binutils,
the problem appears to go away.  If you both re-assemble and re-link, it
comes out looking like what I've got above.  

So... if you could have another look (or tell me what I'm doing wrong!) it
would be appreciated.

Thanks,

Andre

-----Original Message-----
From: Nick Clifton
To: Andre Paquette
Cc: binutils@sourceware.cygnus.com
Sent: 9/24/01 9:21 AM
Subject: Re: R_ARC_B22_PCREL relocs busted?

Hi Andre,

> I have come up with a patch for this but I'm certain that I'm just
> addressing the symptom, not the root of the problem.  Perhaps a
coordinated
> change between the assembler and linker would be better.  Also, I'm
not
> certain if I've caught all the appropriate conditions under which the
addend
> fudge needs to be applied.  If those in the know (Nick?) could have a
look
> and determine the correct solution, it would be appreciated.

I do not think that this is an assembler/linker mismatch problem, it
is just a bug in the linker.

Actually there is a much simpler solution - Change pcrel_offset for
for the R_ARC_B22_PCREL relocation to true.  This has the same affect
as your patch, but it keeps things simpler.  It also appears to work
with the previous ARC test case that was failing (and which I happened
to keep around).  So if you would like to try this patch out and let
me know if it causes you any problems, then - assuming that you say
that it is OK - I will apply it.

Cheers
        Nick

2001-09-24  Nick Clifton  <nickc@cambridge.redhat.com>

	* elf32-arc.c (R_ARC_B22_PCREL): Set pcrel_offset to true.


Index: elf32-arc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arc.c,v
retrieving revision 1.8
diff -p -r1.8 elf32-arc.c
*** elf32-arc.c	2001/09/18 09:57:23	1.8
--- elf32-arc.c	2001/09/24 13:18:35
*************** static reloc_howto_type elf_arc_howto_ta
*** 98,104 ****
  	 true,			/* partial_inplace  */
  	 0x07ffff80,		/* src_mask  */
  	 0x07ffff80,		/* dst_mask  */
! 	 false),		/* pcrel_offset  */
  
  };
  
--- 98,104 ----
  	 true,			/* partial_inplace  */
  	 0x07ffff80,		/* src_mask  */
  	 0x07ffff80,		/* dst_mask  */
! 	 true),			/* pcrel_offset  */
  
  };
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]