<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vitaliy</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vitaliy"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Vitaliy"/>
	<updated>2026-05-06T03:42:08Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Gentoo_compile_flags&amp;diff=21777</id>
		<title>Gentoo compile flags</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Gentoo_compile_flags&amp;diff=21777"/>
		<updated>2006-04-19T23:11:22Z</updated>

		<summary type="html">&lt;p&gt;Vitaliy: /* Which flags to use */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:middle;padding-right:20px;width:10px;&amp;quot; | [[image:Gentoo_logo.png|Gentoo]]&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin: 0; margin-right:10px; border: 1px solid #dfdfdf; padding: 0em 1em 1em 1em; background-color:#F8F8FF; align:right;&amp;quot;&amp;gt;&lt;br /&gt;
=== Gentoo compile flags ===&lt;br /&gt;
This page gives an introduction to {{Gentoo}} compile flags.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{| style=&amp;quot;vertical-align:top;margin-left:20px;margin-right:20px&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
__NOTOC__&lt;br /&gt;
=== About compile flags in Gentoo ===&lt;br /&gt;
One strength of Gentoo is the ability to use global flags for code optimizing. This is done through the file /etc/make.conf ([http://gentoo-wiki.com/MAN_make.conf_5 man page]). Since the Pentium Mobile (Centrino) used in some Thinkpads supports the mmx and sse extensions of the insturuction set, using compile flags can speedup programs quite a bit. To use optimized code, you have to adjust the USE ([http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&amp;amp;chap=2 Gentoo Handbook]) variable, which contains the libraries and extensions you want to use and the CFLAGS variable, which contains compiler flags, that portage passes along to gcc.&lt;br /&gt;
&lt;br /&gt;
If you want to set specific flags for only one package, you can also use the file /etc/portage/package.use instead of the USE variable in make.conf.&lt;br /&gt;
&lt;br /&gt;
=== Which flags to use ===&lt;br /&gt;
In order to adjust USE correctly, you have to find out, which instruction set extensions your processor supports. You can use google for this, or look at /proc/cpuinfo. If you are using an older version of GCC (below 3.4) you should use:&lt;br /&gt;
&lt;br /&gt;
 CFLAGS=&amp;quot;-O2 -march=pentium4 -pipe -fomit-frame-pointer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
As of &amp;gt;=3.4 release of GCC Pentium-M CFLAGs are supported and the following should be used:&lt;br /&gt;
&lt;br /&gt;
 CFLAGS=&amp;quot;-O2 -march=pentium-m -pipe -fomit-frame-pointer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You might also use -O3, but it may cause crashes in your programs if you optimize too much.&lt;br /&gt;
Independently of the CPU it's also a good idea to tell portage which libraries to use. If you leave away all the libraries you don't need, you can save compile time, get a smaller binary size and faster programs.&lt;br /&gt;
&lt;br /&gt;
With either GCC version you should be using the following USE flags:&lt;br /&gt;
&lt;br /&gt;
 USE=&amp;quot;mmx mmx2 sse sse2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Example files ===&lt;br /&gt;
These are the make.conf and package.use files I use for my T40P:&lt;br /&gt;
*make.conf&lt;br /&gt;
 USE=&amp;quot;X mmx mmx2 sse sse2 qt kde -gpm -gtk -gtk2 -gnome -arts -alsa -cups -java -esd -v4l -v4l1 -samba -ipv6 -directfb -lirc -svga&amp;quot;&lt;br /&gt;
 CFLAGS=&amp;quot;-O2 -march=pentium4 -pipe -fomit-frame-pointer&amp;quot;&lt;br /&gt;
 CHOST=&amp;quot;i686-pc-linux-gnu&amp;quot;&lt;br /&gt;
 CXXFLAGS=&amp;quot;${CFLAGS}&amp;quot;&lt;br /&gt;
 MAKEOPTS=&amp;quot;-j2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*package.use&lt;br /&gt;
 sys-libs/glibc userlocales&lt;br /&gt;
 app-laptop/tpb xosd&lt;br /&gt;
 media-video/mplayer dvd xanim divx4linux network xvid live&lt;br /&gt;
 media-libs/xine-lib dvd&lt;br /&gt;
&lt;br /&gt;
=== Other portage features ===&lt;br /&gt;
There are lots of other great features in portage (the Gentoo package managing system). If you want to use Gentoo, you should read the docs on [http://gentoo.org gentoo.org] and the man pages of portage and make.conf.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Vitaliy</name></author>
		
	</entry>
</feed>