Latest upstream LLVM now supports to emit btf_tag to dwarf ([1]) and the
kernel support for btf_tag is also landed ([2]). Sync with latest libbpf
which has btf_tag support. Next step will be to implement dwarf -> btf
conversion for btf_tag.
[1] https://reviews.llvm.org/D106621
[2] https://lore.kernel.org/bpf/20210914223015.245546-1-yhs@fb.com
Signed-off-by: Yonghong Song <yhs@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
Cc: kernel-team@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
ostra-cg, which requires python, is installed in the destination dir.
Make it optional for embedded distributions which doesn't have the
python interpreter available.
Signed-off-by: Matteo Croce <mcroce@microsoft.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Useful while developing to help in tuning the ptr tables (types, tags,
functions, maybe some more in the future).
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
When using multithreaded DWARF loading we can't really freely access
some tables, as they may grow and lead to stale data accesses generating
segfaults.
So use a type comparision that takes into account just the immutable
information for structs, unions.
This isn't enough to discern if two types with the same name are really
the same, as we need to look at the member types to figure that out.
So if there are types for which member types need to be checked, leave
it for when all CUs were processed and are thus completely immutable to
resort and fully compare such types.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
The main musl libc, used in Alpine Linux, doesn't have argp support, so
check if it is somewhere else, maybe in the musl-obstack package.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
The musl libc, used in Alpine Linux, doesn't have argp support, so check
if it is somewhere else, maybe in the argp-standalone package.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Systems such as Alpine Linux don't have support for obtaining _SC_LEVEL1_DCACHE_LINESIZE
via sysconf(), provide altenative method reading it from sysfs.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
By doing the tarball using the parent directory ('pahole') and then
replacing ^pahole/ with dwarves-${version} we avoid tar replacing the
symlink destination, i.e. before we were getting:
$ ls -la dwarves-1.22/lib/include/
total 8
drwxr-xr-x. 2 acme acme 4096 Aug 12 15:54 .
drwxr-xr-x. 4 acme acme 4096 Aug 12 15:54 ..
lrwxrwxrwx. 1 acme acme 23 Jun 18 17:56 bpf -> dwarves-1.22/../bpf/src
$
Now we get:
$ v=1.$(($(git tag | sort -V | tail -1 | cut -d. -f2) + 1)) ; tar cvfJ ~/rpmbuild/SOURCES/dwarves-${v}.tar.xz --transform "s,^pahole/,dwarves-${v}/," `sed s%^%../pahole/%g MANIFEST`
$ tar tvf ~/rpmbuild/SOURCES/dwarves-1.22.tar.xz | tail -3
-rwxr-xr-x acme/acme 1132 2021-06-14 15:51 dwarves-1.22/lib/bpf/travis-ci/vmtest/run_vmtest.sh
-rw-r--r-- acme/acme 2904227 2021-06-14 15:51 dwarves-1.22/lib/bpf/travis-ci/vmtest/vmlinux.h
lrwxrwxrwx acme/acme 0 2021-08-11 08:55 dwarves-1.22/lib/include/bpf -> ../bpf/src
$
And building from the resulting tarball succeeds.
See the references in the threads and bug reportgs in the Link tags
below for more details.
Link: https://lore.kernel.org/dwarves/YRVxNEPEspmuHcKr@kernel.org/
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775247
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
The tarball wasn't working without this file:
[ 32%] Building C object CMakeFiles/dwarves.dir/btf_encoder.c.o
/tmp/dwarves-1.22/btf_encoder.c:18:10: fatal error: bpf/btf.h: No such file or directory
#include <bpf/btf.h>
^~~~~~~~~~~
compilation terminated.
Cc: Luca Boccassi <bluca@debian.org>
Fixes: 82756ea3ea ("libbpf: Fixup patch to allow to use packaged version")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
It should have been removed from the specfile when it was deleted from
the source tree, fix it.
Fixes: 743f2536d8 ("btf_encoder: Move libbtf.c to btf_encoder.c, the only user of its functions")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
But this still doesn't cover all types in the kernel, at least not for
btfdiff's needs, which is to have the output of pahole for BTF and DWARF
to be the same, so if we have two types that are ABI equal, it will
still complain if...
$ btfdiff vmlinux
--- /tmp/btfdiff.dwarf.VUXlsB 2021-08-06 18:11:51.371012024 -0300
+++ /tmp/btfdiff.btf.CeZ7hA 2021-08-06 18:11:51.604017029 -0300
@@ -48226,8 +48226,8 @@ struct intel_ir_data {
/* last cacheline: 56 bytes */
};
struct intel_pad_context {
- u32 padctrl0; /* 0 4 */
- u32 padctrl1; /* 4 4 */
+ u32 conf0; /* 0 4 */
+ u32 val; /* 4 4 */
/* size: 8, cachelines: 1, members: 2 */
/* last cacheline: 8 bytes */
$
The name of some members are different :-\ Consider it in the next
patch and possibly add a knob to consider both types equal, i.e. don't
compare member names, just size, number of members and types of pairs of
members (at each offset in both types).
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
But since it is still related to cus processing, remove that arg and
rename it to __cus__load_debug_types().
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
And it is being compared against uint32_t variables, resulting in this
clang warning:
/var/home/acme/git/pahole/dwarves.c: In function ‘class__find_holes’:
/var/home/acme/git/pahole/dwarves.c:1439:43: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
1439 | if (last_seen_bit < aligned_start && aligned_start <= bit_start) {
| ^
Since it can't be less than zero, just make then uint32_t.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
And it is being compared against uint32_t variables, resulting in this
clang warning:
/var/home/acme/git/pahole/dwarves.c: In function ‘class__find_holes’:
/var/home/acme/git/pahole/dwarves.c:1439:76: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
1439 | if (last_seen_bit < aligned_start && aligned_start <= bit_start) {
| ^~
Since it can't be less than zero, just make then uint32_t.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
And it is being compared against uint32_t variables, resulting in this
clang warning:
/var/home/acme/git/pahole/dwarves.c:1430:44: note: in expansion of macro ‘min’
1430 | int bitfield_end = min(bit_start, cur_bitfield_end);
| ^~~
Since it can't be less than zero, just make then uint32_t.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
And they were being compared against uint32_t variables, resulting in
this clang warning:
/var/home/acme/git/pahole/dwarves.c: In function ‘class__find_holes’:
/var/home/acme/git/pahole/dwarves.c:1453:73: warning: comparison of integer expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
1453 | if (bit_end > cur_bitfield_end || pos->bit_size > cur_bitfield_size) {
|
Since they can't be less than zero, just make then uint32_t.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Since the 'int' variable, 'err' was just checked for < 0, cast it to
uint32_t and compare with the 'uint32_t' one.
Fixes this clang warning:
/var/home/acme/git/pahole/btf_encoder.c: In function ‘btf_encoder__write_raw_file’:
/var/home/acme/git/pahole/btf_encoder.c:890:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
890 | if (err != raw_btf_size) {
| ^~
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Since we don't need the cu to get the strings table anymore, all tags
have a char pointer for strings.
Also rename it to ftype__has_arg_names() and simplify a bit it by
removing a needless one-type use 'name' variable.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Since we don't need the cu to get the strings table anymore, all tags
have a char pointer for strings.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Since we don't need the cu to get the strings table anymore, all tags
have a char pointer for strings.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Since we don't need the cu to get the strings table anymore, all tags
have a char pointer for strings.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
We don't need it as we used it only for calling elf_section_by_name(),
that doesn't need it anymore.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>