Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In the COFF file format, what is the significance of the relocation information section?

Tags:

coff

I am reading about COFF file formats, which is commonly used to create an executable file format (it has some variants also).

While reading, I came across the relocation section of the format. How is this relocation section used to create an executable file.

It would be very useful if you point me to some links which will help me.

like image 862
udpsunil Avatar asked Dec 13 '22 06:12

udpsunil


2 Answers

Actually, with COFF there are 2 types of relocation information:

  1. COFF Relocation records
  2. The relocation section in an executable image.

They have similar, but different purposes. The relocation information in an executable identifies things that need to be fixed up, at load time, should the executable image be loaded at a different addresses from its preferred address.

COFF Relocation records identify things that need to be fixed up, at link time, when a section in an object file is assigned to an offset in an executable image.

like image 112
Scott Wisniewski Avatar answered May 16 '23 05:05

Scott Wisniewski


Relocation is used to place executable code in its own memory space in a process. For example, if you try to load two dlls that both request the same base address (ie, the same place in memory), then one of the dlls will have to be relocated to another address. NTCore is a useful site for exploring Portable Executable (PE) files, which is what COFF is now called. Here is another site that explains relocation pretty well.

like image 32
Oliver Mellet Avatar answered May 16 '23 04:05

Oliver Mellet