Gentoo Archives: gentoo-user

From: Fernando Rodriguez <frodriguez.developer@×××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code?
Date: Mon, 23 Mar 2015 01:26:29
Message-Id: 1570093.qMVvttJaZ4@navi
In Reply to: Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code? by Mike Gilbert
1 On Sunday, March 22, 2015 10:03:01 AM Mike Gilbert wrote:
2 > On Sat, Mar 21, 2015 at 3:52 PM, Fernando Rodriguez
3 > <frodriguez.developer@×××××××.com> wrote:
4 > > On Saturday, March 21, 2015 8:46:10 AM Mike Gilbert wrote:
5 > >> On Thu, Mar 19, 2015 at 12:20 AM, Walter Dnes <waltdnes@××××××××.org>
6 wrote:
7 > >> > CFLAGS="-O2 -march=atom -mno-cx16 -msahf -mmovbe -mno-aes -mno-pclmul -
8 > > mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-
9 bmi2 -
10 > > mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rtm -
11 mno-
12 > > hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -
13 mfxsr
14 > > -mno-xsave -mno-xsaveopt --param l1-cache-size=24 --param l1-cache-line-
15 > > size=64 --param l2-cache-size=512 -mtune=atom -fstack-protector -
16 mfpmath=sse -
17 > > fomit-frame-pointer -pipe -fno-unwind-tables -fno-asynchronous-unwind-
18 tables"
19 > >> >
20 > >> > Is that correct (assuming that's my output)?
21 > >> >
22 > >>
23 > >> I should warn you against including all of those -mno-xxx flags. This
24 > >> has been known to break the build process for packages like chromium,
25 > >> which always wants to build with SSE4 support and toggles it off at
26 > >> runtime. Passing -mno-sse4.1 causes a build failure as it tries to use
27 > >> macros that are not defined.
28 > >>
29 > >
30 > > Isn't it possible that removing it for all packages would cause a more
31 subtle
32 > > problem with another faulty ebuild (like a program crashing due to an
33 illegal
34 > > instruction)?
35 >
36 > Passing -march=atom should be sufficient to ensure that you don't get
37 > any illegal instructions. The -mno-XXX flags are redundant, and MOSTLY
38 > harmless.
39
40 You got me curious as to why they're there being redundant and I think I found
41 out why.
42
43 I looked at the code (gcc/config/i386/driver-i386.c) and there is a very slim
44 chance that the -march reported by gcc when using -march=native will not be
45 the most appropriate. In some cases it's guessed based on the features
46 reported by the CPU but on other cases it trusts the model number and Intel
47 lists several Atom server CPUs and SoCs with no extensions at all (I have no
48 idea what they report themselves like or if their specs are right). All the -
49 mxxx and -mno-xxx flags are determined by the features reported by the CPU so
50 no chance of error there (save from a CPU bug).
51
52 I guess gcc devs are careful when using the model numbers (Intel lists 3 for
53 Atoms, gcc uses only two so that may account for the models I mentioned) but
54 the chance of error is there. The -mno-xxx flags would safeguard against it.
55
56 --
57 Fernando Rodriguez

Replies

Subject Author
Re: [gentoo-user] Will a 64-bit-no-multilib machine cross-compile 32-bit code? Walter Dnes <waltdnes@××××××××.org>