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]

How to relocate for COFF object files?


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

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