tags:

views:

220

answers:

1

Hi All,

I trying to write elf executable loader program for ARM platform.I have some Queries here

1) How to generate relocatable or position independent ELF executable(what are the compiler & linker options) 2) How to load this above generated ELF executable file.

As astart , i did some work and it is working fine. I am using a fixed address for RO_Base and not splitting the Segments while building(not using any --split option), so that I am getting a contiguous code,data,bss sections. after this I am loading the elf to the same address as RO_Base and executing the code as new thread. this is working fine. I have not done any relocations etc...

Now I want to make it dynamic and able to load to any address by generating relocatable ELF and modifying the Loader to appropriate changes. Please help me in making it work.

Thanks,

A: 

Just use -r flag to linker to make file relocatable.

Use something like this to relocate file in memory.

Berkus