On Mon, Nov 23, 2020 at 9:10 AM Walter Dnes <waltd...@waltdnes.org> wrote:
>
>
>   Ouch!  Are the CPUs exactly identical?  If not, then you may get the
> "Illegal instruction" error.  This is a "feature" of Gentoo, which is
> often user-optimized for a specific CPU.

This "feature" has nothing to do with Gentoo, but just with the fact
that users can set their CFLAGS to whatever you wish.  If you set a
conservative -march and then set a more aggressive -mtune then your
binaries will run anywhere.  That is how most distros do it.

The default CFLAGS in make.conf are "-O2 -pipe".  If you stick to
those defaults your binaries will run anywhere.

There is nothing wrong with using -march, but you definitely need to
keep in mind that if you ever change CPUs then you're going to need to
rebuild everything.

You could just rebuild @system with generic CFLAGS and then rebuild
everything with -march=native or whatever you prefer once your new
system is running.  Your applications wouldn't run that way, but you
could still boot the OS and the toolchain will work.  If gcc is broken
then you can't rebuild in place.

-- 
Rich

Reply via email to