On Tue, Sep 03, 2024 at 03:08:25PM +0200, Viktor Malik wrote: > On 9/3/24 13:16, Jiri Olsa wrote: > > On Mon, Sep 02, 2024 at 08:58:01AM +0200, Viktor Malik wrote: > >> It is possible to create multiple BPF programs sharing the same > >> instructions using the compiler `__attribute__((alias("...")))`: > >> > >> int BPF_PROG(prog) > >> { > >> [...] > >> } > >> int prog_alias() __attribute__((alias("prog"))); > >> > >> This may be convenient when creating multiple programs with the same > >> instruction set attached to different events (such as bpftrace does). > >> > >> One problem in this situation is that Clang doesn't generate a BTF entry > >> for `prog_alias` which makes libbpf linker fail when processing such a > >> BPF object. > > > > this might not solve all the issues, but could we change pahole to > > generate BTF FUNC for alias function symbols? > > I don't think that would work here. First, we don't usually run pahole > when building BPF objects, it's Clang which generates BTF for the "bpf" > target directly. Second, AFAIK, pahole converts DWARF to BTF and > compilers don't generate DWARF entries for alias function symbols either. ah ok, sry I misunderstood the purpose.. it's about the bpf code generated in bpftrace jirka