]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
objtool: Provide access to feature and flags of group alternatives
authorAlexandre Chartre <alexandre.chartre@oracle.com>
Fri, 21 Nov 2025 09:53:35 +0000 (10:53 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 21 Nov 2025 14:30:14 +0000 (15:30 +0100)
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
tools/objtool/check.c
tools/objtool/include/objtool/check.h
tools/objtool/include/objtool/special.h
tools/objtool/special.c

index f75364f20bf1425e9c3375dbc58e14cf81f5e606..9ec0e07cce90b67d54fc5df492a29b2aa5df44e2 100644 (file)
@@ -1751,6 +1751,7 @@ static int handle_group_alt(struct objtool_file *file,
                orig_alt_group->last_insn = last_orig_insn;
                orig_alt_group->nop = NULL;
                orig_alt_group->ignore = orig_insn->ignore_alts;
+               orig_alt_group->feature = 0;
        } else {
                if (orig_alt_group->last_insn->offset + orig_alt_group->last_insn->len -
                    orig_alt_group->first_insn->offset != special_alt->orig_len) {
@@ -1855,6 +1856,7 @@ end:
        new_alt_group->nop = nop;
        new_alt_group->ignore = (*new_insn)->ignore_alts;
        new_alt_group->cfi = orig_alt_group->cfi;
+       new_alt_group->feature = special_alt->feature;
        return 0;
 }
 
index cbf4af58e29b251a52a69f11935411f90a898b0b..2e1346ad5e9260c2eb161570eb4e0fe3093ebd98 100644 (file)
@@ -36,6 +36,7 @@ struct alt_group {
        struct cfi_state **cfi;
 
        bool ignore;
+       unsigned int feature;
 };
 
 enum alternative_type {
index 72d09c0adf1a187a4716934c83c0dad939ec1c10..b22410745e4a1a42b58013ed46469e7324ef79b6 100644 (file)
@@ -25,7 +25,7 @@ struct special_alt {
        struct section *new_sec;
        unsigned long new_off;
 
-       unsigned int orig_len, new_len; /* group only */
+       unsigned int orig_len, new_len, feature; /* group only */
 };
 
 int special_get_alts(struct elf *elf, struct list_head *alts);
index e262af9171436a416e63cb972bd74d9fb23293b1..2a533afbc69aaf6872588f16da9a04ee88bcc4a4 100644 (file)
@@ -81,6 +81,8 @@ static int get_alt_entry(struct elf *elf, const struct special_entry *entry,
                                                   entry->orig_len);
                alt->new_len = *(unsigned char *)(sec->data->d_buf + offset +
                                                  entry->new_len);
+               alt->feature = *(unsigned int *)(sec->data->d_buf + offset +
+                                                entry->feature);
        }
 
        orig_reloc = find_reloc_by_dest(elf, sec, offset + entry->orig);