[BPF][clang] Ignore stack protector options for BPF target
authorEduard Zingerman <eddyz87@gmail.com>
Fri, 20 Jan 2023 23:11:00 +0000 (15:11 -0800)
committerYonghong Song <yhs@fb.com>
Fri, 20 Jan 2023 23:12:43 +0000 (15:12 -0800)
commit56b038f887f37f69afac2d3abe02b46dcb9305ec
treecfbfdc57b1621d447642a88a720efd91cd298d43
parentc52f9485b0e68b38dfb1e4bacaea497c77c26372
[BPF][clang] Ignore stack protector options for BPF target

Stack protector builtin functions are not implemented for BPF target,
thus compiling programs with one of the following options would result
in an error:
  -fstack-protector
  -fstack-protector-all
  -fstack-protector-strong

This commit adds logic to ignore these options for BPF target.
Searching through DiagnosticDriverKinds.td shows that all messages for
such kind of behavior are implemented as warnings, this commit follows
the suit.

Here is an example of the diagnostic message:
  clang-16: warning: ignoring '-fstack-protector' option as it is not currently supported for target 'bpf' [-Woption-ignored]

Differential Revision: https://reviews.llvm.org/D142046
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/bpf-stack-protector.c [new file with mode: 0644]