executable file format

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
jtlb
Member
Member
Posts: 29
Joined: Sat May 12, 2007 8:24 am

executable file format

Post by jtlb »

Hi,

In your opinion what executable file format should i shouse for my operating system's shared library? And is there anyone that allows relocating the code just by changing an offset?


EDIT1:
actualy, iam looking for an executable file format which is completly position independent.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: executable file format

Post by Solar »

Unfortunately that's not up to the executable format, but the CPU instruction set... since the x86 does not support data access relative to the instruction pointer, no matter what the executable format, you need to play some tricks. (In this case, using a register to point to the data.)

Due to the amount of documentation and readily available tools, the "canon" decision is to use ELF. Of course you can chose otherwise, but it's like "use C" or "use GCC".
Every good solution is obvious once you've found it.
jtlb
Member
Member
Posts: 29
Joined: Sat May 12, 2007 8:24 am

Re: executable file format

Post by jtlb »

OK, it's sad!


Thank you
iammisc
Member
Member
Posts: 269
Joined: Thu Nov 09, 2006 6:23 pm

Re: executable file format

Post by iammisc »

for position independent CODE only, you can use gcc's -fPIC option, but like Solar said, you have to resort to some tricks to let it write to position independent data and to link to shared libraries.

Also, if I'm not mistaken, the amd64 processors have rip relative addressing. I'm pretty sure on could use this for complete position independence, but I'm not sure.
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: executable file format

Post by JAAman »

yes, x86-64 does have IP-reletive addressing, which can do this, but that is only availible in LMode
Post Reply