This is the mail archive of the
mailing list for the binutils project.
Proposal to change tc_fix_adjustable API
- From: "Nick Kelsey" <nickk at ubicom dot com>
- To: <binutils at sources dot redhat dot com>
- Date: Thu, 19 Dec 2002 16:16:10 -0800
- Subject: Proposal to change tc_fix_adjustable API
- Reply-to: "Nick Kelsey" <nickk at ubicom dot com>
I would like to add a new paramter to the tc_fix_adjustable API:
extern int xxx_fix_adjustable PARAMS ((struct fix *));
extern int xxx_fix_adjustable PARAMS ((struct fix *, asection *));
The ip2k port uses linker relaxation and stabs for debugging. It is also
common to use ffunction-sections.
If the relocation information is stored in sect+offs form for a call and the
call is to a different section then the linker relaxation will produce
incorrect results as it does not visibility to adjust this relocation.
If the relocation information is left symbolic for the linker it *really*
screws up gdb... it thinks that local jump targets such as .L6 are new
functions and gets even more confised as these labels exist in multiple
files. For example, setting a breakpoint in main.c at a given line will
result in a breakpoint being set in libgcc.
Solution: The linker relaxation can detect a call to the same section,
assume sect+offs and adjust it. Likewise it can detect that a call is to a
different section and know not to adjust it. The trick is getting gas not to
resolve the relocation information to sect+offs for call targets that cross
ip2k_fix_adjustable (fix, sec)
if ((fix->fx_addsy) && (S_GET_SEGMENT (fix->fx_addsy) != sec))
/* Let the linker resolve these so the linker can relax correctly. */