• W
    bpf tools: Record map accessing instructions for each program · 34090915
    Wang Nan 提交于
    This patch records the indices of instructions which are needed to be
    relocated. That information is saved in the 'reloc_desc' field in
    'struct bpf_program'. In the loading phase (this patch takes effect in
    the opening phase), the collected instructions will be replaced by map
    loading instructions.
    
    Since we are going to close the ELF file and clear all data at the end
    of the 'opening' phase, the ELF information will no longer be valid in
    the 'loading' phase. We have to locate the instructions before maps are
    loaded, instead of directly modifying the instruction.
    
    'struct bpf_map_def' is introduced in this patch to let us know how many
    maps are defined in the object.
    
    This is the third part of map relocation. The principle of map relocation
    is described in commit message of 'bpf tools: Collect symbol table from
    SHT_SYMTAB section'.
    Signed-off-by: NWang Nan <wangnan0@huawei.com>
    Acked-by: NAlexei 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-15-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
    34090915
libbpf.h 1.3 KB