Now I want to convert object files to Mach-O format also. I have
investigated a Mach-O object file and found that it contains
position-independent code where global variables are accessed
relative to EBX.
It's also possible to compile non PIC code.
I haven't quite figured out how the GOT works
There is no explicit GOT in the way there is one on e.g. Linux.
and how function calls are relocated.
Via stubs. I would suggest you to have a look at the output of gcc -S
rather than at compiled object code. And maybe also browse through
http://developer.apple.com/documentation/developertools/Reference/
Assembler/index.html, in particular the "Assembler Directives" section.
If position-independent code is required then it is not possible to
convert an object file from another system that does not use this
method.
PIC is only required for dynamic libraries (and even then it isn't
strictly required, although you'll have to tell the linker to treat
errors about relocations in read-only sections as warnings if you
want to compile a library without PIC code).
But if the relocation mechanism supports position-dependent code
then it is possible. The ABI is basically the same in 32-bit
Windows, Linux, BSD and Intel-based Mac OS X.
As far as I know, there is no objcopy on Mac that supports
conversion from ELF to Mach-O ?
No.
Jonas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-x86 mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-x86/email@hidden