Gentoo Archives: gentoo-user

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

Replies

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