This is the mail archive of the
mailing list for the binutils project.
Re: Patch - ip2k gas fix to prevent problems with linker relaxation.
- From: "Nick Kelsey" <nickk at ubicom dot com>
- To: "Alan Modra" <amodra at bigpond dot net dot au>
- Cc: <binutils at sources dot redhat dot com>
- Date: Wed, 18 Dec 2002 22:59:03 -0800
- Subject: Re: Patch - ip2k gas fix to prevent problems with linker relaxation.
- References: <0ef701c2a6cd$4a8ce790$f601a8c0@nkelseyxp> <email@example.com>
>> 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
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
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
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
----- Original Message -----
From: "Alan Modra" <firstname.lastname@example.org>
Sent: Wednesday, December 18, 2002 10:11 PM
Subject: Re: Patch - ip2k gas fix to prevent problems with linker
> *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
> > 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