[PATCH] D143967: [DebugInfo][BPF] Add 'btf:type_tag' annotation in DWARF

Eduard Zingerman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 15 10:34:46 PDT 2023


eddyz87 added a comment.

In D143967#4197041 <https://reviews.llvm.org/D143967#4197041>, @dfaust wrote:

> The way I see it both 'volatile' and the type tag are modifying 'int' type here, so the annotation DIE more properly fits as a child of 'int' rather than the 'volatile'.
>
> I don't think we discussed this particular case, and I'm not sure whether there is any precedent here.
>
> WDYT @eddyz87, @jemarch ?

This is related to my previous comment. Kernel BTF parser wants all type tags to precede modifiers (see this <https://elixir.bootlin.com/linux/latest/source/kernel/bpf/btf.c#L5348> code). So such reordering will have to happen either during DWARF generation or by `pahole`. Currently `pahole` is "dumb" in a sense that it reflects DWARF structure in BTF effectively one-to-one. Adding such rewrite at a `pahole` level is possible but one-to-one mapping to DWARF would be lost, so the tool would require significant changes.

So, at least for LLVM its a tradeoff, either do it in the compiler (less code), or in the pahole (more code). I opted for less code :) If you think that this is conceptually unacceptable, I'll do the change on the pahole side (DI maintainers on LLVM side might agree, the patch has not been reviewed yet).

Another option would be to modify the kernel, but this might impede backwards compatibility.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143967/new/

https://reviews.llvm.org/D143967



More information about the cfe-commits mailing list