This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Call func address spill out


On 11/20/2009 04:21 AM, daniel tian wrote:
      But the question is gcc doesn't know the function symbol_ref 's
address before ld taking care.
      Now there is only one solution I could choose: to force all the
function call symbol_ref into register and CALL insn calls the
register.
      But I think this will cost more cpu time while routine is less
than 32k space. You know the instruction space is limited, so code
size becomes the key point.
      Can somebody give me some advice?

The typical mechanism is to provide enough relocations into the generated code such that the linker can "relax" the code to the more efficient form. The exact set of relocations that you will need to provide are very dependent on both your ISA and ABI.

Typically these relocations mark the insns that perform the load
of the address into the register, and mark the call insn that uses
the register, and may tie the two relocations together so that
you are provided some amount of data flow information in the linker.

Grep 'bfd_elf.*_bfd_relax_section' binutils/bfd/*.c shows that
there are 26 targets that implement some form of linker relaxation.
Have a browse through and get some ideas for how you might want
to implement things for your target.

Do consider posting your proposed method to the binutils list,
so that folks can review your method and give you some feedback.


r~



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