• Wang Nan's avatar
    bpf tools: Collect relocation sections from SHT_REL sections · b62f06e8
    Wang Nan authored
    This patch collects relocation sections into 'struct object'.  Such
    sections are used for connecting maps to bpf programs. 'reloc' field in
    'struct bpf_object' is introduced for storing such information.
    
    This patch simply store the data into 'reloc' field. Following patch
    will parse them to know the exact instructions which are needed to be
    relocated.
    
    Note that the collected data will be invalid after ELF object file is
    closed.
    
    This is the second patch related to map relocation. The first one is
    'bpf tools: Collect symbol table from SHT_SYMTAB section'. The
    principle of map relocation is described in its commit message.
    Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
    Acked-by: default avatarAlexei Starovoitov <ast@plumgrid.com>
    Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: He Kuang <hekuang@huawei.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kaixu Xia <xiakaixu@huawei.com>
    Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Zefan Li <lizefan@huawei.com>
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1435716878-189507-14-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    b62f06e8
libbpf.c 11.8 KB