pahole: Allow encoding BTF into a detached file
Previously the newly encoded BTF info was stored into a ELF section in
the file where the DWARF info was obtained, but it is useful to just
dump it into a separate file, do it.
$ ls -la vmlinux.btf
ls: cannot access 'vmlinux.btf': No such file or directory
$ pahole -j vmlinux.btf vmlinux
$ ls -la vmlinux.btf
-rw-r-----. 1 acme acme 4630082 Jun 1 16:15 vmlinux.btf
$ pahole -C list_head ./vmlinux.btf
struct list_head {
struct list_head * next; /* 0 8 */
struct list_head * prev; /* 8 8 */
/* size: 16, cachelines: 1, members: 2 */
/* last cacheline: 16 bytes */
};
acme@toolbox pahole]$ pahole -C raw_spinlock_t ./vmlinux.btf
typedef struct raw_spinlock raw_spinlock_t;
acme@toolbox pahole]$ pahole -EC raw_spinlock ./vmlinux.btf
struct raw_spinlock {
/* typedef arch_spinlock_t */ struct qspinlock {
union {
/* typedef atomic_t */ struct {
int counter; /* 0 4 */
} val; /* 0 4 */
struct {
/* typedef u8 -> __u8 */ unsigned char locked; /* 0 1 */
/* typedef u8 -> __u8 */ unsigned char pending; /* 1 1 */
}; /* 0 2 */
struct {
/* typedef u16 -> __u16 */ short unsigned int locked_pending; /* 0 2 */
/* typedef u16 -> __u16 */ short unsigned int tail; /* 2 2 */
}; /* 0 4 */
}; /* 0 4 */
} raw_lock; /* 0 4 */
/* size: 4, cachelines: 1, members: 1 */
/* last cacheline: 4 bytes */
};
⬢[acme@toolbox pahole]$
Requested-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>