Gentoo Archives: gentoo-dev

From: Sam James <sam@g.o>
To: gentoo-dev@l.g.o
Cc: toolchain@g.o, Arfrever Frehtes Taifersar Arahesis <Arfrever@××××××.Org>, Sam James <sam@g.o>
Subject: [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns.
Date: Tue, 18 Jan 2022 18:24:31
Message-Id: 20220118182412.1127220-1-sam@gentoo.org
1 From: Arfrever Frehtes Taifersar Arahesis <Arfrever@××××××.Org>
2
3 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@××××××.Org>
4 Signed-off-by: Sam James <sam@g.o>
5 ---
6 eclass/flag-o-matic.eclass | 23 +++++++++++------------
7 1 file changed, 11 insertions(+), 12 deletions(-)
8
9 diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
10 index 32119cb9a526f..f8181a17e911a 100644
11 --- a/eclass/flag-o-matic.eclass
12 +++ b/eclass/flag-o-matic.eclass
13 @@ -1,4 +1,4 @@
14 -# Copyright 1999-2021 Gentoo Authors
15 +# Copyright 1999-2022 Gentoo Authors
16 # Distributed under the terms of the GNU General Public License v2
17
18 # @ECLASS: flag-o-matic.eclass
19 @@ -48,7 +48,7 @@ setup-allowed-flags() {
20 # Note: shell globs and character lists are allowed
21 _setup-allowed-flags() {
22 ALLOWED_FLAGS=(
23 - -pipe -O '-O[12sg]' -mcpu -march -mtune
24 + -pipe -O '-O[12sg]' '-mcpu=*' '-march=*' '-mtune=*'
25 '-fstack-protector*'
26 '-fsanitize*' '-fno-sanitize*'
27 '-fstack-check*' -fno-stack-check
28 @@ -70,7 +70,7 @@ _setup-allowed-flags() {
29 '-[DUILR]*' '-Wl,*'
30
31 # Linker choice flag
32 - '-fuse-ld'
33 + '-fuse-ld=*'
34 )
35
36 # allow a bunch of flags that negate features / control ABI
37 @@ -80,19 +80,19 @@ _setup-allowed-flags() {
38 -fno-omit-frame-pointer '-fno-builtin*'
39 )
40 ALLOWED_FLAGS+=(
41 - -mregparm -mno-app-regs -mapp-regs -mno-mmx -mno-sse
42 + '-mregparm=*' -mno-app-regs -mapp-regs -mno-mmx -mno-sse
43 -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2
44 -mno-avx -mno-aes -mno-pclmul -mno-sse4a -mno-3dnow -mno-popcnt
45 -mno-abm -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -mplt
46 - -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu
47 - -mieee -mieee-with-inexact -mschedule -mfloat-gprs -mspe -mno-spe
48 + -msoft-float -mno-soft-float -mhard-float -mno-hard-float '-mfpu=*'
49 + -mieee -mieee-with-inexact '-mschedule=*' -mfloat-gprs -mspe -mno-spe
50 -mtls-direct-seg-refs -mno-tls-direct-seg-refs -mflat -mno-flat
51 - -mno-faster-structs -mfaster-structs -m32 -m64 -mx32 -mabi
52 - -mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 -mcmodel
53 - -mstack-bias -mno-stack-bias -msecure-plt '-m*-toc' -mfloat-abi
54 + -mno-faster-structs -mfaster-structs -m32 -m64 -mx32 '-mabi=*'
55 + -mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 '-mcmodel=*'
56 + -mstack-bias -mno-stack-bias -msecure-plt '-m*-toc' '-mfloat-abi=*'
57 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
58 -mfix-rm7000 -mno-fix-rm7000 -mfix-r10000 -mno-fix-r10000
59 - -mr10k-cache-barrier -mthumb -marm
60 + '-mr10k-cache-barrier=*' -mthumb -marm
61
62 # gcc 4.5
63 -mno-fma4 -mno-movbe -mno-xop -mno-lwp
64 @@ -452,9 +452,8 @@ strip-flags() {
65 local new=()
66
67 for x in ${!var} ; do
68 - local flag=${x%%=*}
69 for y in "${ALLOWED_FLAGS[@]}" ; do
70 - if [[ -z ${flag%%${y}} ]] ; then
71 + if [[ ${x} == ${y} ]] ; then
72 new+=( "${x}" )
73 break
74 fi
75 --
76 2.34.1

Replies