How to relocate for COFF object files?
David Lin
graylag@iii.org.tw
Sun Jun 10 23:55:00 GMT 2001
Dear all:
ÃÂ
There is a question encountered.
ÃÂ
While handing COFF object file generated by gcc,
I have to retrieve the executable portion
(such as text section, data section and bss section)
from object file,
and make the executable portionÃÂ REALLY
executable
soÃÂ that it could be insert into the system and
can be executed.
ÃÂ
That is, I am working similiarly to the linker
ld.
ÃÂ
The most difficult part of my work is
relocation.
ÃÂ
Here comes the question
How do bytes needed relocation in object file differ
from others?
The structure defined for relocation
entriesÃÂ leaves a field r_symndxÃÂ to the symbol index it referring
to,
and leaves another field r_type to
indicateÃÂ howÃÂ it relocates.
Do all kind of types need
relocation?
or how does the relocation be performed?
ÃÂ
For the arm-coff case, the value of r_type might be
defined in coff-arm.c
(bintuils/bfd/coff-arm.c)
such as ARM_8, ARM_16, ARM_32, etc.
Several values is defined in internal.h
(binutils/include/coff/internal.h)
such as R_DIR16, R_DIR32, R_IMAGEBASE, R_RELBYTE, R_RELWORD
andÃÂ R_RELLONG, etc.
I am confued that which class of values indicates the arm-coff
r_type.
For an unconfirmed suggestion, bytes needing relocation with its r_type is
R_RELLONG
(case in m68k )
ÃÂ
Is there any place could I find the answer?
ÃÂ
David
More information about the Binutils
mailing list