I am trying to generate ELF or raw binaries. I've tried the -b and --
format switches of the linker (LD), however, I still only seem to be
generating PE files.
Anyone know how I can get the 64 bit version of MingW to generate ELF
or raw binaries?
Thanks.
Anyone have any suggestions for this? Is anyone else using GCC on
Windows to generate 64 bit binaries (ELF, raw binary etc)?
No.
I do know that DJGPP (GCC + custom DOS C library) doesn't natively support
ELF although the GNU source code packages do. One must recompile them with
ELF support enabled or download them pre-compiled from someone who has.
IIRC, OBJDUMP, or maybe it's LD... , has flags indicating which file formats
are supported, i.e., enabled and compiled, for your platform.
> Anyone have any suggestions for this? Is anyone else using GCC on
> Windows to generate 64 bit binaries (ELF, raw binary etc)?
Sorry, not I. All I can do is direct you to the "odd binaries" links in the
AOD FAQ:
http://www.yeyan.cn/Programming/gcc-ld-compile-binary-formats.aspx
http://devpit.org/wiki/Compiler_Options_for_Creating_Odd_Binaries
AOD FAQ:
http://aodfaq.wikispaces.com/
RP
It won't, neither will DJGPP. You need to install Cygwin, then build
a custom cross-compiler. Since you're doing OS dev, you won't need
any of the library support functions. Real simple way to do it is to
do Cygwin with the GCC 3.4xx branch (don't use 4.xx), then use the
Crosstool. It's very easy to use, and will build everything you need
to output the format/arch that you need.
Just make sure when you install Cygwin that you install the necessary
build tools for the Crosstool scripts. Standard toolchain, binutils,
gawk, sed, m4, libtool, make, autoconf, bison, etc..
I'm sure my list is partial, but I do a ton just to make sure the
build completes ok. The compiler is slower on Cygwin, but with
Crosstool, I've successfully sat down for an evening and build raw
(i.e. no OS support) cross-compilers for elf, elf64, i386, x86_64, and
PPC. It takes a while, but it'll work perfectly.
Great.. thanks for the pointers. I'll give that a try.