From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABB432DCF6E for ; Sat, 6 Dec 2025 21:42:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057324; cv=none; b=EjFm5aa9aw2lgDeYt5Wsh5XAhwYkS4l9tLho1o2P/Ibzp3fILWLKLVSLmeQtJT/4z6Dfbt7dd3ScUVWJdCP/O2MpvMDVfgoksZYXfib1QuploEnl6qHMhfRIsV6ymqsMntknlxhsqHOaFAKiNx2R+nkbn7RR2lf4sVHLXVCi0TU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057324; c=relaxed/simple; bh=sDdtKliQ2uhNGKIthpPGlkOL2FOWumgTheAroI6NzXM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qT+S/XOnSARnxb5Rh/PLHwfkrDIhg4XoLbvX3Dy3EqXbnuqOad9Cazj+sid6BQMywEvLSHC47NsiU2iogrqDUDOR1eMaH/A5iMkJlPM+3T1gURHtaqfsKdPWiTcI+4fIykxMz5MWnM7LQcxUe+VLeOwAeS/fPYcCyoRuXkx/3n0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ImqLhL6z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ImqLhL6z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F181C4CEF5; Sat, 6 Dec 2025 21:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765057324; bh=sDdtKliQ2uhNGKIthpPGlkOL2FOWumgTheAroI6NzXM=; h=From:To:Cc:Subject:Date:From; b=ImqLhL6zCtZStUiZurFjaaIO4B8QALZQUMRm0NB9d8abzjRvP/6eKe+f47iZGFg/Y 4TbU7oocmeAqIBCLsU1g5lQ6nYij3frN128a1NHUiMdw0NXs5297GPmSj8oBgjlIaI g7oD6s/fI175uLKUfo4cKW/6UmCKpRNADfiib7pvV5tc7f0kfrIczfkT32SAh2VDMa iyUBES3kwvmej1+3SzhFHWDxEm5zXsXqSCXYqUUSQz/GiRUqldiYKj25rTZ4o6cpON ezpXGgfGUrMnN845cWgBHV8/FXkRnXpIm/3NYGlRVDo5fv/H5AT0G58KMpoDdbbEU6 KNAdLRJLpnYYw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 0/8] objtool, x86/alternative: Convert objtool annotations and x86 alternatives to assembler macros Date: Sat, 6 Dec 2025 13:41:07 -0800 Message-ID: X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Convert objtool annotations and x86 alternatives to assembler macros. This creates a shared C/asm alternative implementation and makes the code generation significantly more readable. Patches 1-5: convert objtool Patches 6-8: convert alternatives Based on tip/master. Before: ----- # ./arch/x86/include/asm/smap.h:47: alternative("", "stac", X86_FEATURE_SMAP); # 47 "./arch/x86/include/asm/smap.h" 1 # ALT: oldinstr 771: 772: # ALT: padding .skip -(((775f-774f)-(772b-771b)) > 0) * ((775f-774f)-(772b-771b)),0x90 773: .pushsection .altinstructions, "aM", @progbits, 14 .long 771b - . .long 774f - . .4byte ( 9*32+20) .byte 773b-771b .byte 775f-774f .popsection .pushsection .altinstr_replacement, "ax" .pushsection .discard.annotate_data, "M", @progbits, 8; .long 1b - ., 1; .popsection # ALT: replacement 774: stac 775: .popsection ----- After: ----- # ./arch/x86/include/asm/smap.h:47: alternative("", "stac", X86_FEATURE_SMAP); # 47 "./arch/x86/include/asm/smap.h" 1 ALTERNATIVE "", "stac", "( 9*32+20)" ----- Future work: - BUG()/WARN() - static_cpu_has() - static calls/branches - exceptions - smp locks - unwind hints Josh Poimboeuf (8): objtool: Rename ANNOTYPE_IGNORE_ALTS -> ANNOTYPE_IGNORE_ALTERNATIVE objtool: Make ANNOTYPE_DATA_SPECIAL unique across all annotations objtool: Rename C ANNOTATE_REACHABLE to ANNOTATE_REACHABLE_LABEL objtool: Rename asm ANNOTATE_NOCFI_SYM to ANNOTATE_NOCFI objtool: Convert annotations to assembler macros x86/asm: Use unique code labels in __FILL_RETURN_BUFFER x86/asm: Remove newlines in alternatives x86/alternative: Convert alternatives to assembler macros arch/x86/include/asm/alternative.h | 196 +++++++++++++------------- arch/x86/include/asm/asm.h | 8 +- arch/x86/include/asm/bug.h | 2 +- arch/x86/include/asm/irq_stack.h | 2 +- arch/x86/include/asm/jump_label.h | 1 + arch/x86/include/asm/nospec-branch.h | 8 +- arch/x86/include/asm/paravirt_types.h | 2 +- arch/x86/include/asm/processor.h | 2 +- arch/x86/include/asm/smap.h | 8 +- arch/x86/include/asm/vmware.h | 2 +- arch/x86/platform/efi/efi_stub_64.S | 2 +- include/linux/annotate.h | 133 ++++++++--------- include/linux/objtool_types.h | 5 +- tools/include/linux/objtool_types.h | 5 +- tools/objtool/check.c | 4 +- 15 files changed, 196 insertions(+), 184 deletions(-) -- 2.52.0