diff options
author | Cupertino Miranda <cupertino.miranda@oracle.com> | 2024-01-30 15:55:18 +0000 |
---|---|---|
committer | Cupertino Miranda <cupertino.miranda@oracle.com> | 2024-03-20 20:27:15 +0000 |
commit | 8e913b5c0c998b2ae9497a6ff6bdf475c136cd97 (patch) | |
tree | 53b60087029ad83faf99394f910d6b47064360c5 /gcc/analyzer | |
parent | 806621dc14f893476dd6f2a9ae5cf773f3b0951b (diff) | |
download | gcc-8e913b5c0c998b2ae9497a6ff6bdf475c136cd97.zip gcc-8e913b5c0c998b2ae9497a6ff6bdf475c136cd97.tar.gz gcc-8e913b5c0c998b2ae9497a6ff6bdf475c136cd97.tar.bz2 |
bpf: Fix CO-RE field expression builtins
This patch corrects bugs within the CO-RE builtin field expression
related builtins.
The following bugs were identified and corrected based on the expected
results of bpf-next selftests testsuite.
It addresses the following problems:
- Expressions with pointer dereferencing now point to the BTF structure
type, instead of the structure pointer type.
- Pointer addition to structure root is now identified and constructed
in CO-RE relocations as if it is an array access. For example,
"&(s+2)->b" generates "2:1" as an access string where "2" is
refering to the access for "s+2".
gcc/ChangeLog:
* config/bpf/core-builtins.cc (core_field_info): Add
support for POINTER_PLUS_EXPR in the root of the field expression.
(bpf_core_get_index): Likewise.
(pack_field_expr): Make the BTF type to point to the structure
related node, instead of its pointer type.
(make_core_safe_access_index): Correct to new code.
gcc/testsuite/ChangeLog:
* gcc.target/bpf/core-attr-5.c: Correct.
* gcc.target/bpf/core-attr-6.c: Likewise.
* gcc.target/bpf/core-attr-struct-as-array.c: Add test case for
pointer arithmetics as array access use case.
Diffstat (limited to 'gcc/analyzer')
0 files changed, 0 insertions, 0 deletions