Skip to content

Commit be5ee60

Browse files
achartrePeter Zijlstra
authored andcommitted
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
1 parent 4aae0d3 commit be5ee60

4 files changed

Lines changed: 6 additions & 1 deletion

File tree

tools/objtool/check.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,7 @@ static int handle_group_alt(struct objtool_file *file,
17511751
orig_alt_group->last_insn = last_orig_insn;
17521752
orig_alt_group->nop = NULL;
17531753
orig_alt_group->ignore = orig_insn->ignore_alts;
1754+
orig_alt_group->feature = 0;
17541755
} else {
17551756
if (orig_alt_group->last_insn->offset + orig_alt_group->last_insn->len -
17561757
orig_alt_group->first_insn->offset != special_alt->orig_len) {
@@ -1855,6 +1856,7 @@ static int handle_group_alt(struct objtool_file *file,
18551856
new_alt_group->nop = nop;
18561857
new_alt_group->ignore = (*new_insn)->ignore_alts;
18571858
new_alt_group->cfi = orig_alt_group->cfi;
1859+
new_alt_group->feature = special_alt->feature;
18581860
return 0;
18591861
}
18601862

tools/objtool/include/objtool/check.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct alt_group {
3636
struct cfi_state **cfi;
3737

3838
bool ignore;
39+
unsigned int feature;
3940
};
4041

4142
enum alternative_type {

tools/objtool/include/objtool/special.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct special_alt {
2525
struct section *new_sec;
2626
unsigned long new_off;
2727

28-
unsigned int orig_len, new_len; /* group only */
28+
unsigned int orig_len, new_len, feature; /* group only */
2929
};
3030

3131
int special_get_alts(struct elf *elf, struct list_head *alts);

tools/objtool/special.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ static int get_alt_entry(struct elf *elf, const struct special_entry *entry,
8181
entry->orig_len);
8282
alt->new_len = *(unsigned char *)(sec->data->d_buf + offset +
8383
entry->new_len);
84+
alt->feature = *(unsigned int *)(sec->data->d_buf + offset +
85+
entry->feature);
8486
}
8587

8688
orig_reloc = find_reloc_by_dest(elf, sec, offset + entry->orig);

0 commit comments

Comments
 (0)