New Computer, what should I install?

Kristian Hermansen kristian.hermansen-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu May 17 15:54:25 EDT 2007


Matthew Gillen wrote:
>>From the gcc man page:
>> While picking a specific cpu-type will schedule things appropriately for
>> that particular chip, the compiler will not generate any code that does not
>> run on the i386 without the -march=cpu-type option being used.
> 
> Check the "-mtune=cpu-type" and "march=cpu-type" command line switches.

This is not entirely correct.  I generate code from gcc (amd64) 
targeting i386 all the time using only the -m32 option.  For instance:

administrator at khermans-um64:/tmp$ uname -a
Linux khermans-um64 2.6.20-15-generic #2 SMP Sun Apr 15 06:17:24 UTC 
2007 x86_64 GNU/Linux
administrator at khermans-um64:/tmp$ cat hello.c
#include <stdio.h>

int main() {
   printf("Hello World!\n");
}
administrator at khermans-um64:/tmp$ gcc -o hello64 hello.c
administrator at khermans-um64:/tmp$ file hello64
hello64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for 
GNU/Linux 2.6.0, dynamically linked (uses shared libs), not stripped
administrator at khermans-um64:/tmp$ ./hello64
Hello World!
administrator at khermans-um64:/tmp$ gcc -m32 -o hello32 hello.c
administrator at khermans-um64:/tmp$ file hello32
hello32: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for 
GNU/Linux 2.6.0, dynamically linked (uses shared libs), not stripped
administrator at khermans-um64:/tmp$ ./hello32
Hello World!

Any questions?
-- 
Kristian Hermansen

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.






More information about the Discuss mailing list