[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: target triplet

From: Steven G. Johnson
Subject: Re: target triplet
Date: Wed, 03 Jan 2007 15:17:13 -0500
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

Bob Rossi wrote:
I know the target triplet is the cpu-vendor-os triplet where the
executable runs. Does changing the cpu from i386-pc-mingw32 to
i686-pc-mingw32 actually change executable that is created?

No (not unless your configure script does something unusual).

If not, does anyone know where the correct place to ask about cpu
specific gcc optimizations would be?

For some scientific/numerical code that I work on, I created a macro that tries fairly hard to guess the "native" architecture flag for gcc. See:

The target triplet is not nearly enough information, unfortunately, at least not on x86. On x86, the only reasonably comprehensive and portable thing I could find was to look at the output of the CPUID instruction (which doesn't work when cross-compiling, of course). Unfortunately, I found that information about the CPUID output is rather scattered (you'd think that there would be a web page or something that just gives a list of all the CPUID codes for the different Intel and AMD processors, but I haven't found anything even close to this).

By default, it uses the architecture type (which can be overridden by a --with-gcc-arch flag) only for an -mtune option so that the executable is still portable. I usually add configure flag --enable/disable-portable-binary to switch this to -march if the user only wants to run the executable on a single target.

If you are not writing your own code, but are just compiling someone else's code, then you can usually override the compiler flags by setting CFLAGS (for a C program) or CXXFLAGS (for a C++ program), e.g.
   ./configure CFLAGS="-march=pentium4 -O3 -fomit-frame-pointer"
or whatever flags you want.

Steven G. Johnson

reply via email to

[Prev in Thread] Current Thread [Next in Thread]