From nobody Tue Dec 2 00:25:41 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 C148B2FB962; Mon, 24 Nov 2025 10:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763981047; cv=none; b=EbSJWS1HWNWLnfXSB71Ei57IULVM8JtqPWjaH3OLkujmo/3RvmK91iumtsj801RTovww3H+3WKR4kw9D73+7y/ebbbB53V0o94QiJbPlSblDPwBv3aPkymXoG+jkdAhHvx6Ka7QHzijWiPzl0jfjWTPNI3r2XqguH9Oz225hNy8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763981047; c=relaxed/simple; bh=vYcfBogXCC4Daaox34ae9ML7RGGtz2OmyD3pIAB7wFw=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=YYS4VuKX68x0lJA6t4CP765sf/yO3L39p2ik+9wxqydKPuBwLgyE2X1Hh6emMDn1GeByoQXVXIoCh3bjgqZ3xPqfhrgeTPdC/k6BHZOCmGrfuB+/PHwqo6I9eJ/eCOCk0r8KVOr6wW8w8Bds8xyAFBw+f1PPPpllLv52uBv6lmI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=AcqKInab; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Lvq0h8xe; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="AcqKInab"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Lvq0h8xe" Date: Mon, 24 Nov 2025 10:44:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763981041; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OlWTKrn+Fl9wJ6mXGhp27Ga3EDh1MWJBck4n+7YF+zc=; b=AcqKInab5P9GW/ZIzJFGNc7ZnfcYWoMPpc/sI4Yy2q4uimy/pWxOKvusrBUlJYNWlOHPyO VPtiHo0Qc9ULQa7MYlcFP3i5XCkVjX537hySwyawRMDnXBxtxQDrLg9vqXn8zUc2avG0lm 1dXDhN28TdOL95/zVamOC3hCp6s3+JNhvH/gKYaqbt7hWWBqyHFfkGwowuUK/floWCE3Us P5F3qhhRkGlv1jwRat2T5qnn2k82ePtnmLdmudatiePaQPB6WoiFNEx/wXbZYQEY+3JEl9 85dT/CzdThJeaqzZXHZChE115I3L5hd1tWMKwfDyj/wdtEvLU0lqXUGSsaBj6g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763981041; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OlWTKrn+Fl9wJ6mXGhp27Ga3EDh1MWJBck4n+7YF+zc=; b=Lvq0h8xea/O7ypjb8MKbrZnpzAZi5+DuxeG7+znULNlvmP2Uc8skW5aE+13GYs1wVsLGiL GM4yLEetPg9usQDg== From: "tip-bot2 for Alexandre Chartre" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool: Improve naming of group alternatives Cc: Alexandre Chartre , "Peter Zijlstra (Intel)" , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20251121095340.464045-28-alexandre.chartre@oracle.com> References: <20251121095340.464045-28-alexandre.chartre@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <176398104055.498.706765429362126861.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the objtool/core branch of tip: Commit-ID: 47793c0677e11bef7eb546d90e73f1d51e6eb22b Gitweb: https://git.kernel.org/tip/47793c0677e11bef7eb546d90e73f1d51= e6eb22b Author: Alexandre Chartre AuthorDate: Fri, 21 Nov 2025 10:53:37 +01:00 Committer: Peter Zijlstra CommitterDate: Mon, 24 Nov 2025 11:35:16 +01:00 objtool: Improve naming of group alternatives Improve the naming of group alternatives by showing the feature name and flags used by the alternative. Signed-off-by: Alexandre Chartre Signed-off-by: Peter Zijlstra (Intel) Acked-by: Josh Poimboeuf Link: https://patch.msgid.link/20251121095340.464045-28-alexandre.chartre@o= racle.com --- tools/objtool/disas.c | 58 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c index f8917c8..731c449 100644 --- a/tools/objtool/disas.c +++ b/tools/objtool/disas.c @@ -9,6 +9,7 @@ #include #include #include +#include #include =20 #include @@ -60,6 +61,21 @@ struct disas_alt { #define DALT_GROUP(dalt) (DALT_INSN(dalt)->alt_group) #define DALT_ALTID(dalt) ((dalt)->orig_insn->offset) =20 +#define ALT_FLAGS_SHIFT 16 +#define ALT_FLAG_NOT (1 << 0) +#define ALT_FLAG_DIRECT_CALL (1 << 1) +#define ALT_FEATURE_MASK ((1 << ALT_FLAGS_SHIFT) - 1) + +static int alt_feature(unsigned int ft_flags) +{ + return (ft_flags & ALT_FEATURE_MASK); +} + +static int alt_flags(unsigned int ft_flags) +{ + return (ft_flags >> ALT_FLAGS_SHIFT); +} + /* * Wrapper around asprintf() to allocate and format a string. * Return the allocated string or NULL on error. @@ -635,7 +651,12 @@ const char *disas_alt_type_name(struct instruction *in= sn) */ char *disas_alt_name(struct alternative *alt) { + char pfx[4] =3D { 0 }; char *str =3D NULL; + const char *name; + int feature; + int flags; + int num; =20 switch (alt->type) { =20 @@ -649,13 +670,37 @@ char *disas_alt_name(struct alternative *alt) =20 case ALT_TYPE_INSTRUCTIONS: /* - * This is a non-default group alternative. Create a unique - * name using the offset of the first original and alternative - * instructions. + * This is a non-default group alternative. Create a name + * based on the feature and flags associated with this + * alternative. Use either the feature name (it is available) + * or the feature number. And add a prefix to show the flags + * used. + * + * Prefix flags characters: + * + * '!' alternative used when feature not enabled + * '+' direct call alternative + * '?' unknown flag */ - asprintf(&str, "ALTERNATIVE %lx.%lx", - alt->insn->alt_group->orig_group->first_insn->offset, - alt->insn->alt_group->first_insn->offset); + + feature =3D alt->insn->alt_group->feature; + num =3D alt_feature(feature); + flags =3D alt_flags(feature); + str =3D pfx; + + if (flags & ~(ALT_FLAG_NOT | ALT_FLAG_DIRECT_CALL)) + *str++ =3D '?'; + if (flags & ALT_FLAG_DIRECT_CALL) + *str++ =3D '+'; + if (flags & ALT_FLAG_NOT) + *str++ =3D '!'; + + name =3D arch_cpu_feature_name(num); + if (!name) + str =3D strfmt("%sFEATURE 0x%X", pfx, num); + else + str =3D strfmt("%s%s", pfx, name); + break; } =20 @@ -892,6 +937,7 @@ static void *disas_alt(struct disas_context *dctx, WARN("%s has more alternatives than supported", alt_name); break; } + dalt =3D &dalts[i]; err =3D disas_alt_init(dalt, orig_insn, alt); if (err) {