From: Jose E. Marchesi Date: Tue, 17 Jan 2023 16:16:32 +0000 (+0100) Subject: bpf: disable -fstack-protector in BPF X-Git-Tag: basepoints/gcc-14~1977 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b81f5c4d8e0d79cbd6927d004185707c14e54b2;p=thirdparty%2Fgcc.git bpf: disable -fstack-protector in BPF 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. --- diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index 576a1fe8eabf..b268801d00c7 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