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]
Other format: [Raw text]

Re: Patch - ip2k gas fix to prevent problems with linker relaxation.


Hi,

Ok, the reason TC_FORCE_RELOCATION is not being called is that the
relocations are never pc relative...

#ifndef TC_FORCE_RELOCATION_LOCAL
#define TC_FORCE_RELOCATION_LOCAL(FIX)  \
  (!(FIX)->fx_pcrel    \
   || (FIX)->fx_plt    \
   || TC_FORCE_RELOCATION (FIX))
#endif

Nick

----- Original Message -----
From: "Nick Kelsey" <nickk@ubicom.com>
To: <jafa@silicondust.com>
Sent: Wednesday, December 18, 2002 10:59 PM
Subject: Re: Patch - ip2k gas fix to prevent problems with linker
relaxation.


*This message was transferred with a trial version of CommuniGate(tm) Pro*
Hi Alan,

>> Are you sure it's OK to reduce local syms?

Yes and no... found a problem this afternoon and I think its time to rethink
things... (I have been comparing with a few other ports and I am even more
confused)

1) TC_FORCE_RELOCATION never gets called, linkrelax is not set (tested
runtime as well). I still don't understand why... I guess I should trace
through this and find out why. BTW - I am using the CVS trunk.

2) The assembler always used to do sect+offs for all jump targets (even with
relaxation) and the linker elf_relax_delete_bytes has extra code to fix all
these offsets. This extra adjustment is not present in any of the other
ports that I have looked at. A side issue is that other ports also don't
seam to update the stabs/dwarf info when they relax bytes away (source code
doesn't line up with the PC when you debug). The ip2k port contains code to
patch the stabs info but if there is a more general way to do this then I
would like to make use of it.

3) If I unconditionally deny the fixup for all jump/call relocations then it
screws up the linkers ability to display the name of the function when it
finds an error. For example, unresolved symbol xxx in function yyy - it
displays the previous local label, not the function label. The patch that I
emailed made this conditional on local which solves this problem.

4) I just discovered this afternoon that the code that fixes the offsets in
#2 above is also incorrectly adjusting the absolute symbol references that
are now being created with the #3 patch if they are in the same section. I
didn't notice when I first tested it as we use gc-function-sections with our
code.

I would appreciate your advice on all this (I don't mind rewriting any or
all of this code)..

Is sect+offs format normal for relocations? or do other ports use relative
offsets from the current instruction?

When relaxation is to be used, should gas ever be allowed to create
sect+offs relocations?

If not, is there a problem with the linker determining what function to
display when it finds an error?

To be honest my preference is to use offset relocations for local jumps and
symbolic relocations for functions as it makes the objdumps clean to read.

If I follow this approach, how can I tell the difference between offset and
symbolic relocations in the linker for doing the adjustments?

Finally, when I delete bytes during relaxation, is there a standard way to
update the debug info (stabs/dwarf etc)?

If any other ports spring to mind as good examples then that would be good
as well.

Thanks

Nick

----- Original Message -----
From: "Alan Modra" <amodra@bigpond.net.au>
To: <jafa@silicondust.com>
Sent: Wednesday, December 18, 2002 10:11 PM
Subject: Re: Patch - ip2k gas fix to prevent problems with linker
relaxation.


> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> On Wed, Dec 18, 2002 at 11:40:16AM -0800, Nick Kelsey wrote:
> > The attached patch adds a fix_adjustable function to prevent gas from
fixing
> > non-local targets so as not to cause problems
> >  with linker relaxation with the ip2k.
>
> Are you sure it's OK to reduce local syms?
>
> --
> Alan Modra
> IBM OzLabs - Linux Technology Centre
>




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