Clang cross-compiler for ELF under OS X

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
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Clang cross-compiler for ELF under OS X

Post by NickJohnson »

I've been trying to get a cross compiler set up under OS X, but can't seem to get it right. I have i586-elf-binutils, nasm, and qemu installed properly, but clang simply refuses to accept the target configuration I give it. I configure the latest trunk build with "--target=i586-elf", and it seems to work (configure reports that build and host are x86_64-apple-darwin and target is i586-elf) but once it compiles the resulting executable reports its target as x86_64-apple-darwin and produces only Mach-O executables. Any idea of what I'm doing wrong?
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: Clang cross-compiler for ELF under OS X

Post by NickJohnson »

Okay, then how do you tell clang to output ELF when you invoke it? I've been searching the user documentation and various other sites for hours, and I can only find options that switch architecture, not executable format. The only command line option I've been giving it is -m32.
Post Reply