How can I compile independant C code to pure x86 16 and 32 bit binaries? Is there a way to do it with mingw, or do I have to compile a special version of GCC?
How can I compile independant C code to pure x86 16 and 32 bit binaries? Is there a way to do it with mingw, or do I have to compile a special version of GCC?
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Pure binaries? Meaning what? An executable?
Meaning no executable format, no information headers, no sections; just pure binary, instructions.
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Likely possible, would have to read though the documentation for your compiler. There is a lot of information for GCC and most of it applies to MinGW also.
I think the switch you're looking for is -ffreestanding.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
The various parts/sections/layout of executable files are documented. If you have a need to extract particular sections, easier to write a separate program to extract them than to modify a compiler.
I must admit I fail to see value in doing this. A set of instructions without the data they act on would be rather useless. You would have some trees, but not even be aware of the forest.
Code:objcopy -O binary input.elf output.bin
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}
A dump of all the raw section contents will include the data as well as the code. As long as everything has already been relocated, the code will be loaded at the appropriate address (the linker can control that) and/or the code is position independent, it will work fine.
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}