i managed to get ELF reloc working very easily (ok.. i mean executable, boring elf's here) but im finding the COFF spec (not that its really a spec, the delorie.com explanation) rather more confusing.
so far i know that i need to read the file header and optional header, this tells me the entry point to call, as well as some other stuff im not sure how to use yet.
could somebody clarify what i need to relocate in order to get this working? somebody that has already done it, could you please give me a short list of how it works?
thankyou, lukem95
COFF relocation... how to?
yeah, download elf.h, its very easy to find and write a function to iterate through all the fields to determine its for the right architecture and everything.
You then need to relocate the executable (PT_LOAD) sections.
You then need to relocate the executable (PT_LOAD) sections.
Code: Select all
for(i = 0; i < header->phnum; i++)
{
/* Check if its loadable */
if( pHeader[i].type == 1 ) /* PT_LOAD == 1 */
{
if(!kmalloc(pHeader[i].memSize))
return -1;
}
}

