Commit d3d93e34 authored by Alexei Starovoitov's avatar Alexei Starovoitov Committed by Andrii Nakryiko

libbpf: Remove unused field.

relo->processed is set, but not used. Remove it.
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210415141817.53136-1-alexei.starovoitov@gmail.com
parent 069904ce
...@@ -195,7 +195,6 @@ struct reloc_desc { ...@@ -195,7 +195,6 @@ struct reloc_desc {
int insn_idx; int insn_idx;
int map_idx; int map_idx;
int sym_off; int sym_off;
bool processed;
}; };
struct bpf_sec_def; struct bpf_sec_def;
...@@ -3499,8 +3498,6 @@ static int bpf_program__record_reloc(struct bpf_program *prog, ...@@ -3499,8 +3498,6 @@ static int bpf_program__record_reloc(struct bpf_program *prog,
const char *sym_sec_name; const char *sym_sec_name;
struct bpf_map *map; struct bpf_map *map;
reloc_desc->processed = false;
if (!is_call_insn(insn) && !is_ldimm64_insn(insn)) { if (!is_call_insn(insn) && !is_ldimm64_insn(insn)) {
pr_warn("prog '%s': invalid relo against '%s' for insns[%d].code 0x%x\n", pr_warn("prog '%s': invalid relo against '%s' for insns[%d].code 0x%x\n",
prog->name, sym_name, insn_idx, insn->code); prog->name, sym_name, insn_idx, insn->code);
...@@ -6314,13 +6311,11 @@ bpf_object__relocate_data(struct bpf_object *obj, struct bpf_program *prog) ...@@ -6314,13 +6311,11 @@ bpf_object__relocate_data(struct bpf_object *obj, struct bpf_program *prog)
case RELO_LD64: case RELO_LD64:
insn[0].src_reg = BPF_PSEUDO_MAP_FD; insn[0].src_reg = BPF_PSEUDO_MAP_FD;
insn[0].imm = obj->maps[relo->map_idx].fd; insn[0].imm = obj->maps[relo->map_idx].fd;
relo->processed = true;
break; break;
case RELO_DATA: case RELO_DATA:
insn[0].src_reg = BPF_PSEUDO_MAP_VALUE; insn[0].src_reg = BPF_PSEUDO_MAP_VALUE;
insn[1].imm = insn[0].imm + relo->sym_off; insn[1].imm = insn[0].imm + relo->sym_off;
insn[0].imm = obj->maps[relo->map_idx].fd; insn[0].imm = obj->maps[relo->map_idx].fd;
relo->processed = true;
break; break;
case RELO_EXTERN_VAR: case RELO_EXTERN_VAR:
ext = &obj->externs[relo->sym_off]; ext = &obj->externs[relo->sym_off];
...@@ -6338,13 +6333,11 @@ bpf_object__relocate_data(struct bpf_object *obj, struct bpf_program *prog) ...@@ -6338,13 +6333,11 @@ bpf_object__relocate_data(struct bpf_object *obj, struct bpf_program *prog)
insn[1].imm = ext->ksym.addr >> 32; insn[1].imm = ext->ksym.addr >> 32;
} }
} }
relo->processed = true;
break; break;
case RELO_EXTERN_FUNC: case RELO_EXTERN_FUNC:
ext = &obj->externs[relo->sym_off]; ext = &obj->externs[relo->sym_off];
insn[0].src_reg = BPF_PSEUDO_KFUNC_CALL; insn[0].src_reg = BPF_PSEUDO_KFUNC_CALL;
insn[0].imm = ext->ksym.kernel_btf_id; insn[0].imm = ext->ksym.kernel_btf_id;
relo->processed = true;
break; break;
case RELO_SUBPROG_ADDR: case RELO_SUBPROG_ADDR:
insn[0].src_reg = BPF_PSEUDO_FUNC; insn[0].src_reg = BPF_PSEUDO_FUNC;
...@@ -6630,9 +6623,6 @@ bpf_object__reloc_code(struct bpf_object *obj, struct bpf_program *main_prog, ...@@ -6630,9 +6623,6 @@ bpf_object__reloc_code(struct bpf_object *obj, struct bpf_program *main_prog,
* different main programs */ * different main programs */
insn->imm = subprog->sub_insn_off - (prog->sub_insn_off + insn_idx) - 1; insn->imm = subprog->sub_insn_off - (prog->sub_insn_off + insn_idx) - 1;
if (relo)
relo->processed = true;
pr_debug("prog '%s': insn #%zu relocated, imm %d points to subprog '%s' (now at %zu offset)\n", pr_debug("prog '%s': insn #%zu relocated, imm %d points to subprog '%s' (now at %zu offset)\n",
prog->name, insn_idx, insn->imm, subprog->name, subprog->sub_insn_off); prog->name, insn_idx, insn->imm, subprog->name, subprog->sub_insn_off);
} }
...@@ -6725,7 +6715,7 @@ static int ...@@ -6725,7 +6715,7 @@ static int
bpf_object__relocate_calls(struct bpf_object *obj, struct bpf_program *prog) bpf_object__relocate_calls(struct bpf_object *obj, struct bpf_program *prog)
{ {
struct bpf_program *subprog; struct bpf_program *subprog;
int i, j, err; int i, err;
/* mark all subprogs as not relocated (yet) within the context of /* mark all subprogs as not relocated (yet) within the context of
* current main program * current main program
...@@ -6736,9 +6726,6 @@ bpf_object__relocate_calls(struct bpf_object *obj, struct bpf_program *prog) ...@@ -6736,9 +6726,6 @@ bpf_object__relocate_calls(struct bpf_object *obj, struct bpf_program *prog)
continue; continue;
subprog->sub_insn_off = 0; subprog->sub_insn_off = 0;
for (j = 0; j < subprog->nr_reloc; j++)
if (subprog->reloc_desc[j].type == RELO_CALL)
subprog->reloc_desc[j].processed = false;
} }
err = bpf_object__reloc_code(obj, prog, prog); err = bpf_object__reloc_code(obj, prog, prog);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment