Reading Mach-O objects under Linux
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Reading Mach-O objects under Linux
Pretty straightforward question: do there exist tools analogous to readelf/objdump that will allow me to read and disassemble Mach-O binaries under a Linux machine? It seems that binutils doesn't support Mach-O, and I don't actually own a Mac. ndisasm seems to at least not choke on Mach-O binaries, but it also doesn't read the symbol tables or separate sections, which makes it inadequate for my purposes.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Re: Reading Mach-O objects under Linux
I believe you're looking for otool, which is part of Apple's cctools.
It's open source, but you'll probably have to do the neccessary porting work (..and from the look of it, obtain the relevant mach-o header files).
It's open source, but you'll probably have to do the neccessary porting work (..and from the look of it, obtain the relevant mach-o header files).
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: Reading Mach-O objects under Linux
Looks like it will work. Now I just have to find those Mach-O C headers...
If I get this working, I'll post a patch here.
If I get this working, I'll post a patch here.
Re: Reading Mach-O objects under Linux
Use this tool: http://www.agner.org/optimize/#objconv
You can convert Mach-O to ELF and vice-versa with it, and includes a disassembler too.
You can convert Mach-O to ELF and vice-versa with it, and includes a disassembler too.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Reading Mach-O objects under Linux
Generally Mach-Os can't be translated to ELF or any other format. The relocations are not representable.turdus wrote:Use this tool: http://www.agner.org/optimize/#objconv
You can convert Mach-O to ELF and vice-versa with it, and includes a disassembler too.