]> git.ipfire.org Git - thirdparty/gcc.git/commit
bpf: avoid issues with CO-RE and -gtoggle
authorDavid Faust <david.faust@oracle.com>
Thu, 25 Apr 2024 16:31:14 +0000 (09:31 -0700)
committerDavid Faust <david.faust@oracle.com>
Thu, 25 Apr 2024 18:18:17 +0000 (11:18 -0700)
commitf175622d25e4146bb7450430831ec48615e6e4cb
treedc701a5205345babf167afed3a7cf55b0ba5013f
parent14d48516e588ad2b35e2007b3970bdcb1b3f145c
bpf: avoid issues with CO-RE and -gtoggle

Compiling a BPF program with CO-RE relocations (and BTF) while also
passing -gtoggle led to an inconsistent state where CO-RE support was
enabled but BTF would not be generated, and this was not caught by the
existing option parsing.  This led to an ICE when generating the CO-RE
relocation info, since BTF is required for CO-RE.

Update bpf_option_override to avoid this case, and add a few tests for
the interactions of these options.

gcc/
* config/bpf/bpf.cc (bpf_option_override): Improve handling of CO-RE
options to avoid issues with -gtoggle.

gcc/testsuite/
* gcc.target/bpf/core-options-1.c: New test.
* gcc.target/bpf/core-options-2.c: Likewise.
* gcc.target/bpf/core-options-3.c: Likewise.
gcc/config/bpf/bpf.cc
gcc/testsuite/gcc.target/bpf/core-options-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/bpf/core-options-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/bpf/core-options-3.c [new file with mode: 0644]