From nobody Sun Feb 8 19:30:08 2026 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 D1724264633 for ; Tue, 8 Apr 2025 08:21:28 +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=1744100488; cv=none; b=t6Wb6Fw3z0LhLMo0+wc2zt+6s+Jg8oJAaPl1EtSRBVLrkVcGIDc3oiqVW0oTxudbn9MgM7GTVyzIWEf+JxYWX7dVs2q1wcROI09etpLjH4ymulHYsdEp3gVjl3u2K0W7pYN4Ymk4egOgCrl2xiUy7BaKs0p6YztHoEhxkAPqpiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744100488; c=relaxed/simple; bh=XpWuCEwoPXT8o8UPr6REZoN2em1Xvh02RO7hc3Rm1Xw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZST+JK1cdulUyBUHuOjY6dnwC0+q2eN3pBjH+E4t3aoZ2LXRA49Xfe/m6OEQn2p6eSRZkai5FLM76vVSfrFww5bQOO0v3bbPWiKn7ZA0Rf7FPCQUG+n0/Hqk4mXjhkN3Ri3JicL9rv8Nvhy73T88SqhO9U0GbO2xrHzyXNO/xLg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NSPo58Rc; 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="NSPo58Rc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C962C4CEE5; Tue, 8 Apr 2025 08:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744100488; bh=XpWuCEwoPXT8o8UPr6REZoN2em1Xvh02RO7hc3Rm1Xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NSPo58RcJQz3zoH2B3KAHc+x/g9CKL9pf12o+mZyVmLgW/Jn7Dr4mgfE6Rlo3mGDO X0k7GgwL18iM+a4dYW7S/WaRBI+8k0mqlo978YP7PCWzWjiIrw+72kYwh+axCeY0Mz ile+Zq9RV4+blooZLQyzrrIxPiuEr8tXP+Xv1FriwA9fLNNFkwEbBgwIrbBLoj4F/T 5FueZTrn9S70Xqes/nxbkjauARhYWIde8yQAalSBs5GxDiNIXyBmOMTz/rlyrSmJP7 kfcTYLu+IaL8MdTRKPsc+JNG1Nez5OR8WzC28YC0VNBTBbH8xfo+dL68UeiV+Livau iAcOM9M6UQJqQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra Subject: [PATCH RFC 5/5] objtool: Improve code generation readability Date: Tue, 8 Apr 2025 01:21:18 -0700 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Improve the readability and compactness of the objtool annotations. This makes it easier to see them and differentiate from other code. Before: ------- 911: .pushsection .discard.annotate_insn,"M",@progbits,8 .long 911b - . .long 1 .popsection After: ------ # 911: .pushsection .discard.annotate_insn,"M",@progbits,8; .long 911b - .; = .long 1; .popsection # Signed-off-by: Josh Poimboeuf --- include/linux/objtool.h | 97 ++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 50 deletions(-) diff --git a/include/linux/objtool.h b/include/linux/objtool.h index 366ad004d794..66549603147e 100644 --- a/include/linux/objtool.h +++ b/include/linux/objtool.h @@ -8,19 +8,31 @@ =20 #include =20 +#define __UNWIND_HINT(label, type, sp_reg, sp_offset, signal) \ + .pushsection .discard.unwind_hints; \ + /* struct unwind_hint */ \ + .long label - .; \ + .short sp_offset; \ + .byte sp_reg; \ + .byte type; \ + .byte signal; \ + .balign 4; \ + .popsection + +#define __ASM_ANNOTATE(label, type) \ + .pushsection .discard.annotate_insn,"M",@progbits,8; \ + .long label - .; \ + .long type; \ + .popsection + #ifndef __ASSEMBLY__ =20 -#define UNWIND_HINT(type, sp_reg, sp_offset, signal) \ - "987: \n\t" \ - ".pushsection .discard.unwind_hints\n\t" \ - /* struct unwind_hint */ \ - ".long 987b - .\n\t" \ - ".short " __stringify(sp_offset) "\n\t" \ - ".byte " __stringify(sp_reg) "\n\t" \ - ".byte " __stringify(type) "\n\t" \ - ".byte " __stringify(signal) "\n\t" \ - ".balign 4 \n\t" \ - ".popsection\n\t" +#define UNWIND_HINT(type, sp_reg, sp_offset, signal) \ + "\n# \n" \ + "987: " \ + __stringify(__UNWIND_HINT(987b, type, sp_reg, \ + sp_offset, signal)) \ + "\n# \n\t" =20 /* * This macro marks the given function's stack frame as "non-standard", wh= ich @@ -45,23 +57,18 @@ #define STACK_FRAME_NON_STANDARD_FP(func) #endif =20 -#define ASM_REACHABLE \ - "998:\n\t" \ - ".pushsection .discard.reachable\n\t" \ - ".long 998b\n\t" \ - ".popsection\n\t" - #define __ASM_BREF(label) label ## b =20 -#define __ASM_ANNOTATE(label, type) \ - ".pushsection .discard.annotate_insn,\"M\",@progbits,8\n\t" \ - ".long " __stringify(label) " - .\n\t" \ - ".long " __stringify(type) "\n\t" \ - ".popsection\n\t" - #define ASM_ANNOTATE(type) \ - "911:\n\t" \ - __ASM_ANNOTATE(911b, type) + "\n# \n" \ + "911:\t" \ + __stringify(__ASM_ANNOTATE(911b, __PASTE(ANNOTYPE_, type))) \ + "\n# \n\t" + +#define ASM_ANNOTATE_LABEL(label, type) \ + "\n# BEGIN ANNOTATE_" __stringify(type) "\n" \ + __stringify(__ASM_ANNOTATE(label, __PASTE(ANNOTYPE_, type))) \ + "\n#