Aaron J. Seigo said:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Monday 16 June 2003 03:41, Jesse Kline wrote:
>> packages of the apps I compile. I know that when building a src.rpm you
>> can target a specific architecture, but I'm not sure how to do that when
>> you compile a tarball.
>
> you usually use the gcc arch flags... i usually use -march=pentiumpro
> since i
> have Pentium based systems (pro, II, III... doesn't matter)... gcc's
> man/info
> pages list all the different arch options; you can also use the -mcpu and
> related flags, but i find -march nice and convenient...

-mcpu= will optimize for a particular type of CPU without breaking
compatibility with other types of CPUs.  -march= will take full advantage
of your CPU but will also break compatibility with older CPUs  So:

-mcpu=pentium2 will produce binary files that will run better on a Pentium
2 then -mcpu=i386 will but it *will* also run on anything like a 386 or
Pentium 4

-march=pentium2 will produce binary files that will run better on a
Pentium 2 then -march=i386 will but it *will not* run on a 386 or Pentium
Pro or anything else older then a Pentium 2.  So if you have compiled
something using -march=pentium3 and your friend has a Pentium 2, he would
not be able to run that binary if you copied it onto his computer.

Don't use -march=pentium4 or -march=althon-4, they both generate invalid
instructions and cause problems.  Even things you might pass off as bugs
in the software might actually be a result of using those flags.  (Unless
they fixed that bug in GCC 3.3, can anyone confirm that?)

You can also mix and match the flags, for example I use -march=pentium3
-mcpu=pentium4 -O3 -pipe.  That way it will run on Pentium 3 and higher
but still be somewhat optimized for a Pentium 4 without generating invalid
instructions.


Cheers,

-- 
Trevor Lauder
Web: http://www.thelauders.net
E-Mail: [EMAIL PROTECTED]
Resume: http://www.thelauders.net/resume/
Gentoo Linux Powered

"Any intelligent fool can make things bigger and more complex... It takes
a touch of genius -- and a lot of courage to move in the opposite
direction."  -- Albert Einstein

Reply via email to