• Daniel Borkmann's avatar
    bpf, libbpf: fix version info and add it to shared object · 1d382264
    Daniel Borkmann authored
    Even though libbpf's versioning script for the linker (libbpf.map)
    is pointing to 0.0.2, the BPF_EXTRAVERSION in the Makefile has
    not been updated along with it and is therefore still on 0.0.1.
    
    While fixing up, I also noticed that the generated shared object
    versioning information is missing, typical convention is to have
    a linker name (libbpf.so), soname (libbpf.so.0) and real name
    (libbpf.so.0.0.2) for library management. This is based upon the
    LIBBPF_VERSION as well.
    
    The build will then produce the following bpf libraries:
    
      # ll libbpf*
      libbpf.a
      libbpf.so -> libbpf.so.0.0.2
      libbpf.so.0 -> libbpf.so.0.0.2
      libbpf.so.0.0.2
    
      # readelf -d libbpf.so.0.0.2 | grep SONAME
      0x000000000000000e (SONAME)             Library soname: [libbpf.so.0]
    
    And install them accordingly:
    
      # rm -rf /tmp/bld; mkdir /tmp/bld; make -j$(nproc) O=/tmp/bld install
    
      Auto-detecting system features:
      ...                        libelf: [ on  ]
      ...                           bpf: [ on  ]
    
        CC       /tmp/bld/libbpf.o
        CC       /tmp/bld/bpf.o
        CC       /tmp/bld/nlattr.o
        CC       /tmp/bld/btf.o
        CC       /tmp/bld/libbpf_errno.o
        CC       /tmp/bld/str_error.o
        CC       /tmp/bld/netlink.o
        CC       /tmp/bld/bpf_prog_linfo.o
        CC       /tmp/bld/libbpf_probes.o
        CC       /tmp/bld/xsk.o
        LD       /tmp/bld/libbpf-in.o
        LINK     /tmp/bld/libbpf.a
        LINK     /tmp/bld/libbpf.so.0.0.2
        LINK     /tmp/bld/test_libbpf
        INSTALL  /tmp/bld/libbpf.a
        INSTALL  /tmp/bld/libbpf.so.0.0.2
    
      # ll /usr/local/lib64/libbpf.*
      /usr/local/lib64/libbpf.a
      /usr/local/lib64/libbpf.so -> libbpf.so.0.0.2
      /usr/local/lib64/libbpf.so.0 -> libbpf.so.0.0.2
      /usr/local/lib64/libbpf.so.0.0.2
    
    Fixes: 1bf4b058 ("tools: bpftool: add probes for eBPF program types")
    Fixes: 1b76c13e ("bpf tools: Introduce 'bpf' library and add bpf feature check")
    Reported-by: default avatarStanislav Fomichev <sdf@google.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    1d382264
Makefile 7.54 KB