Skip to content

Commit c509331

Browse files
author
Peter Zijlstra
committed
objtool: Shrink struct instruction
Any one instruction can only ever call a single function, therefore insn->mcount_loc_node is superfluous and can use insn->call_node. This shrinks struct instruction, which is by far the most numerous structure objtool creates. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Borislav Petkov <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Tested-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent dd003ed commit c509331

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

tools/objtool/check.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,15 +701,15 @@ static int create_mcount_loc_sections(struct objtool_file *file)
701701
return 0;
702702

703703
idx = 0;
704-
list_for_each_entry(insn, &file->mcount_loc_list, mcount_loc_node)
704+
list_for_each_entry(insn, &file->mcount_loc_list, call_node)
705705
idx++;
706706

707707
sec = elf_create_section(file->elf, "__mcount_loc", 0, sizeof(unsigned long), idx);
708708
if (!sec)
709709
return -1;
710710

711711
idx = 0;
712-
list_for_each_entry(insn, &file->mcount_loc_list, mcount_loc_node) {
712+
list_for_each_entry(insn, &file->mcount_loc_list, call_node) {
713713

714714
loc = (unsigned long *)sec->data->d_buf + idx;
715715
memset(loc, 0, sizeof(unsigned long));
@@ -1051,7 +1051,7 @@ static void annotate_call_site(struct objtool_file *file,
10511051

10521052
insn->type = INSN_NOP;
10531053

1054-
list_add_tail(&insn->mcount_loc_node, &file->mcount_loc_list);
1054+
list_add_tail(&insn->call_node, &file->mcount_loc_list);
10551055
return;
10561056
}
10571057
}

tools/objtool/include/objtool/check.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ struct instruction {
4040
struct list_head list;
4141
struct hlist_node hash;
4242
struct list_head call_node;
43-
struct list_head mcount_loc_node;
4443
struct section *sec;
4544
unsigned long offset;
4645
unsigned int len;

0 commit comments

Comments
 (0)