[llvm] BPF: Use DebugLoc to find Filename for BTF line info (PR #90302)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 27 11:16:39 PDT 2024


yonghong-song wrote:

I am not able to use your print_btf.py script as in my environment, I do not have 'lief' module and I do not know how to install it. Then I directly use compiler to generate ".s" file to make it easy to compare.
The command line:
```
clang  -g -Wall -Werror -D__TARGET_ARCH_x86 -mlittle-endian -I/home/yhs/work/bpf-next/tools/testing/selftests/bpf/tools/include -I/home/yhs/work/bpf-next/tools/testing/selftests/bpf -I/home/yhs/work/bpf-next/tools/include/uapi -I/home/yhs/work/bpf-next/tools/testing/selftests/usr/include -Wno-compare-distinct-pointer-types -idirafter /home/yhs/work/yhs/llvm-project/llvm/build/install/lib/clang/19/include -idirafter /usr/local/include -idirafter /usr/include   -DENABLE_ATOMICS_TESTS  -O2 --target=bpf -S progs/percpu_alloc_array.c -mcpu=v3 -o /home/yhs/work/bpf-next/tools/testing/selftests/bpf/percpu_alloc_array.bpf.o.s
```
With the current 'main' branch, we have
```
        .long   .Ltmp253
        .long   140
        .long   0
        .long   0                               # Line 0 Col 0
```
With this patch, there is no 'Line 0 Col 0' entry.

https://github.com/llvm/llvm-project/pull/90302


More information about the llvm-commits mailing list