Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2899981rdb; Tue, 26 Dec 2023 08:38:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFat/xmu4+HE+6d9HUM/2xTUs2mLkSGu7IdPE7F281fP0Lsar9xpkCi889+/RECtZNoub4V X-Received: by 2002:a17:90a:5d82:b0:28b:831f:187 with SMTP id t2-20020a17090a5d8200b0028b831f0187mr3606324pji.19.1703608693711; Tue, 26 Dec 2023 08:38:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703608693; cv=none; d=google.com; s=arc-20160816; b=Q+DX6Hm2A0jA3VXs5vgdbhS/3gPlZhIv81ceYD9A1/xS11DRmlxHyVDWsYfYsxoNSG 8nXNeRdE4bgLWGg53kAbs8rTa8AkMegITC9AtG04BNJjoBqJtLTnWRxK+Tvy9gqZP9DY /YnWNsbsqJPFs9b++9ExwearESKARDRf0NNKZiYE6XYkn7o6sR/YQ0QWgZJQlYT98bcV 0wgGd5wui3MBLBcOae8iyF+5m14c2R5P5Oi/kXSKVK1C5vKrzrZvDINhkEGsjK8ANPHb TPqstVz6OzGsND75Z/2pbpijnTZ2sA5K+HRN83Y1Z4u9X6+wpY75p0ufSqZXilgua5Dp WfaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RAJSQlkStB5KBhKBm1k2lMAOMbBvtxDucFN++BA9Dig=; fh=7KXnewkg3NbJeOhWryEU4DR/PHaP3IYCg2oKRtO/z28=; b=I00c3gIvUTbDAyKjIoAjfq308U6exLTk0T+i2JF1d4LJ9DYZpg9QvTpGUMRpWDQmnY vrnELUW2gqu++vZQjw0EIegBUrV0wmSSf4RvMjIPKS/WOS/sajvSeHrCVo9jC6IXSJVn 6f97HRJNYLgT7wSiHNHr+tCLp62yPOyQf27EVBeMBCRbCgA4LZVzPmxl+8l1ravwvcX9 aMNBBC5shbjjgu4a/8cT7rR5fXh+i/xmAsoNoQZmK8I63V9gsL19+ewv/1yTnSyRGE7M kC6RZfsN/AEB4R2Ul32wf0MotnPvcMRZDH1rSCPr6ZfemPVUmn6owCBb8DmjCWh3mo8P CcLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bhXkKEjr; spf=pass (google.com: domain of linux-kernel+bounces-11581-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11581-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n9-20020a17090aab8900b0028c0037ef63si8555263pjq.148.2023.12.26.08.38.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 08:38:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11581-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bhXkKEjr; spf=pass (google.com: domain of linux-kernel+bounces-11581-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11581-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 39E3E2832BF for ; Tue, 26 Dec 2023 16:38:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0243E4F61E; Tue, 26 Dec 2023 16:38:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bhXkKEjr" X-Original-To: linux-kernel@vger.kernel.org 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 1FF7F4E62B; Tue, 26 Dec 2023 16:38:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22AA9C433C7; Tue, 26 Dec 2023 16:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703608684; bh=RxHy8+ihBu9w7EFvm3iGuBimY1BWS+E6JAT10AejE9U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bhXkKEjrhRBt0b+ZqhcMUP2ear3PjkkvDOZuNqXcWZpkTMHclVEfF7oDaYeN7skrz ZS+gPzFYDwBvztIMN1NezADGXvwEIHPG03lgLB0HFNyl7h3cfwJs5xZtD5nq7KsDYR xpPgWojDqcE82LR2Xi4L/+iM+Fm6opPbzI3DwJRVz2M/hJx4NBRQjMGtP8HuI1pwiY DVkh0yGIjF8x99COupGQPe1QXShSw4RAAapkIGtfYdn059f5OVOvo5CLtlHCL3IEbJ oNCi+ekVZAD4AqVPCcIn1PjobWHwstrEzfDh4EBYrFHg5fMF/u6uGHIAtDCg8KhKaQ eKuTLiziqjvZw== Date: Tue, 26 Dec 2023 09:38:02 -0700 From: Nathan Chancellor To: Bjorn Andersson Cc: Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] scripts/decode_stacktrace.sh: Support LLVM addr2line Message-ID: <20231226163802.GA952423@dev-arch.thelio-3990X> References: <20231225-decode-stacktrace-llvm-v1-1-abb9aa220cbf@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231225-decode-stacktrace-llvm-v1-1-abb9aa220cbf@quicinc.com> On Mon, Dec 25, 2023 at 10:52:57AM -0800, Bjorn Andersson wrote: > The kernel build system adhere to the LLVM environment variable, to > select building the kernel using clang/llvm. In combination with the > ARCH environment variable the kernel can be cross-compiled without the > user specifying the CROSS_COMPILE variable. > > The LLVM environment variable is used to specify the suffix of the llvm > executables (such as LLVM=-12 for llvm-addr2line-12), or to omit the > suffix when set to "1" (e.g. llvm-addr2line). > > decode_stacktrace.sh allows invoking a specific addr2line executable by > prefixing the command with CROSS_COMPILE. At best allows the user to > trick decode_stacktrace.sh into invoking llvm-addr2line, and it does not > support specifying an alternative version based on the suffix. > > Teach decode_stacktrace.sh about the two cases of the LLVM environment > variable, and use this to determine which addr2line to use. The current > behavior is maintained when the LLVM variable is not set. > > Signed-off-by: Bjorn Andersson Hmmm, this is the second patch to decode_stacktrace.sh in the same number of weeks... https://lore.kernel.org/20231215-llvm-decode-stacktrace-v1-1-201cb86f4879@quicinc.com/ Nick pointed out on that one that Carlos's patch from some time ago was even better at using all LLVM tools and requested testing/review on that one. https://lore.kernel.org/20230929034836.403735-1-cmllamas@google.com/ Furthermore, this patch does not handle the LLVM=/bin/ syntax that we support, which I personally use all the time. Cheers, Nathan > --- > scripts/decode_stacktrace.sh | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh > index 564c5632e1a2..adf1d64477a1 100755 > --- a/scripts/decode_stacktrace.sh > +++ b/scripts/decode_stacktrace.sh > @@ -16,6 +16,13 @@ elif type c++filt >/dev/null 2>&1 ; then > cppfilt_opts=-i > fi > > +# Determine which addr2line to use > +case "$LLVM" in > + "" ) addr2line="${CROSS_COMPILE}addr2line";; > + "1" ) addr2line="llvm-addr2line";; > + * ) addr2line="llvm-addr2line${LLVM}";; > +esac > + > if [[ $1 == "-r" ]] ; then > vmlinux="" > basepath="auto" > @@ -169,7 +176,7 @@ parse_symbol() { > if [[ $aarray_support == true && "${cache[$module,$address]+isset}" == "isset" ]]; then > local code=${cache[$module,$address]} > else > - local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address" 2>/dev/null) > + local code=$(${addr2line} -i -e "$objfile" "$address" 2>/dev/null) > if [[ $aarray_support == true ]]; then > cache[$module,$address]=$code > fi > > --- > base-commit: 39676dfe52331dba909c617f213fdb21015c8d10 > change-id: 20231225-decode-stacktrace-llvm-f260a1614361 > > Best regards, > -- > Bjorn Andersson > >