-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Alle 16:59, giovedì 23 ottobre 2003, Eraser Head ha scritto a MLdrake in merito a [newbie-it] gcc : > Ciao a tutti. > Ho scoperto da pochissimo che il gcc quando compila ottimizza il > compilato per la macchina in uso. > Il codice cosi' compilato produce quindi dei sorgenti che non e' > detto funzionino su altre macchine (ad esempio con processore > diverso). > > Volevo quindi chiedervi se esiste un modo (e qual e') per compilare > del codice in modo tale che l'eseguibile generato non sia ottimizzato > per l'hardware della macchina, e possa cosi' essere eseguito su altre > macchine senza problemi.
mettendo in uno script di avvio una cosa del genere export CFLAGS="-O1 -mcpu=i386" nota che si usa spesso compilare per 686 permettendo l'esecuzione del codice anche 3-486; mettendo mcpu 686 ma march 386 march chiama mcpu, quindi mettendo ad esempio march athlon si usano le caratteristiche i registri e le istruzioni degli athlon, in quel caso è quindi implicita la mcpu athlon da man gcc: - -mcpu=cpu-type Tune to cpu-type everything applicable about the generated code, except for the ABI and the set of available instructions. .... ... While picking a specific cpu-type will schedule things appropriately for that particular chip, the compiler will not generate any code that does not run on the i386 without the - -march=cpu-type option being used. .... -march=cpu-type Generate instructions for the machine type cpu-type. ... > > Grazie, > > Chiara - -- bye miKe ________________________________________________ Slackware 8.1 GNU/Linux 2.4.22 @ ASUS S1N 1330c R.U.#219755-S.R.U.#705-R.M.#110932-MajaGLUG User -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/mSu0F/9fksDJ4y0RAjbTAKC4Uov5dKrFjnJBwuKDBevbx4izQACgqkmX X73RNlxHlmLMhm+VYAypLus= =/Hdi -----END PGP SIGNATURE-----