Gentoo Archives: gentoo-user

From: R0b0t1 <r030t1@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Lowest common denominator compile
Date: Wed, 06 Sep 2017 03:37:15
Message-Id: CAAD4mYjKcCFDzY_nr_Y8DDW4X2=FvW-T311U2Gkqgb57jkJ7dg@mail.gmail.com
In Reply to: Re: [gentoo-user] Lowest common denominator compile by Grant
1 On Tue, Sep 5, 2017 at 10:28 PM, Grant <emailgrant@×××××.com> wrote:
2 >>>> Now I'm running into "trap invalid opcode" errors on the older
3 >>>> systems. Can I disable some of the newer CPU instruction sets on the
4 >>>> master laptop when compiling to hopefully generate binaries that will
5 >>>> work on the older systems?
6 >>>
7 >>> Yes. You need to find out CPU_FLAGS_X86 and "-march=" values the
8 >>> machines have, and use that in make.conf. Run the commands...
9 >>>
10 >>> cpuinfo2cpuflags-x86
11 >>> gcc -c -Q -march=native --help=target | grep march=
12 >>>
13 >>> ...on the target machines. This will tell you what "native" is and
14 >>> what CPU_FLAGS_X86 values to use.
15 >>>
16 >>> https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/x86-Options.html#x86-Options
17 >>> lists available "march=" options, and what instruction sets they support.
18 >>> E.g. my old core2 desktop shows...
19 >>>
20 >>> [d531][waltdnes][~] cpuinfo2cpuflags-x86
21 >>> CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3"
22 >>>
23 >>> [d531][waltdnes][~] gcc -c -Q -march=native --help=target | grep march=
24 >>> -march= core2
25 >>>
26 >>>
27 >>> Unless the laptops are really old, you can probably get away with...
28 >>> CFLAGS="-O2 march=core2 -mfpmath=sse -fopenmp -fomit-frame-pointer -pipe -fno-unwind-tables -fno-asynchronous-unwind-tables"
29 >>>
30 >>> booby trap 1) Unless all machines are Intel "Atom" family, do *NOT* use
31 >>> a "march=" that implements the "movbe" instruction.
32 >>>
33 >>> booby trap 2) If you throw in any AMD-based machines proceed with care.
34 >>>
35 >>> Can you post the output of...
36 >>> gcc -c -Q -march=native --help=target | grep march=
37 >>> ...for all the target machines?
38 >>
39 >>
40 >> Let's see how -mtune=native goes and resort to the above if necessary.
41 >> It doesn't look too bad though.
42 >
43 >
44 > emerge -e world has finished and pushed and -mtune=native seems to
45 > have solved the issue for now.
46 >
47
48 You might be interested in "-march=x86-64 -mtune=generic" though this
49 will mean you might miss out on some optimizations.

Replies

Subject Author
Re: [gentoo-user] Lowest common denominator compile Grant <emailgrant@×××××.com>