This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
relocation and fix up question
- To: binutils at sourceware dot cygnus dot com
- Subject: relocation and fix up question
- From: Dmitry <diwil at eis dot ru>
- Date: Thu, 1 Nov 2001 16:08:31 +0300
- Organization: eis.ru
Fellows,
I am trying to write binutils support for some cpu architecture.
This cpu has a variable instruction size and many addressing modes.
I just whant to know if I understand the things right.
The code
move.w *symbol1, &symbol2 ; moves word located at symbol1
; to address pointed by symbol2
resides in memory as
pc+4: symbol2 <- addr of symbol2
pc+2: symbol1 <- addr of symbol1
pc: move.w <- takes into account addressing mode
(CPU is little endian, base instr size - 2 words)
First of all I parse instruction, extract binary opcode, etc. and then
put the bin code as follows:
frag = frag_more(opcode->insn_size);
where = frag - frag_now->fr_literal;
bfd_putl16 ((bfd_vma) opcode->binopbase, frag);
Then I have to fixate symbol1 and symbol2:
parse_exp (symbol1, &exp1);
parse_exp (symbol2, &exp2);
fix_new_exp (frag_now, where+2, 2, &exp1, false, BFD_RELOC_MYCPU_16);
fix_new_exp (frag_now, where+4, 2, &exp2, false, BFD_RELOC_MYCPU_16);
Here I am worrying about arguments 2 - where and 3 - length.
If binary representations of symbol1, symbol2 and move.w do not overlap
are these values correct?
Thanks in advance
Dimmy.
*********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 314-8860, 5585314
*********************************************************************