Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[INSTALL] bezpieczne flagi + gcc
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Polskie forum (Polish) Instalacja i sprzęt
View previous topic :: View next topic  
Author Message
tuniek
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2005
Posts: 113
Location: Poland

PostPosted: Mon Dec 19, 2005 11:52 am    Post subject: [INSTALL] bezpieczne flagi + gcc Reply with quote

Pytam bo chcę sie upewnić.

Niedawno zainstalowałem gentoo na dwuprocesorowej maszynie (HT):

Code:

cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz         : 3000.242
cache size      : 16 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid
bogomips        : 5989.99

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz         : 3000.242
cache size      : 16 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid
bogomips        : 5989.99

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz         : 3000.242
cache size      : 16 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid
bogomips        : 5989.99

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz         : 3000.242
cache size      : 16 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid
bogomips        : 5989.99


wrzuciłem "bezpieczne flagi" takie jakie są sugerowane na http://gentoo-wiki.com/Safe_Cflags

czyli:


Code:

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -fomit-frame-pointer -mmmx -msse2 -mfpmath=sse -pipe"
CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j5"


instalowałem zgodnie z nowym handbookiem ... no i jechałem ze stage-a "x86" ...

Przy kompilowaniu gliba dostaję błąd:

Code:


....

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -pthread -march=nocona -O2 -fomit-frame-pointer -mmmx -msse2 -mfpmath=sse -pipe -Wall -MT garray.lo -MD -MP -MF .deps/garray.Tpo -c garray.c  -fPIC -DPIC -o .libs/garray.o
{standard input}: Assembler messages:
{standard input}:54: Error: suffix or operands invalid for `cmpxchg'
make[4]: *** [gatomic.lo] Błąd 1
make[4]: *** Czekam na niezakończone zadania....
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -pthread -march=nocona -O2 -fomit-frame-pointer -mmmx -msse2 -mfpmath=sse -pipe -Wall -MT gcache.lo -MD -MP -MF .deps/gcache.Tpo -c gcache.c  -fPIC -DPIC -o .libs/gcache.o
make[4]: Leaving directory `/var/tmp/portage/glib-2.6.5/work/glib-2.6.5/glib'
make[3]: *** [all-recursive] Błąd 1
make[3]: Leaving directory `/var/tmp/portage/glib-2.6.5/work/glib-2.6.5/glib'
make[2]: *** [all] Błąd 2
make[2]: Leaving directory `/var/tmp/portage/glib-2.6.5/work/glib-2.6.5/glib'
make[1]: *** [all-recursive] Błąd 1
make[1]: Leaving directory `/var/tmp/portage/glib-2.6.5/work/glib-2.6.5'
make: *** [all] Błąd 2

!!! ERROR: dev-libs/glib-2.6.5 failed.
!!! Function src_compile, Line 51, Exitcode 2
!!! (no error message)



Na gentoo-wiki jest uwaga przy tych flagach, że zalecane jest przejście na gcc. >=3.4 ... nie zrobiłem tego ...

Czy to jest własnie odpowiedź na mój problem?
_________________
"The reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." (George Bernard Shaw)
Back to top
View user's profile Send private message
red.13
n00b
n00b


Joined: 30 Dec 2004
Posts: 11
Location: Gliwice - Poland

PostPosted: Tue Dec 20, 2005 11:14 pm    Post subject: Reply with quote

Co prawda nie znam odpowiedzi na twój problem, ale czy przypadkiem fomit-frame-pointer może być (czyt. powinien) dołączany do kompilacji pod C++? Dzięki Bogu zawsze masz jeszcze możliwość sprawdzenia GCC 3.4+ :).
_________________
"I can (well, almost) hear you asking yourselves "why?". Hurd will be out in a year (or two, or next month, who knows), and I've already got
minix.
" :D
--Linus about starting the Linux project (1991)
Back to top
View user's profile Send private message
noobah
Apprentice
Apprentice


Joined: 11 Apr 2005
Posts: 210
Location: Ustonie Morskie, Poland

PostPosted: Wed Dec 21, 2005 12:24 am    Post subject: Reply with quote

Kiedyś było dużo szumu wokół -fomit-frame-pointer - bardzo często się kompilacje wykrzaczaly z tą flagą, ale zostało to naprawione w gcc-3.4 .
Wg mnie to może być twój problem.
_________________
the force is strong with me
Back to top
View user's profile Send private message
mbar
Veteran
Veteran


Joined: 19 Jan 2005
Posts: 1990
Location: Poland

PostPosted: Wed Dec 21, 2005 5:46 am    Post subject: Reply with quote

-mfpmath=sse nie jest ani bezpieczne, ani sensowne, usuń to
Back to top
View user's profile Send private message
Raku
Bodhisattva
Bodhisattva


Joined: 28 Feb 2004
Posts: 2374
Location: Poland

PostPosted: Wed Dec 21, 2005 8:20 am    Post subject: Reply with quote

mbar wrote:
-mfpmath=sse nie jest ani bezpieczne, ani sensowne, usuń to


chyba ci się coś pomerdało z -ffast-math
_________________
raku

Powered by Archlinux ;-)
Back to top
View user's profile Send private message
tuniek
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2005
Posts: 113
Location: Poland

PostPosted: Wed Dec 21, 2005 9:06 am    Post subject: Reply with quote

Spróbowałem uaktualnić gcc ....

wywala mi się już na początku ...

Code:

 emerge -uv gcc --resume
* --verbose is currently broken with --resume. Disabling...
*** Resuming merge...
>>> emerge (1 of 5) sys-devel/gcc-config-1.3.12-r4 to /
>>> md5 files   ;-) gcc-config-2.0.0_beta2.ebuild
>>> md5 files   ;-) gcc-config-1.3.12-r4.ebuild
>>> md5 files   ;-) files/digest-gcc-config-1.3.12-r4
>>> md5 files   ;-) files/wrapper-1.4.7.c
>>> md5 files   ;-) files/digest-gcc-config-2.0.0_beta2
>>> md5 files   ;-) files/gcc-config-1.3.12
>>> Unpacking source...
>>> Source unpacked.
/var/tmp/portage/gcc-config-1.3.12-r4/temp/cc8EGQkN.s: Assembler messages:
/var/tmp/portage/gcc-config-1.3.12-r4/temp/cc8EGQkN.s:26: Error: suffix or operands invalid for `push'
/var/tmp/portage/gcc-config-1.3.12-r4/temp/cc8EGQkN.s:28: Error: suffix or operands invalid for `push'
/var/tmp/portage/gcc-config-1.3.12-r4/temp/cc8EGQkN.s:30: Error: suffix or operands invalid for `push'
...
...
...
/var/tmp/portage/gcc-config-1.3.12-r4/temp/cc8EGQkN.s:1174: Error: suffix or operands invalid for `push'
/var/tmp/portage/gcc-config-1.3.12-r4/temp/cc8EGQkN.s:1175: Error: suffix or operands invalid for `push'

!!! ERROR: sys-devel/gcc-config-1.3.12-r4 failed.
!!! Function src_compile, Line 25, Exitcode 1
!!! compile wrapper



Próbowałem przy dwóch ustawieniach w make.conf:
1)
Code:

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


2)
Code:

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2  -mmmx -msse2  -fomit-frame-pointer  -mfpmath=sse  -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j5"


efekt jest ten sam ...

Może popełniam jakiś grubszy błąd?
_________________
"The reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." (George Bernard Shaw)
Back to top
View user's profile Send private message
mbar
Veteran
Veteran


Joined: 19 Jan 2005
Posts: 1990
Location: Poland

PostPosted: Wed Dec 21, 2005 10:00 am    Post subject: Reply with quote

@raku: nie pomerdało się, polecam poczytać co nieco
Back to top
View user's profile Send private message
Raku
Bodhisattva
Bodhisattva


Joined: 28 Feb 2004
Posts: 2374
Location: Poland

PostPosted: Wed Dec 21, 2005 10:20 am    Post subject: Reply with quote

mbar wrote:
@raku: nie pomerdało się, polecam poczytać co nieco


a możesz jakieś linki zapodać?
bo na stronie domowej gcc wyczytałem jedynie, że np. dla x86_64 flaga ta jest domyślnie włączana
_________________
raku

Powered by Archlinux ;-)
Back to top
View user's profile Send private message
damjanek
Apprentice
Apprentice


Joined: 21 Jun 2004
Posts: 259
Location: Poland, Poznań

PostPosted: Wed Dec 21, 2005 3:19 pm    Post subject: Reply with quote

jeśli to ma być 64bitowa instalacja, to należałoby chyba użyć livecd i stage dla amd64, afair...
_________________
$ uname -rms
Darwin 10.0.0 i386
Welcome to Darwin!
#gentoo-pl@freenode and #gentoo.pl@ircnet team
Back to top
View user's profile Send private message
tuniek
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2005
Posts: 113
Location: Poland

PostPosted: Wed Dec 21, 2005 6:49 pm    Post subject: Reply with quote

Quote:

jeśli to ma być 64bitowa instalacja, to należałoby chyba użyć livecd i stage dla amd64, afair...


noo ja w sumie jechałem z x86 ...
_________________
"The reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." (George Bernard Shaw)
Back to top
View user's profile Send private message
mbar
Veteran
Veteran


Joined: 19 Jan 2005
Posts: 1990
Location: Poland

PostPosted: Wed Dec 21, 2005 7:57 pm    Post subject: Reply with quote

więc po 1-wsze, flaga -mfpmath nie działa poprawnie w gcc w wersjach wcześniejszych niż 4.x (nie to że programy nie działają, tylko działają gorzej)
po 2-gie: "-mfpmath=sse will most likely slow FPU calculations down, but your mileage may vary. If you're not sure that it will speed things up, get rid of it. You won't notice the difference unless you run some heavy-duty scientific software applications."
po 3-cie: "-ftracer bloats code a bit so I suggest that you remove it too. "
po 4-te: "-fweb makes compilation times longer and doesen't do much good"

ja od dłuższego czasu kompiluję cały system z flagami:
Code:
CFLAGS="-Os -march=ARCHITEKTURA -pipe -fomit-frame-pointer -fforce-addr -ffast-math -falign-functions=4"
(lub =5 na AMD64).

polecam też https://forums.gentoo.org/viewtopic-t-318191.html skąd zaczerpnąłem cytaty :)
Back to top
View user's profile Send private message
Raku
Bodhisattva
Bodhisattva


Joined: 28 Feb 2004
Posts: 2374
Location: Poland

PostPosted: Wed Dec 21, 2005 8:24 pm    Post subject: Reply with quote

mbar wrote:
polecam też https://forums.gentoo.org/viewtopic-t-318191.html skąd zaczerpnąłem cytaty :)

widzisz - co strona to inny expert. Ja znalazłem cos takiego. Wynika tu, że -mfpmath=sse jednak przyśpiesza działanie programu.

Ja bym sie wstrzymał z komentowaniem działania poszczególnych flag bez jakichkolwiek testów, polegając jedynie na zasłyszanych opiniach.
_________________
raku

Powered by Archlinux ;-)
Back to top
View user's profile Send private message
mbar
Veteran
Veteran


Joined: 19 Jan 2005
Posts: 1990
Location: Poland

PostPosted: Wed Dec 21, 2005 8:48 pm    Post subject: Reply with quote

Ja bym się wstrzymał przed wyciąganiem wniosków na podstawie tak wątpliwego testu. Zobacz
Code:
-Os -march=pentium3 -s -fomit-frame-pointer -pipe 0,54382833
-Os -march=pentium3 -s -mfpmath=sse -pipe 0,47106759
-Os -march=i686 -s -fomit-frame-pointer -pipe 0,45700264
-Os -mtune=i686 -s -fomit-frame-pointer -pipe 0,45439498


im mniej tym lepiej, wygrywa kompilacja na i686 i generalnie -Os wychodzi najlepiej. Ale jedyny wniosek, jaki można z tego wyciągnąć, to to, że gcc 3.4.3 daje dupy i nie potrafi optymalizować kodu po włączeniu march=pentium3. W tym teście mfpmath=sse nie powoduje przyśpieszenia działania programu, tylko nieco naprawia to, co march=pentium3 zepsuło.
PS. ja używam gcc-4.0.2
PS2. Poza tym inne testy dowodzą czego innego (wiadomo ;) ) Np. acovea pokazuje:
http://www.coyotegulch.com/products/acovea/aco5k8gcc40.html
"GCC should strongly consider changing the default for AMD64 to -mfpmath=387 when -funsafe-math-optimizations is enabled." ... "that -funsafe-math-optimizations (a component of -ffast-math) is only effective when it is coupled with -mfpmath=387. For Opteron processors, the default settings is -mfpmath=sse — and SSE mathematics do not include all of the intrinsic mathematical functions that can be inlined via -funsafe-math-optimizations." ... "A higher "-O" level does not guarantee faster code. By implication, -O3 should produce code that is faster than -O1, but it doesn't."
To ostatnie stwierdzenie jest bolesne, ale także widoczne i w tym podanym przez Ciebie teście.

Generalnie wychodzi na to, że dla desktopowego systemu nie warto przesadzać z ustawianiem CFLAGS. Odkąd używam -Os mój laptop zachowuje się zauważalnie lepiej.
Back to top
View user's profile Send private message
mirekm
Apprentice
Apprentice


Joined: 12 Feb 2004
Posts: 210
Location: Gliwice

PostPosted: Sun Dec 25, 2005 9:30 am    Post subject: Reply with quote

Zaraz zaraz.
Chyba coś mieszacie. Flaga -mfpmath=sse nie jest zalecana dla procesorów nie posiadających SSE2, ponieważ sse v1 ma zbyt małą dokładność obliczeń (za mała liczba bitów), a po drugie nie działa najlepiej.
Z tego wynika, żeby w pentium 3 nie używać, ale w pentium 4 już tak (bo wykorzystywane jest sse2)

Pozdrawiam
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Polskie forum (Polish) Instalacja i sprzęt All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum