mach-o objfmt, amd64 relocation issues
Henryk Richter
buggs at comlab.uni-rostock.de
Fri Jan 5 08:09:50 PST 2007
Hi folks,
impatient as I am, I was unwilling to wait for the 0.7.0 milestone and
started
a mach-o objfmt by myself. Please don't shoot me for the ugly code as
I am not too
familiar with yasm's internals and possibly replicated redundant
functionality.
I got basic 32 bit mach-o files working with text, data and bss
sections. The
relocations still need some work, currently basic pointers, absolute
symbols
and common vars seem to operate. Other relocations like WRT, PC-relative
and such are untested/inoperable.
My main problems, however start in 64 bit mode. So far I've got a
simple test
application running which correctly interfaces with 64 bit code in
certain conditions.
I can instruct the mach-o format to reloc 64 bit absolute addresses
(like in "mov rax,qword _somelabel"), calls are working but I need some
ideas to support such constructs as "mov rax,[_some_label]. The x86-64
implementation of mach-o seems to be heavily RIP-relative so that
"movq rax,[rip+_some_label" works but I cannot see how to assemble the
former symbol type (see attached reloc.h.gz). A reloc like
"R_X86_64_32" as
present in ELF is not known to me.
Dynamic external symbols (like calling printf) would require quite a
bit of
extra work and are not supported at this point.
regards,
Henryk
___________________________________________
Dr.-Ing. Henryk Richter
University of Rostock
Institute of Communications
R.-Wagner-Strasse 31
18119 Rostock, Germany
Phone: +49 - 381 - 4987303
Mobile: +49 - 175 - 1771241
Fax: +49 - 381 - 4987302
EMail: henryk.richter at comlab.uni-rostock.de
URL: http://horus.comlab.uni-rostock.de
___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cvs.tortall.net/pipermail/yasm-devel/attachments/20070105/fa88602d/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reloc.h.gz
Type: application/x-gzip
Size: 2094 bytes
Desc: not available
Url : http://cvs.tortall.net/pipermail/yasm-devel/attachments/20070105/fa88602d/attachment-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: macho-2007-01-05.tgz
Type: application/octet-stream
Size: 17142 bytes
Desc: not available
Url : http://cvs.tortall.net/pipermail/yasm-devel/attachments/20070105/fa88602d/attachment-0001.obj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cvs.tortall.net/pipermail/yasm-devel/attachments/20070105/fa88602d/attachment-0001.htm
More information about the yasm-devel
mailing list