Safe CFLAGS to use for Gentoo

Safe Cflags

From Gentoo Linux Wiki

Jump to: navigation, search
This article is part of the FAQ series.
General Portage Wiki

Contents

[hide]
<script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>

Safe CFLAGS to use for Gentoo

These CFLAGS are for gcc 3.x and 4.x. To check your version:

gcc --version

You can see which CPU you have with the following command:

cat /proc/cpuinfo

If you're running Intel, you can also use x86info to get more detailed info about your chip:

emerge -av x86info

This page is for those who don't want to experiment, and want a stable system, but still optimized for their CPU. But remember, by using these flags, binaries from your system might not work on another one with a different CPU. So if you compiled with the flags optimized for a Pentium 4 (-march=pentium4), you can't share a hard disk or packages with a friend who only has a Pentium MMX (-march=pentium-mmx). Though the other way around should work, see below. This is the case if you are using the -march flags. If you use -mtune instead without any -march option, your binaries are backward compatible down to i386, but the scheduling is optimized for your choosen architecture. CPUs are also backward compatible so if you update your system with a new CPU you can still use your old packages. There is one exception though; if your old CPU supports a instruction set, like AMD's 3dnow, that your new CPU don't. So if you have an athlon (-march=athlon) and upgrade to a pentium4 you can't use your old packages. You can mix -march and -mtune if you, for example, would like to create binaries that would run on any i686 but are optimized for a pentium4. That would be accomplished by using -march=i686 and -mtune=pentium4.

Note that -O2 is regarded as safer than "-O3", and "-O3" can often be a counter-productive attempt at optimization. On computers with limited cache and/or memory, "-Os" provides better performance through smaller binaries.

Please do not include any flags that aren't 100% safe. Just because it works for you doesn't mean it will for everyone else.

Flags like -mmmx, -msse, etc. are enabled by default if you use a correct -march option, so there is usually no need to add those. The flag -mfpmath=sse however is not enabled by -march but it usually makes binaries slower due to limitations in the glibc headers. So it's better to not use this flag, even if you have an SSE capable CPU. Also -mfpmath=sse,387 is experimental and unstable.

The flag -fomit-frame-pointer is enabled by default on arches where it doesn't interfere with debugging, such as AMD64. The gcc manual is a bit unclear on which arches -fomit-frame-pointer is actually enabled, but it's not on x86. So if you're on x86 you should add it to your CFLAGS. Also don't use -momit-leaf-frame-pointer together with -fomit-frame-pointer. It's pointless as -fomit-frame-pointer already removes all frame pointers. In fact if you use both, -momit-leaf-frame-pointer overrides -fomit-frame-pointer creating less optimized code.

If you are, or plan on becoming a programmer/developer, then DO NOT use the -fomit-frame-pointer or -O3 flag as this can make debugging impossible, or at least a lot harder (especially on x86 machines).

i386 (Intel, AMD)

Do you really want to install gentoo on that?

CHOST="i386-pc-linux-gnu"
CFLAGS="-march=i386 -Os -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

i486 (Intel, AMD, Cyrix)

You probably don't actually want to compile Gentoo on a 486, but you can use a faster computer to build Gentoo and then transfer the results to the 486 and use it for lightweight servers. -Os is beneficial given the small memory and L1 cache of most 486 systems.

CHOST="i486-pc-linux-gnu"
CFLAGS="-march=i486 -Os -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Intel Processors

Pentium (Intel)

vendor_id : GenuineIntel
cpu family : 5
model : 2
model name : Pentium 75 - 200

CHOST="i586-pc-linux-gnu"
CFLAGS="-march=pentium -Os -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Pentium w/ MMX (Intel)

CHOST="i586-pc-linux-gnu"
CFLAGS="-march=pentium-mmx -Os -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Cyrix MediaGX / AMD Geode GX1

CHOST="i586-pc-linux-gnu"
CFLAGS="-march=pentium-mmx -Os -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Pentium PRO (Intel)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentiumpro -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Pentium II (Klamath), (Intel)

vendor_id : GenuineIntel
cpu family : 6
model : 3
model name : Pentium II (Klamath)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium2 -Os -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Pentium II (Deschutes), (Intel)

vendor_id  : GenuineIntel
cpu family  : 6
model  : 5
model name  : Pentium II (Deschutes)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium2 -Os -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Celeron (Mendocino), aka Celeron1 (Intel)

vendor_id : GenuineIntel
cpu family : 6
model : 6
model name : Celeron (Mendocino)
stepping : 0

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium2 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Pentium III (Intel)

vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Pentium III (Katmai)
stepping : 3

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Celeron (Coppermine) aka Celeron2 (Intel)

vendor_id  : GenuineIntel
cpu family  : 6
model  : 8
model name  : Pentium III (Coppermine)
stepping  : 10

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Celeron (Willamette) (Intel)

vendor_id  : GenuineIntel
cpu family  : 15
model  : 1
model name  : Intel(R) Celeron(R) CPU 1.70GHz
stepping  : 3

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Pentium M(Centrino)/Celeron M (Intel)

vendor_id  : GenuineIntel
cpu family  : 6
model  : 9 or 13
model name  : Intel(R) Pentium(R) M processor XXXXMHz

For gcc 3.3:

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -msse2 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

For gcc 3.4 and later:

CHOST="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

The Celeron M is based on the Pentium M but it has half the L2 cache and does not support the SpeedStep technology. You can have similar results as with SpeedStep by using p4-clockmod module (clock frequency modulation).

comment:
I had a lot of problems with this settings ("-O2 -march=pentium-m -pipe -fomit-frame-pointer") and gcc 3.4.5. See also here: http://gentoo-wiki.com/Talk:Safe_Cflags

Now I use CFLAGS="-mcpu=i686 -O3 -pipe". Now GCC works!

Pentium 4 (Intel)

vendor_id  : GenuineIntel
cpu family  : 15
model  : 0 or 2
model name  : Intel(R) Pentium(R) 4 CPU XXXXMHz

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Pentium 4 (Prescott) (Intel)

vendor_id : GenuineIntel
cpu family : 15
model : 3 or 4
model name  : Intel(R) Pentium(R) 4 CPU XXXGHz -or- Mobile Intel(R) Pentium(R) 4 CPU XXXGHz -or- Intel(R) Celeron(R) CPU XXXGHz

you can verify the chip is a Prescott by looking for pni in the flags section of /proc/cpuinfo. this indicates support for SSE3. In 2004, Intel started branding processors with the Prescott core as Intel Celeron D.

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Pentium D 8xx / 9xx

vendor_id : GenuineIntel
cpu family : 15
model  : 4
model name  : Intel(R) Pentium(R) D CPU x.xxGHz
cpu cores  : 2

Note: Because of the EM64T support, the Gentoo architecture for this chip is amd64. TODO: Could somebody please check the 9xx cpuinfo is identical to the 8xx cpuinfo?
Append: my 9xx registers model 6 not model 4. It also has syscall instead of pbe. It has constant_tsc and lahf_lm. It's missing est.

Note: For those who don't need the Intel's 64-bit extension(EM64T), just use the Pentium4(Prescott) flags with MAKEOPTS="-j3" which is on desktop in most of the cases the better choice *and* use CHOST="i686-pc-linux-gnu" (for a strictly 32-bit environment).

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j3"

Xeon w/o EM64T (Intel)

vendor_id  : GenuineIntel
cpu family  : 15
model  : 2
model name  : Intel(R) Xeon(R) CPU XXXXMHz

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -fomit-frame-pointer -pipe"
CXXFLAGS="${CFLAGS}"

If you have hyperthreading turned on, then each processor counts as two logical CPUs, so if you have two hyperthreaded CPUs, then you should use MAKEOPTS="-j5" in your make.conf.

Xeon w/EM64T (Intel) (also Pentium 4 P6xx)

vendor_id  : GenuineIntel
cpu family  : 15
model  : 4
model name  : Intel(R) Xeon(R) CPU XXXXMHz

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CXXFLAGS="${CFLAGS}"

Use stage: amd64 (also make sure you use amd64 install disc)

note: If you have hyperthreading turned on, then each processor counts as two logical CPUs, so if you have two hyperthreaded CPUs, then you should use MAKEOPTS="-j5" in your make.conf. This wont affect the generated code but might make your compiles faster.
note: -O3 flag degraded OpenSSL benchmark 0-2% depending on the test. GnuPG became ~1% slower.

Intel Core Solo/Duo (Yonah)

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc pni monitor vmx est tm2 xtpr

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

VIA Processors

Esther C5J (Via C7)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=i686 -Os -pipe -mmmx -msse -msse2 -msse3"
CXXFLAGS="${CFLAGS}"

Nehemiah (C5XL)/C5P (Via)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=i686 -msse -mmmx -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

note: The more recent versions of the C3 do support the cmov instruction and hence -march=i686. If you must be compatible with all VIA C3 versions, do not use the settings in this section.

note: it is also possible to use "-march=c3-2". <-- Comment to this: I got a problem "compiler can't create executables" with this setting.

note: I had much better luck with -Os than with -O2. The cache on the nehemiah chips is really small, so making the executables small helps more than anything else.

note: I use -mtune=pentiumpro to try and best schedule for the chip.

-mtune=pentiumpro is identical to -mtune=i686 which is impiled by -march=i686.

Eden C3/Ezra (Via EPIA)

CHOST="i586-pc-linux-gnu"
CFLAGS="-march=i586 -m3dnow -Os -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Warning: Do not use any stages or packages containing i686 instructions (such as cmov) with the Samuel 2 and Ezra versions of the C3.

Note: The ezra doesn't have any special instructions that you could optimize for, just consider it a K6-3 - basically a P2 with 3DNow. With gcc 3.3.x you may be able to use "-march=c3", but there may be problems similar to use of "-march=c3-2".

Due to the small 64kb cache on the Via C3 CPU, '-Os' works better since it makes smaller binaries.

Note that the Mini-ITX EPIA-SP features a VIA C3 Eden processor, even if a cat /proc/cpuinfo answers: model name: VIA Nehemiah

Transmeta Processors

Transmeta Efficeon

vendor_id  : GenuineTMx86
cpu family  : 15
model  : 2
model name  : Transmeta Efficeon(tm) Processor TM8000
stepping  : 4

CHOST="i686-pc-linux-gnu"
CFLAGS="-mtune=pentium3 -msse2 -O2 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -pipe"
CXXFLAGS="${CFLAGS}"

Note: The Efficeon processor will reorder and realign instructions on translating form x86 to VLIW (Very Large Instruction Word), so not aligning functions/jumps/loops will produce smaller executable without any effect on speed.

AMD Processors

K6 (AMD)

CHOST="i586-pc-linux-gnu"
CFLAGS="-march=k6 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

K6-2 (AMD)

vendor_id  : AuthenticAMD
cpu family  : 5
model  : 8

CHOST="i586-pc-linux-gnu"
CFLAGS="-march=k6-2 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Note: /proc/cpuinfo indicates AMD6-3DNow(R). This does not imply K6-3 (AMD).
Note: I had some problemes with -march=K6-2 with somes packages
Note: -march=k6-* should be avoided, use -mtune instead (see bug #24379)

K6-3 (AMD)

CHOST="i586-pc-linux-gnu"
CFLAGS="-march=k6-3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Duron (AMD)

From 600 to 900 MHz (these models have a tbird-alike core model)

product: AMD Duron(tm) Processor version: 6.3.1

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-tbird -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Mobile Duron (AMD)

vendor_id : AuthenticAMD
cpu family : 6
model : 3
model name : AMD Duron(tm) Processor

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-tbird -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Duron Morgan (AMD)

From 900 to 1300 MHz
The Morgan Durons are based on the Palomino core, and hence can be treated as Athlon XP's.

vendor_id : AuthenticAMD
cpu family : 6
model : 7
model name : AMD Duron(tm) Processor
stepping : 1

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Athlon (AMD)

vendor_id : AuthenticAMD
cpu family : 6
model : 4 or 2
model name : AMD Athlon(TM)Processor
stepping : 4 or 2

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Athlon-tbird, aka K7 (AMD)

vendor_id : AuthenticAMD
cpu family : 6
model : 4
model name : AMD Athlon(tm) Processor

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-tbird -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Athlon-tbird XP (AMD)

vendor_id  : AuthenticAMD
cpu family  : 6
model  : 8
model name  : AMD Athlon(tm)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Athlon 4 (AMD)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-4 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Athlon XP (AMD)

vendor_id  : AuthenticAMD
cpu family  : 6
model  : 6
stepping  : 2

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Athlon MP (AMD)

vendor_id  : AuthenticAMD
cpu family  : 6
model  : 10
model name  : AMD Sempron(tm)
stepping  : 0

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-mp -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Athlon 64 X2 (AMD)

vendor_id: AnthenticAMD
cpu family: 15
model: 43
stepping: 1 or 2
model name: AMD Athlon(tm) X2 Dual Core Processor


32 bit

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

64 bit

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe"
CXXFLAGS="${CFLAGS}"

If you have a newer Athlon64("Venice" or "San Diego")/Athlon64-X2("Manchester" or "Toledo") you can also add -msse3 to your CFLAGS to enable SSE3 support. Any chip using the 90nm process except for the "Winchester" class Athlon64 supports SSE3.

Also bear in mind that all Athlon64 X2 and Opteron 165, 170, 175, 180, and 185 processors are dual-core CPUs so make sure that you use MAKEOPTS="-j3" in your make.conf. This doesn't affect the code but might reduce compile times.

1xx Opteron (AMD)

vendor_id  : AuthenticAMD
cpu family  : 15
model  : 5
model name  : AMD Opteron(tm) Processor 1xx
stepping  : 8

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=opteron -O2 -pipe"
CXXFLAGS="${CFLAGS}"

2xx/8xx Opteron (AMD)

vendor_id  : AuthenticAMD
cpu family  : 15
model  : 5
model name  : AMD Opteron(tm) Processor xxx
stepping  : 8

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=opteron -O2 -pipe"
CXXFLAGS="${CFLAGS}"

Sempron/Sempron64 (AMD)

  • If it is a Socket A (Socket 462) Sempron you can be sure it is nor 64-bit capable nor SSE3 capable.
  • If it is a Socket 754 it can be SSE3 capable or 64-bit capable (all 64-bit semprons are SSE3 capable).
  • If it is a Socket AM2 Sempron you can be sure it is both 64-bit and SSE3 capable.
  • Anyway you should check /proc/cpuinfo for pni (SSE3) string before using -msse3.

vendor_id : AuthenticAMD
cpu family : 15
model : 44
model name : AMD Sempron(tm) Processor


32 bit

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

32 bit (SSE3 capable)

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -fomit-frame-pointer -msse3"
CXXFLAGS="${CFLAGS}"

Sempron64 - 64 bit

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -msse3"
CXXFLAGS="${CFLAGS}"

Turion64 (AMD)

32 bit

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -msse3 -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

64 bit

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -msse3"
CXXFLAGS="${CFLAGS}"

Mobile Sempron (AMD)

vendor_id : AuthenticAMD
cpu family : 15
model : 8
model name : Mobile AMD Sempron Processor 2800+

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -msse3 -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

If you have a Sempron without SSE3 (earlier chips), omit "-msse3".
SSE3 is called pni (prescott new instuction) by cpuinfo (cat /proc/cpuinfo).

On 32bit Sempron Mobile K8 you must add -m32 to avoid 64bit compilation of some packages as this CPU has full K8 architecture but hasn't got 64bit instruction set.

Check it out, there are many different sempron mobile on sell, those who works on 1.8GHz are K8 (i.e. AMD SM 3000+), some others, older, aren't yet k8 but they're still k7 so you must specify athlon-xp instead of athlon64, anyway AMD announced in 2006 there will be 64bit Sempron Mobile so be carefull and pay attention, run a cat /proc/cpuinfo and then ask on AMD forums if you don't know what to do.

PowerPC Processors

PowerPC 601

The PowerPC 601 CPU is a mixture between POWER and PowerPC architectures and it is a must you specify -mcpu=601 for taking advantage of the POWER part of the processor and do not use unimplemented PowerPC instructions (implementation of both ISAs is incomplete on 601).

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=601 -O2 -pipe"
CXXFLAGS="${CFLAGS}"

NOTE: Code created with this flags will not run in any other CPU but PowerPC 601, if you want to run on 601 and others use -mcpu=common and code will run in ANY POWER or PowerPC CPU.

PowerPC 603

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=603 -O2 -pipe"
CXXFLAGS="${CFLAGS}"

PowerPC 603e

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=603e -O2 -pipe"
CXXFLAGS="${CFLAGS}"

PowerPC 604

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=604 -O2 -pipe"
CXXFLAGS="${CFLAGS}"

PowerPC 604e

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -mcpu=604e -fomit-frame-pointer -pipe"
CXXFLAGS="${CFLAGS}"

-Os may be beneficial on older processors (of any kind, not just PowerPCs).

PowerPC 604e

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=604e -O2 -pipe -fno-strict-aliasing"
CXXFLAGS="${CFLAGS}"

PowerPC 750 (G3)

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=750 -Os -pipe -fno-strict-aliasing"
CXXFLAGS="${CFLAGS}"

Given the smaller cache sizes, and the fact that the L2 cache is off-die on the G3, better performance may be achieved with -Os rather than -O2.

PowerPC 750cx (G3e)

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=750 -O2 -pipe -fno-strict-aliasing"
CXXFLAGS="${CFLAGS}"

The 750cx offers more L2 cache than its predecessor, and moves it on-die for a performance boost. Better performance may be achieved with -O2.

PowerPC 7400 (G4)

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=7400 -O2 -pipe -maltivec -mabi=altivec"
CXXFLAGS="${CFLAGS}"

Note: -O3 is unstable on G4

PowerPC 7450 (G4 second generation)

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=7450 -O2 -pipe -fno-strict-aliasing -maltivec -mabi=altivec"
CXXFLAGS="${CFLAGS}"

Note: do not use -fsigned-char

Note: -O3 is unstable on G4

Note: -mpowerpc-gfxopt may slow down certain applications - It's already implied by mcpu, please don't enable it, it's useless.

PowerPC 970 (G5)

CHOST="powerpc64-unknown-linux-gnu"
CFLAGS="-O2 -mcpu=G5 -maltivec -mabi=altivec -fno-strict-aliasing -pipe"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1"

Cell Broadband Engine

CHOST=""
CFLAGS=""
CXXFLAGS="${CFLAGS}"
LDFLAGS=""

PowerPC (If you don't know which one)

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -pipe -fno-strict-aliasing"
CXXFLAGS="${CFLAGS}"

Embedded PowerPC CPUs

You should check /proc/cpuinfo for the CPU model and then for a correct -mcpu flag on man gcc. If you do not find it, use above.

CHOST="powerpc-unknown-linux-gnu"
CFLAGS="-mcpu=<flag>-O2 -pipe -fno-strict-aliasing"
CXXFLAGS="${CFLAGS}"

Other Processors

Sparc

CHOST="sparc-unknown-linux-gnu"
CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"

Sparc 64

CHOST="sparc-unknown-linux-gnu"
CFLAGS="-mcpu=ultrasparc -mtune=ultrasparc -O2 -pipe"
CXXFLAGS="${CFLAGS}"

Be careful! The CHOST for Sparc64 is still sparc-unknown-linux-gnu, not sparc64-!

HPPA 1.1

CHOST="hppa1.1-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mschedule=7100LC -march=1.1 -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

HPPA 2.0

CHOST="hppa2.0-unknown-linux-gnu"
CFLAGS="-O2 -pipe -march=2.0 -mschedule=8000 -fomit-frame-pointer"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer"

Alpha ev56

CHOST="alpha-unknown-linux-gnu"
CFLAGS="-mieee -O2 -mcpu=ev56 -pipe"
CXXFLAGS="${CFLAGS}"

Alpha ev67

CHOST="alpha-unknown-linux-gnu"
CFLAGS="-mcpu=ev67 -Wa,-mev6 -O3 -pipe "
CXXFLAGS="${CFLAGS}"

This applies to ev68 (Compaq Alpha DS25) machines too. Without -mcpu=ev67 -Wa,-mev6 flags it cannot bootstrap at all.

See Also

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值