]> git.ipfire.org Git - thirdparty/gcc.git/commit
bpf: BPF CO-RE support
authorDavid Faust <david.faust@oracle.com>
Tue, 3 Aug 2021 17:27:44 +0000 (10:27 -0700)
committerDavid Faust <david.faust@oracle.com>
Tue, 7 Sep 2021 20:48:58 +0000 (13:48 -0700)
commit8bdabb37549f12ce727800a1c8aa182c0b1dd42a
tree6c04e6ec8a3e394c1d2928b43189d61ae7254ef7
parent0a2bd52f1a903060a7b305b429aa71fb68995bb7
bpf: BPF CO-RE support

This commit introduces support for BPF Compile Once - Run
Everywhere (CO-RE) in GCC.

gcc/ChangeLog:

* config/bpf/bpf.c: Adjust includes.
(bpf_handle_preserve_access_index_attribute): New function.
(bpf_attribute_table): Use it here.
(bpf_builtins): Add BPF_BUILTIN_PRESERVE_ACCESS_INDEX.
(bpf_option_override): Handle "-mco-re" option.
(bpf_asm_init_sections): New.
(TARGET_ASM_INIT_SECTIONS): Redefine.
(bpf_file_end): New.
(TARGET_ASM_FILE_END): Redefine.
(bpf_init_builtins): Add "__builtin_preserve_access_index".
(bpf_core_compute, bpf_core_get_index): New.
(is_attr_preserve_access): New.
(bpf_expand_builtin): Handle new builtins.
(bpf_core_newdecl, bpf_core_is_maybe_aggregate_access): New.
(bpf_core_walk): New.
(bpf_resolve_overloaded_builtin): New.
(TARGET_RESOLVE_OVERLOADED_BUILTIN): Redefine.
(handle_attr): New.
(pass_bpf_core_attr): New RTL pass.
* config/bpf/bpf-passes.def: New file.
* config/bpf/bpf-protos.h (make_pass_bpf_core_attr): New.
* config/bpf/coreout.c: New file.
* config/bpf/coreout.h: Likewise.
* config/bpf/t-bpf (TM_H): Add $(srcdir)/config/bpf/coreout.h.
(coreout.o): New rule.
(PASSES_EXTRA): Add $(srcdir)/config/bpf/bpf-passes.def.
* config.gcc (bpf): Add coreout.h to extra_headers.
Add coreout.o to extra_objs.
Add $(srcdir)/config/bpf/coreout.c to target_gtfiles.
gcc/config.gcc
gcc/config/bpf/bpf-passes.def [new file with mode: 0644]
gcc/config/bpf/bpf-protos.h
gcc/config/bpf/bpf.c
gcc/config/bpf/coreout.c [new file with mode: 0644]
gcc/config/bpf/coreout.h [new file with mode: 0644]
gcc/config/bpf/t-bpf