View Single Post
Old 13th November 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

Quote:
Originally Posted by nfries88
Also is there any simple way to use an AMD64 to build and test i386 binaries? Or would I need to set up a cross-compiler and run in an emulator?
The processor used to host the compiler, has less effect effect on the binaries generated by the compiler, then most people think. If it wasn't this way, the word "cross compiler" would have a different meaning.

You can use the machine flags (-m) to adjust the output created by the GNU Compiler Collection (GCC), -m32 -> 32-bit environment, -m64 -> 64-bit environment. I don't know off hand if you need both a 32-bit and 64-bit version of binutils for the platforms in question, but you probably do.

Quote:
Originally Posted by nfries88
I know 32-bit systems cannot run 64-bit binaries.
All AMD64 processors can run in 32-bit mode? Is that a BIOS option?
Also, 64-bit processors can run 32-bit binaries? I thought that was only a Windows feature.
The x86-64 chips we usually call AMD64, understand the instruction sets used for 32-bit/16-bit x86 programs + the relevant 64-bit portions of the instruction set / Long Mode, etc.


So, as the processor can understand the machine code, the Operating System can be made to understand the binary format used for the executable images -> this is ELF in 32-bit/64-bit forms; in the case of modern Linux/BSD systems if memory serves.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote