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: COFF relocation examples with PUSH, OPERAND and POP functionality


Kerry Keal <kerry at industrialmusic dot com> writes:

>   I'm working on porting the TI C55x to binutils (
> http://c55x-binutils.sourceforge.net/ ). I was wondering if anyone could
> point me to some examples that have COFF linker commands with PUSH, POP,
> and OPERAND type relocation instructions. For example: the instruction
> 
> .global _symbol
> mov #(_symbol & 0xFFFF), AC0
> 
> would have 4 relocations for 1 address in the relocation section:
> 1)push the value of _symbol on the stack
> 2)push the constant 0xFFFF on the stack
> 3)replace 2 elements on the stack with the AND operation of those 2
> elements
> 4) pop the value of the stack for the relocation
> 
> I'm investigating using the "special_function" in the HOWTO declarations
> to implement this in bfd/coff-tic55x.c. For PUSH and OPERAND type I was
> returning bfd_reloc_ok. For the pop instruction I tried to set the value
> of the symbol and return bfd_reloc_cont but that crashes. So I was
> hoping someone could recommend some good example code.

Don't start with HOWTO structures.  Use a relocate_section() function
instead.  You only need HOWTO structures to support linking your
object files directly into a different format, and that is not common.

For examples of PUSH, etc., see alpha_relocate_section() in
coff-alpha.c.  That is ECOFF, not COFF, but the approach should be
similar.

Ian


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