]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Accommodate DWARF/compiler bug with duplicated structs
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 17 Nov 2021 19:41:13 +0000 (11:41 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 19 Nov 2021 15:59:16 +0000 (16:59 +0100)
commitc8848e138548b397603867fc9224e82650dbf01e
tree5d52ee72104bf80f3d4125983ee191216936940f
parent5ab57dd0e76d27537b8f725c720ceb1ef47dbec9
libbpf: Accommodate DWARF/compiler bug with duplicated structs

According to [0], compilers sometimes might produce duplicate DWARF
definitions for exactly the same struct/union within the same
compilation unit (CU). We've had similar issues with identical arrays
and handled them with a similar workaround in b4f11c1bed4c ("libbpf:
Accomodate DWARF/compiler bug with duplicated identical arrays"). Do the
same for struct/union by ensuring that two structs/unions are exactly
the same, down to the integer values of field referenced type IDs.

Solving this more generically (allowing referenced types to be
equivalent, but using different type IDs, all within a single CU)
requires a huge complexity increase to handle many-to-many mappings
between canonidal and candidate type graphs. Before we invest in that,
let's see if this approach handles all the instances of this issue in
practice. Thankfully it's pretty rare, it seems.

  [0] https://lore.kernel.org/bpf/YXr2NFlJTAhHdZqq@krava/

Reported-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211117194114.347675-1-andrii@kernel.org
tools/lib/bpf/btf.c