Mail Archives: djgpp/1996/07/15/12:41:25
gaggi AT cs DOT unibo DOT it (Nicola Gaggi) wrote:
>Hello folks,
>I need information on how relocation and linking is done under DJGPP for
>a project I am working on.
>I have used the utility 'objdump' and I have read the include file 'coff.h' to
>understand the format of the COFF file and I find that in the relocation part
>of these files there are only entries for external symbols and data, how can
>static and local declared symbols be relocated? May I have to scan all the
>code to find where jump istructions (function calls and unconditional jumps)
>are and modify the target address of the istructions? I dont think this is the
>best way to do relocation (even DOS use a better approach :) )!
Firstly if you are wanting DLLs then there is already a simple package
available, and a few people working on a more complete version. This
might be easier than reinventing the wheel. Even if you don't want
this the code for the DLLs will give you a large amount of info on the
COFF format if you don't mind studying it :)
The COFF format stores no information about local symbols. Relocation
in the COFF format is handled with the relocation entries, which can
be referenced relative to another symbol. Most COFF format files have
bss, .data and .text which are all symbols that point to the
beginning of each section. These are used by one relocation type which
will specify an offset from these. Any other symbol can be used in the
same manner, but these are normally easiest.
If I remember right there are only two different relocation types used
by DJGPP. I don't remember this clearly, but I think the difference is
in the way that they calculate the final address from the one already
there.
Hope this helps,
Malcolm
- Raw text -