diff options
author | David Faust <david.faust@oracle.com> | 2024-06-10 10:59:05 -0700 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2024-07-02 10:16:13 -0700 |
commit | 189d0f1fc2cd2de1815ce5ead8ac87f3cba32010 (patch) | |
tree | 02a3ae321882ee94d77dbd4a9885314ea2ab73fd /gcc/doc | |
parent | b8977d928a7a261913dd89db55d4123b6a54ba46 (diff) | |
download | gcc-189d0f1fc2cd2de1815ce5ead8ac87f3cba32010.zip gcc-189d0f1fc2cd2de1815ce5ead8ac87f3cba32010.tar.gz gcc-189d0f1fc2cd2de1815ce5ead8ac87f3cba32010.tar.bz2 |
bpf,btf: enable BTF pruning by default for BPF
This patch enables -gprune-btf by default in the BPF backend when
generating BTF information, and fixes BPF CO-RE generation when using
-gprune-btf.
When generating BPF CO-RE information, we must ensure that types used
in CO-RE relocations always have sufficient BTF information emited so
that the CO-RE relocations can be processed by a BPF loader. The BTF
pruning algorithm on its own does not have sufficient information to
determine which types are used in a BPF CO-RE relocation, so this
information must be supplied by the BPF backend, using a new
btf_mark_type_used function.
Co-authored-by: Cupertino Miranda <cupertino.miranda@oracle.com>
gcc/
* btfout.cc (btf_mark_type_used): New.
* ctfc.h (btf_mark_type_used): Declare it here.
* config/bpf/bpf.cc (bpf_option_override): Enable -gprune-btf
by default if -gbtf is enabled.
* config/bpf/core-builtins.cc (extra_fn): New typedef.
(compute_field_expr): Add callback parameter, and call it if supplied.
Fix computation for MEM_REF.
(mark_component_type_as_used): New.
(bpf_mark_types_as_used): Likewise.
(bpf_expand_core_builtin): Call here.
* doc/invoke.texi (Debugging Options): Note that -gprune-btf is
enabled by default for BPF target when generating BTF.
gcc/testsuite/
* gcc.dg/debug/btf/btf-variables-5.c: Adjust one test for bpf-*-*
target.
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index f4eb4ae..68ebd79 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -12044,6 +12044,9 @@ It is primarily useful when compiling for the BPF target, to minimize the size of the resulting object, and to eliminate BTF information which is not immediately relevant to the BPF program loading process. +This option is enabled by default for the BPF target when generating +BTF information. + @opindex gctf @item -gctf @itemx -gctf@var{level} |