* [COMMITTED] bpf: disable -fstack-protector in BPF
@ 2023-01-17 16:25 Jose E. Marchesi
2023-01-28 14:12 ` Jan-Benedict Glaw
0 siblings, 1 reply; 4+ messages in thread
From: Jose E. Marchesi @ 2023-01-17 16:25 UTC (permalink / raw)
To: gcc-patches
The stack protector is not supported in BPF. This patch disables
-fstack-protector in bpf-* targets, along with the emission of a note
indicating that the feature is not supported in this platform.
Regtested in bpf-unknown-none.
gcc/ChangeLog:
* config/bpf/bpf.cc (bpf_option_override): Disable
-fstack-protector.
---
gcc/config/bpf/bpf.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc
index 576a1fe8eab..b268801d00c 100644
--- a/gcc/config/bpf/bpf.cc
+++ b/gcc/config/bpf/bpf.cc
@@ -253,6 +253,14 @@ bpf_option_override (void)
if (bpf_has_jmp32 == -1)
bpf_has_jmp32 = (bpf_isa >= ISA_V3);
+ /* Disable -fstack-protector as it is not supported in BPF. */
+ if (flag_stack_protect)
+ {
+ inform (input_location,
+ "%<-fstack-protector%> does not work "
+ " on this architecture");
+ flag_stack_protect = 0;
+ }
}
#undef TARGET_OPTION_OVERRIDE
--
2.30.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [COMMITTED] bpf: disable -fstack-protector in BPF
2023-01-17 16:25 [COMMITTED] bpf: disable -fstack-protector in BPF Jose E. Marchesi
@ 2023-01-28 14:12 ` Jan-Benedict Glaw
2023-02-15 10:02 ` [patch] bpf: Fix double whitespace warning Jan-Benedict Glaw
0 siblings, 1 reply; 4+ messages in thread
From: Jan-Benedict Glaw @ 2023-01-28 14:12 UTC (permalink / raw)
To: Jose E. Marchesi; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1696 bytes --]
On Tue, 2023-01-17 17:25:08 +0100, Jose E. Marchesi via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> The stack protector is not supported in BPF. This patch disables
> -fstack-protector in bpf-* targets, along with the emission of a note
> indicating that the feature is not supported in this platform.
[...]
> diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc
> index 576a1fe8eab..b268801d00c 100644
> --- a/gcc/config/bpf/bpf.cc
> +++ b/gcc/config/bpf/bpf.cc
> @@ -253,6 +253,14 @@ bpf_option_override (void)
> if (bpf_has_jmp32 == -1)
> bpf_has_jmp32 = (bpf_isa >= ISA_V3);
>
> + /* Disable -fstack-protector as it is not supported in BPF. */
> + if (flag_stack_protect)
> + {
> + inform (input_location,
> + "%<-fstack-protector%> does not work "
> + " on this architecture");
> + flag_stack_protect = 0;
> + }
Building with a recent GCC with (noticed during a -Werror build), this
results in a new warning:
[all 2023-01-27 16:26:25] ../../gcc/gcc/config/bpf/bpf.cc: In function 'void bpf_option_override()':
[all 2023-01-27 16:26:25] ../../gcc/gcc/config/bpf/bpf.cc:260:51: error: unquoted sequence of 2 consecutive space characters in format [-Werror=format-diag]
[all 2023-01-27 16:26:25] 260 | "%<-fstack-protector%> does not work "
[all 2023-01-27 16:26:25] | ^~
[all 2023-01-27 16:26:25] 261 | " on this architecture");
[all 2023-01-27 16:26:25] | ~~
[all 2023-01-27 16:26:27] cc1plus: all warnings being treated as errors
MfG, JBG
--
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch] bpf: Fix double whitespace warning
2023-01-28 14:12 ` Jan-Benedict Glaw
@ 2023-02-15 10:02 ` Jan-Benedict Glaw
2023-02-15 10:49 ` Jose E. Marchesi
0 siblings, 1 reply; 4+ messages in thread
From: Jan-Benedict Glaw @ 2023-02-15 10:02 UTC (permalink / raw)
To: Jose E. Marchesi; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
Hi!
Since a recent commit, the BPF target produces a new warning due to
two consecutive non-quoted spaces in a message. This'll fix it:
gcc/
* config/bpf/bpf.cc (bpf_option_override): Fix doubled space.
Ok?
MfG, JBG
diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc
index b268801d00c..d8693f8cfbe 100644
--- a/gcc/config/bpf/bpf.cc
+++ b/gcc/config/bpf/bpf.cc
@@ -258,7 +258,7 @@ bpf_option_override (void)
{
inform (input_location,
"%<-fstack-protector%> does not work "
- " on this architecture");
+ "on this architecture");
flag_stack_protect = 0;
}
}
--
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] bpf: Fix double whitespace warning
2023-02-15 10:02 ` [patch] bpf: Fix double whitespace warning Jan-Benedict Glaw
@ 2023-02-15 10:49 ` Jose E. Marchesi
0 siblings, 0 replies; 4+ messages in thread
From: Jose E. Marchesi @ 2023-02-15 10:49 UTC (permalink / raw)
To: Jan-Benedict Glaw; +Cc: gcc-patches
> Hi!
>
> Since a recent commit, the BPF target produces a new warning due to
> two consecutive non-quoted spaces in a message. This'll fix it:
>
> gcc/
> * config/bpf/bpf.cc (bpf_option_override): Fix doubled space.
>
>
> Ok?
OK. Thanks for the patch.
(Sorry I didn't fix this when you first reported it. My TODO list is
long atm :/)
> MfG, JBG
>
> diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc
> index b268801d00c..d8693f8cfbe 100644
> --- a/gcc/config/bpf/bpf.cc
> +++ b/gcc/config/bpf/bpf.cc
> @@ -258,7 +258,7 @@ bpf_option_override (void)
> {
> inform (input_location,
> "%<-fstack-protector%> does not work "
> - " on this architecture");
> + "on this architecture");
> flag_stack_protect = 0;
> }
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-15 10:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 16:25 [COMMITTED] bpf: disable -fstack-protector in BPF Jose E. Marchesi
2023-01-28 14:12 ` Jan-Benedict Glaw
2023-02-15 10:02 ` [patch] bpf: Fix double whitespace warning Jan-Benedict Glaw
2023-02-15 10:49 ` Jose E. Marchesi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).