Received: by 10.223.176.5 with SMTP id f5csp1242032wra; Sat, 3 Feb 2018 22:55:13 -0800 (PST) X-Google-Smtp-Source: AH8x2262tLQyU13Klurd4w9j8xV9sumVFNN8a/5M1FvD7qaoxAvD1XzZBQ+z0wmViKyFPCExMcLX X-Received: by 10.98.213.198 with SMTP id d189mr2703127pfg.136.1517727313235; Sat, 03 Feb 2018 22:55:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517727313; cv=none; d=google.com; s=arc-20160816; b=PYJN1M+gvHVRnuy6rBTNx8YjmzbJyvLSArSTal5fhmjru+KFkVkT5eCBS7qNnzUKqF o6qEYLNpQuRRSUpFztqedpidMB83SGKfdTeMWAMM5bIP/Nf2MD8NV8jcVIdCrjBS2Yai bmQPBe4UCMjxTO1VMtjrCobJQHwG/VRBbRa3s159/TYBgWAVphhfgF8ERY2Lv+bWhghx 4+l/TEcsVSHos+1LMFhml6hCKU9XrReo+BQnn09R9SRgB8doUONx7aZvFljMJ8aR8Dds iOENmcKVklRh5Np+RNWD9cZsOXKdPirtVdugRIDt0l13g3Ot1PwiH/T2YJOFcPzyBoq3 JHlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=xfahsofHCWXbwaM3ycvzRUj4Vkx0PeiFUrf2C+t5E6M=; b=ZlrxT3yPEtam+bOvjgg3R3C1tdkhF7Qp78xVHzte9BMM0F8i3JLpa7GrJu0N84PCkY M26q8yLdHrwnG8Kr1Hk2ZGY6GlLPg3qPuuampazepIb/wE3PoIQozcwS7vwax3aYK/25 5q0/FOxXw40Ny1gd7IBn6bYdipwsGo1M3qqEGFxpo7H8tsmGB40ek5Z/5w2BRS7+DAtj oEH7coAgrygLbj7CwoxSO7DqUzve4r9VWgoFFqq+j0RP0PEVyExicIaSRuE9PuoKwHBk Bpwa4um1HsVmb2jxICSnLXBGdferKBVMkDlt6k0toq9TpalmMwnIZBTtyalEJHXjiei6 zWYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a91-v6si4887194pla.657.2018.02.03.22.54.23; Sat, 03 Feb 2018 22:55:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750868AbeBDGry (ORCPT + 99 others); Sun, 4 Feb 2018 01:47:54 -0500 Received: from mga12.intel.com ([192.55.52.136]:60049 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750747AbeBDGrs (ORCPT ); Sun, 4 Feb 2018 01:47:48 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Feb 2018 22:47:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,458,1511856000"; d="scan'208,217";a="24541414" Received: from sofia.sh.intel.com (HELO sofia) ([10.239.147.120]) by orsmga003.jf.intel.com with ESMTP; 03 Feb 2018 22:47:45 -0800 Date: Sun, 4 Feb 2018 14:46:58 +0800 From: "Liu, Changcheng" To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, kstewart@linuxfoundation.org, neilb@suse.com, tglx@linutronix.de, akpm@linux-foundation.org, torvalds@linux-foundation.org, alexander.levin@verizon.com Subject: Re: [PATCH 4.14 103/156] scripts/faddr2line: extend usage on generic arch Message-ID: <20180204064658.GA12094@sofia> References: <20180202140840.242829545@linuxfoundation.org> <20180202140844.857269882@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180202140844.857269882@linuxfoundation.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg Kroah-Hartman, Below commit is needed to resolve issue in this patch: Upstream commit 4cc90b4cc3d4955f79eae4f7f9d64e67e17b468e B.R. Changcheng On 17:58 Fri 02 Feb, Greg Kroah-Hartman wrote: > 4.14-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: "Liu, Changcheng" > > > [ Upstream commit 95a87982541932503d3f59aba4c30b0bde0a6294 ] > > When cross-compiling, fadd2line should use the binary tool used for the > target system, rather than that of the host. > > Link: http://lkml.kernel.org/r/20171121092911.GA150711@sofia > Signed-off-by: Liu Changcheng > Cc: Kate Stewart > Cc: NeilBrown > Cc: Thomas Gleixner > Cc: Greg Kroah-Hartman > Signed-off-by: Andrew Morton > Signed-off-by: Linus Torvalds > Signed-off-by: Sasha Levin > Signed-off-by: Greg Kroah-Hartman > --- > scripts/faddr2line | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > --- a/scripts/faddr2line > +++ b/scripts/faddr2line > @@ -44,9 +44,16 @@ > set -o errexit > set -o nounset > > +READELF="${CROSS_COMPILE}readelf" > +ADDR2LINE="${CROSS_COMPILE}addr2line" > +SIZE="${CROSS_COMPILE}size" > +NM="${CROSS_COMPILE}nm" > + > command -v awk >/dev/null 2>&1 || die "awk isn't installed" > -command -v readelf >/dev/null 2>&1 || die "readelf isn't installed" > -command -v addr2line >/dev/null 2>&1 || die "addr2line isn't installed" > +command -v ${READELF} >/dev/null 2>&1 || die "readelf isn't installed" > +command -v ${ADDR2LINE} >/dev/null 2>&1 || die "addr2line isn't installed" > +command -v ${SIZE} >/dev/null 2>&1 || die "size isn't installed" > +command -v ${NM} >/dev/null 2>&1 || die "nm isn't installed" > > usage() { > echo "usage: faddr2line ..." >&2 > @@ -69,10 +76,10 @@ die() { > find_dir_prefix() { > local objfile=$1 > > - local start_kernel_addr=$(readelf -sW $objfile | awk '$8 == "start_kernel" {printf "0x%s", $2}') > + local start_kernel_addr=$(${READELF} -sW $objfile | awk '$8 == "start_kernel" {printf "0x%s", $2}') > [[ -z $start_kernel_addr ]] && return > > - local file_line=$(addr2line -e $objfile $start_kernel_addr) > + local file_line=$(${ADDR2LINE} -e $objfile $start_kernel_addr) > [[ -z $file_line ]] && return > > local prefix=${file_line%init/main.c:*} > @@ -104,7 +111,7 @@ __faddr2line() { > > # Go through each of the object's symbols which match the func name. > # In rare cases there might be duplicates. > - file_end=$(size -Ax $objfile | awk '$1 == ".text" {print $2}') > + file_end=$(${SIZE} -Ax $objfile | awk '$1 == ".text" {print $2}') > while read symbol; do > local fields=($symbol) > local sym_base=0x${fields[0]} > @@ -156,10 +163,10 @@ __faddr2line() { > > # pass real address to addr2line > echo "$func+$offset/$sym_size:" > - addr2line -fpie $objfile $addr | sed "s; $dir_prefix\(\./\)*; ;" > + ${ADDR2LINE} -fpie $objfile $addr | sed "s; $dir_prefix\(\./\)*; ;" > DONE=1 > > - done < <(nm -n $objfile | awk -v fn=$func -v end=$file_end '$3 == fn { found=1; line=$0; start=$1; next } found == 1 { found=0; print line, "0x"$1 } END {if (found == 1) print line, end; }') > + done < <(${NM} -n $objfile | awk -v fn=$func -v end=$file_end '$3 == fn { found=1; line=$0; start=$1; next } found == 1 { found=0; print line, "0x"$1 } END {if (found == 1) print line, end; }') > } > > [[ $# -lt 2 ]] && usage > >