Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

objtool: Provide access to feature and flags of group alternatives

Each alternative of a group alternative depends on a specific
feature and flags. Provide access to the feature/flags for each
alternative as an attribute (feature) in struct alt_group.

Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://patch.msgid.link/20251121095340.464045-26-alexandre.chartre@oracle.com

authored by

Alexandre Chartre and committed by
Peter Zijlstra
be5ee60a 4aae0d3f

+6 -1
+2
tools/objtool/check.c
··· 1751 1751 orig_alt_group->last_insn = last_orig_insn; 1752 1752 orig_alt_group->nop = NULL; 1753 1753 orig_alt_group->ignore = orig_insn->ignore_alts; 1754 + orig_alt_group->feature = 0; 1754 1755 } else { 1755 1756 if (orig_alt_group->last_insn->offset + orig_alt_group->last_insn->len - 1756 1757 orig_alt_group->first_insn->offset != special_alt->orig_len) { ··· 1856 1855 new_alt_group->nop = nop; 1857 1856 new_alt_group->ignore = (*new_insn)->ignore_alts; 1858 1857 new_alt_group->cfi = orig_alt_group->cfi; 1858 + new_alt_group->feature = special_alt->feature; 1859 1859 return 0; 1860 1860 } 1861 1861
+1
tools/objtool/include/objtool/check.h
··· 36 36 struct cfi_state **cfi; 37 37 38 38 bool ignore; 39 + unsigned int feature; 39 40 }; 40 41 41 42 enum alternative_type {
+1 -1
tools/objtool/include/objtool/special.h
··· 25 25 struct section *new_sec; 26 26 unsigned long new_off; 27 27 28 - unsigned int orig_len, new_len; /* group only */ 28 + unsigned int orig_len, new_len, feature; /* group only */ 29 29 }; 30 30 31 31 int special_get_alts(struct elf *elf, struct list_head *alts);
+2
tools/objtool/special.c
··· 81 81 entry->orig_len); 82 82 alt->new_len = *(unsigned char *)(sec->data->d_buf + offset + 83 83 entry->new_len); 84 + alt->feature = *(unsigned int *)(sec->data->d_buf + offset + 85 + entry->feature); 84 86 } 85 87 86 88 orig_reloc = find_reloc_by_dest(elf, sec, offset + entry->orig);