]> git.ipfire.org Git - thirdparty/gcc.git/commit
bpf: remove huge memory waste with string allocation.
authorCupertino Miranda <cupertino.miranda@oracle.com>
Tue, 2 Apr 2024 11:04:28 +0000 (12:04 +0100)
committerCupertino Miranda <cupertino.miranda@oracle.com>
Fri, 19 Apr 2024 10:09:35 +0000 (11:09 +0100)
commitede01dfd9dd85e03dea30402e773c62f0408adbe
treeed765bc9ec3034a01069cf4548e11d2b0e22c955
parentd7190d0b9a8e395f46b475e4d525f2b6a0ce4df4
bpf: remove huge memory waste with string allocation.

The BPF backend was allocating an unnecessarily large string when
constructing CO-RE relocations for enum types.
This patch also verifies that those enumerators are valid for CO-RE,
returning an error otherwise.

gcc/ChangeLog:
* config/bpf/core-builtins.cc (get_index_for_enum_value): Create
function.
(pack_enum_value): Check for enumerator and error out.
(process_enum_value): Correct string allocation.
gcc/config/bpf/core-builtins.cc