public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns.
@ 2022-01-18 18:24 Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 2/8] flag-o-matic.eclass: allow -fno-diagnostics-color -fmessage-length=0 Sam James
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Sam James @ 2022-01-18 18:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain, Arfrever Frehtes Taifersar Arahesis, Sam James

From: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/flag-o-matic.eclass | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 32119cb9a526f..f8181a17e911a 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: flag-o-matic.eclass
@@ -48,7 +48,7 @@ setup-allowed-flags() {
 # Note: shell globs and character lists are allowed
 _setup-allowed-flags() {
 	ALLOWED_FLAGS=(
-		-pipe -O '-O[12sg]' -mcpu -march -mtune
+		-pipe -O '-O[12sg]' '-mcpu=*' '-march=*' '-mtune=*'
 		'-fstack-protector*'
 		'-fsanitize*' '-fno-sanitize*'
 		'-fstack-check*' -fno-stack-check
@@ -70,7 +70,7 @@ _setup-allowed-flags() {
 		'-[DUILR]*' '-Wl,*'
 
 		# Linker choice flag
-		'-fuse-ld'
+		'-fuse-ld=*'
 	)
 
 	# allow a bunch of flags that negate features / control ABI
@@ -80,19 +80,19 @@ _setup-allowed-flags() {
 		-fno-omit-frame-pointer '-fno-builtin*'
 	)
 	ALLOWED_FLAGS+=(
-		-mregparm -mno-app-regs -mapp-regs -mno-mmx -mno-sse
+		'-mregparm=*' -mno-app-regs -mapp-regs -mno-mmx -mno-sse
 		-mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2
 		-mno-avx -mno-aes -mno-pclmul -mno-sse4a -mno-3dnow -mno-popcnt
 		-mno-abm -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -mplt
-		-msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu
-		-mieee -mieee-with-inexact -mschedule -mfloat-gprs -mspe -mno-spe
+		-msoft-float -mno-soft-float -mhard-float -mno-hard-float '-mfpu=*'
+		-mieee -mieee-with-inexact '-mschedule=*' -mfloat-gprs -mspe -mno-spe
 		-mtls-direct-seg-refs -mno-tls-direct-seg-refs -mflat -mno-flat
-		-mno-faster-structs -mfaster-structs -m32 -m64 -mx32 -mabi
-		-mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 -mcmodel
-		-mstack-bias -mno-stack-bias -msecure-plt '-m*-toc' -mfloat-abi
+		-mno-faster-structs -mfaster-structs -m32 -m64 -mx32 '-mabi=*'
+		-mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 '-mcmodel=*'
+		-mstack-bias -mno-stack-bias -msecure-plt '-m*-toc' '-mfloat-abi=*'
 		-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
 		-mfix-rm7000 -mno-fix-rm7000 -mfix-r10000 -mno-fix-r10000
-		-mr10k-cache-barrier -mthumb -marm
+		'-mr10k-cache-barrier=*' -mthumb -marm
 
 		# gcc 4.5
 		-mno-fma4 -mno-movbe -mno-xop -mno-lwp
@@ -452,9 +452,8 @@ strip-flags() {
 		local new=()
 
 		for x in ${!var} ; do
-			local flag=${x%%=*}
 			for y in "${ALLOWED_FLAGS[@]}" ; do
-				if [[ -z ${flag%%${y}} ]] ; then
+				if [[ ${x} == ${y} ]] ; then
 					new+=( "${x}" )
 					break
 				fi
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 2/8] flag-o-matic.eclass: allow -fno-diagnostics-color -fmessage-length=0
  2022-01-18 18:24 [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns Sam James
@ 2022-01-18 18:24 ` Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 3/8] flag-o-matic.eclass: restructure comments a bit Sam James
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-01-18 18:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain, Sam James, Agostino Sarubbo

Both of these options are useful for automated reports and should
be harmless.

Closes: https://bugs.gentoo.org/830534
Reported-by: Agostino Sarubbo <ago@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/flag-o-matic.eclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index f8181a17e911a..38ad14d8f5fe8 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -62,6 +62,8 @@ _setup-allowed-flags() {
 		-gstabs -gstabs+
 		-gz
 
+		# Cosmetic/output related, see e.g. bug #830534
+		-fno-diagnostics-color '-fmessage-length=*'
 		-fno-ident -fpermissive -frecord-gcc-switches
 		'-fdiagnostics*' '-fplugin*'
 		'-W*' -w
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 3/8] flag-o-matic.eclass: restructure comments a bit
  2022-01-18 18:24 [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 2/8] flag-o-matic.eclass: allow -fno-diagnostics-color -fmessage-length=0 Sam James
@ 2022-01-18 18:24 ` Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 4/8] flag-o-matic.eclass: allow Spectre mitigation flags Sam James
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-01-18 18:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain, Sam James

No functional change.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/flag-o-matic.eclass | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 38ad14d8f5fe8..37577209281a1 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -49,13 +49,20 @@ setup-allowed-flags() {
 _setup-allowed-flags() {
 	ALLOWED_FLAGS=(
 		-pipe -O '-O[12sg]' '-mcpu=*' '-march=*' '-mtune=*'
+
+		# Hardening flags
 		'-fstack-protector*'
-		'-fsanitize*' '-fno-sanitize*'
 		'-fstack-check*' -fno-stack-check
-		-fbounds-check -fbounds-checking -fno-strict-overflow
-		-fno-PIE -fno-pie -nopie -no-pie -fno-unit-at-a-time
+		-fbounds-check -fbounds-checking
+		-fno-PIE -fno-pie -nopie -no-pie
+
+		# Misc
+		-fno-unit-at-a-time -fno-strict-overflow
+
+		# Sanitizers
+		'-fsanitize*' '-fno-sanitize*'
 
-		# debugging symbols should generally be very safe to add
+		# Debugging symbols should generally be very safe to add
 		-g '-g[0-9]'
 		-ggdb '-ggdb[0-9]'
 		-gdwarf '-gdwarf-*'
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 4/8] flag-o-matic.eclass: allow Spectre mitigation flags
  2022-01-18 18:24 [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 2/8] flag-o-matic.eclass: allow -fno-diagnostics-color -fmessage-length=0 Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 3/8] flag-o-matic.eclass: restructure comments a bit Sam James
@ 2022-01-18 18:24 ` Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 5/8] flag-o-matic.eclass: allow -glldb Sam James
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-01-18 18:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain, Sam James

Closes: https://bugs.gentoo.org/646076
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/flag-o-matic.eclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 37577209281a1..d6590a2e52dfd 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -55,6 +55,11 @@ _setup-allowed-flags() {
 		'-fstack-check*' -fno-stack-check
 		-fbounds-check -fbounds-checking
 		-fno-PIE -fno-pie -nopie -no-pie
+		# Spectre mitigations, bug #646076
+		'-mindirect-branch=*'
+		-mindirect-branch-register
+		'-mfunction-return=*'
+		-mretpoline
 
 		# Misc
 		-fno-unit-at-a-time -fno-strict-overflow
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 5/8] flag-o-matic.eclass: allow -glldb
  2022-01-18 18:24 [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns Sam James
                   ` (2 preceding siblings ...)
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 4/8] flag-o-matic.eclass: allow Spectre mitigation flags Sam James
@ 2022-01-18 18:24 ` Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 6/8] flag-o-matic.eclass: allow -ffixed-x18 for arm64 Sam James
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-01-18 18:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain, Sam James, Jannik Glückert

We already allow -ggdb for GDB and this is the analogue for LLDB.

Bug: https://bugs.gentoo.org/800533
Reported-by: Jannik Glückert <jannik.glueckert@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/flag-o-matic.eclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index d6590a2e52dfd..a2e37b89b6f08 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -73,6 +73,7 @@ _setup-allowed-flags() {
 		-gdwarf '-gdwarf-*'
 		-gstabs -gstabs+
 		-gz
+		-glldb
 
 		# Cosmetic/output related, see e.g. bug #830534
 		-fno-diagnostics-color '-fmessage-length=*'
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 6/8] flag-o-matic.eclass: allow -ffixed-x18 for arm64
  2022-01-18 18:24 [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns Sam James
                   ` (3 preceding siblings ...)
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 5/8] flag-o-matic.eclass: allow -glldb Sam James
@ 2022-01-18 18:24 ` Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 7/8] flag-o-matic.eclass: allow -fstack-clash-protection, -fcf-protection=* Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 8/8] flag-o-matic.eclass: allow -frecord-command-line Sam James
  6 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-01-18 18:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain, Sam James

Needed for shadow stack bits on ARM64.

Closes: https://bugs.gentoo.org/800533
Thanks-to: Jannik Glückert <jannik.glueckert@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/flag-o-matic.eclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index a2e37b89b6f08..7ac4f4a7791d1 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -109,6 +109,9 @@ _setup-allowed-flags() {
 		-mfix-rm7000 -mno-fix-rm7000 -mfix-r10000 -mno-fix-r10000
 		'-mr10k-cache-barrier=*' -mthumb -marm
 
+		# needed for arm64 (and in particular SCS)
+		-ffixed-x18
+
 		# gcc 4.5
 		-mno-fma4 -mno-movbe -mno-xop -mno-lwp
 		# gcc 4.6
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 7/8] flag-o-matic.eclass: allow -fstack-clash-protection, -fcf-protection=*
  2022-01-18 18:24 [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns Sam James
                   ` (4 preceding siblings ...)
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 6/8] flag-o-matic.eclass: allow -ffixed-x18 for arm64 Sam James
@ 2022-01-18 18:24 ` Sam James
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 8/8] flag-o-matic.eclass: allow -frecord-command-line Sam James
  6 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-01-18 18:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain, Sam James, Arfrever Frehtes Taifersar Arahesis

-fstack-clash-protection suggested by Arfrever.

Reported-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/flag-o-matic.eclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 7ac4f4a7791d1..062bd04e2e0bd 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -53,6 +53,8 @@ _setup-allowed-flags() {
 		# Hardening flags
 		'-fstack-protector*'
 		'-fstack-check*' -fno-stack-check
+		-fstack-clash-protection
+		'-fcf-protection=*'
 		-fbounds-check -fbounds-checking
 		-fno-PIE -fno-pie -nopie -no-pie
 		# Spectre mitigations, bug #646076
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 8/8] flag-o-matic.eclass: allow -frecord-command-line
  2022-01-18 18:24 [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns Sam James
                   ` (5 preceding siblings ...)
  2022-01-18 18:24 ` [gentoo-dev] [PATCH 7/8] flag-o-matic.eclass: allow -fstack-clash-protection, -fcf-protection=* Sam James
@ 2022-01-18 18:24 ` Sam James
  6 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-01-18 18:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain, Sam James

In Clang, -frecord-gcc-switches does the same as this anyway.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/flag-o-matic.eclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 062bd04e2e0bd..50caa401bacfb 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -80,6 +80,7 @@ _setup-allowed-flags() {
 		# Cosmetic/output related, see e.g. bug #830534
 		-fno-diagnostics-color '-fmessage-length=*'
 		-fno-ident -fpermissive -frecord-gcc-switches
+		-frecord-command-line
 		'-fdiagnostics*' '-fplugin*'
 		'-W*' -w
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-18 18:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-18 18:24 [gentoo-dev] [PATCH 1/8] flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns Sam James
2022-01-18 18:24 ` [gentoo-dev] [PATCH 2/8] flag-o-matic.eclass: allow -fno-diagnostics-color -fmessage-length=0 Sam James
2022-01-18 18:24 ` [gentoo-dev] [PATCH 3/8] flag-o-matic.eclass: restructure comments a bit Sam James
2022-01-18 18:24 ` [gentoo-dev] [PATCH 4/8] flag-o-matic.eclass: allow Spectre mitigation flags Sam James
2022-01-18 18:24 ` [gentoo-dev] [PATCH 5/8] flag-o-matic.eclass: allow -glldb Sam James
2022-01-18 18:24 ` [gentoo-dev] [PATCH 6/8] flag-o-matic.eclass: allow -ffixed-x18 for arm64 Sam James
2022-01-18 18:24 ` [gentoo-dev] [PATCH 7/8] flag-o-matic.eclass: allow -fstack-clash-protection, -fcf-protection=* Sam James
2022-01-18 18:24 ` [gentoo-dev] [PATCH 8/8] flag-o-matic.eclass: allow -frecord-command-line Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox