Skip to content

Commit 27780af

Browse files
committed
objtool, x86/hweight: Remove ANNOTATE_IGNORE_ALTERNATIVE
JIRA: https://issues.redhat.com/browse/RHEL-94124 commit 7b3169d Author: Josh Poimboeuf <jpoimboe@kernel.org> Date: Thu Apr 10 13:58:35 2025 -0700 objtool, x86/hweight: Remove ANNOTATE_IGNORE_ALTERNATIVE Since objtool's inception, frame pointer warnings have been manually silenced for __arch_hweight*() to allow those functions' inline asm to avoid using ASM_CALL_CONSTRAINT. The potentially dubious reasoning for that decision over nine years ago was that since !X86_FEATURE_POPCNT is exceedingly rare, it's not worth hurting the code layout for a function call that will never happen on the vast majority of systems. However, those functions actually started using ASM_CALL_CONSTRAINT with the following commit: 194a613 ("x86/hweight: Use ASM_CALL_CONSTRAINT in inline asm()") And rightfully so, as it makes the code correct. ASM_CALL_CONSTRAINT will soon have no effect for non-FP configs anyway. With ASM_CALL_CONSTRAINT in place, ANNOTATE_IGNORE_ALTERNATIVE no longer has a purpose for the hweight functions. Remove it. Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Juergen Gross <jgross@suse.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/e7070dba3278c90f1a836b16157dcd34ccd21e21.1744318586.git.jpoimboe@kernel.org Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
1 parent 909d6db commit 27780af

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/x86/include/asm/arch_hweight.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ static __always_inline unsigned int __arch_hweight32(unsigned int w)
1616
{
1717
unsigned int res;
1818

19-
asm_inline (ALTERNATIVE(ANNOTATE_IGNORE_ALTERNATIVE
20-
"call __sw_hweight32",
19+
asm_inline (ALTERNATIVE("call __sw_hweight32",
2120
"popcntl %[val], %[cnt]", X86_FEATURE_POPCNT)
2221
: [cnt] "=" REG_OUT (res), ASM_CALL_CONSTRAINT
2322
: [val] REG_IN (w));
@@ -46,8 +45,7 @@ static __always_inline unsigned long __arch_hweight64(__u64 w)
4645
{
4746
unsigned long res;
4847

49-
asm_inline (ALTERNATIVE(ANNOTATE_IGNORE_ALTERNATIVE
50-
"call __sw_hweight64",
48+
asm_inline (ALTERNATIVE("call __sw_hweight64",
5149
"popcntq %[val], %[cnt]", X86_FEATURE_POPCNT)
5250
: [cnt] "=" REG_OUT (res), ASM_CALL_CONSTRAINT
5351
: [val] REG_IN (w));

0 commit comments

Comments
 (0)