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

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Preserve alternatives order

Preserve the order in which alternatives are defined. Currently
objtool stores alternatives in a list in reverse order.

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-19-alexandre.chartre@oracle.com

authored by

Alexandre Chartre and committed by
Peter Zijlstra
7ad7a4a7 5f326c88

+14 -2
+14 -2
tools/objtool/check.c
··· 1921 1921 struct special_alt *special_alt, *tmp; 1922 1922 enum alternative_type alt_type; 1923 1923 struct alternative *alt; 1924 + struct alternative *a; 1924 1925 1925 1926 if (special_get_alts(file->elf, &special_alts)) 1926 1927 return -1; ··· 1974 1973 } 1975 1974 1976 1975 alt->insn = new_insn; 1977 - alt->next = orig_insn->alts; 1978 1976 alt->type = alt_type; 1979 - orig_insn->alts = alt; 1977 + alt->next = NULL; 1978 + 1979 + /* 1980 + * Store alternatives in the same order they have been 1981 + * defined. 1982 + */ 1983 + if (!orig_insn->alts) { 1984 + orig_insn->alts = alt; 1985 + } else { 1986 + for (a = orig_insn->alts; a->next; a = a->next) 1987 + ; 1988 + a->next = alt; 1989 + } 1980 1990 1981 1991 list_del(&special_alt->list); 1982 1992 free(special_alt);