From patchwork Fri Jul 28 11:34:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 13331737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95BA9C001E0 for ; Fri, 28 Jul 2023 11:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235203AbjG1Le1 (ORCPT ); Fri, 28 Jul 2023 07:34:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233792AbjG1Le0 (ORCPT ); Fri, 28 Jul 2023 07:34:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BBCE19A1; Fri, 28 Jul 2023 04:34:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE78D6210D; Fri, 28 Jul 2023 11:34:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73CDBC433CD; Fri, 28 Jul 2023 11:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690544064; bh=11Y/2vUczXq1zex6nKxwrM3jqc49ICOzRUdx4wC2BY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O9WHnz15nlN8jrFYE+P5sHthvGhkzs5ETS0KFCk3serXXVpDV5I76lP4MNBw37yQ/ 17Hg0dBVemJ86i90tY0habw2oMXp/GhsH+NSXWik9eBjZYFMfbrVKLk3A6+X5nf97L 9glyR9vZzJ8R9zqkUHuqMU8rL2LQQaZ5TtbMn2QB+dz0vDM3jBNegR8jxlgUwKRrdR N3FpVx77t92pnHL5GnQg7TpKup2ZFANeiEgcl5KsoCQKH1O1srMvQoOOegosIs0qWa 0Zu5L1uFSu3Q297Hh9JOpqHTTyM/MI4P00aJUbsUaI7qOpUvHKAZ5lLLZ0h5P8sLSr g64rp59Zof+gg== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Josh Poimboeuf , John Stultz , linux-kbuild@vger.kernel.org Subject: [PATCH v3 1/4] scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1 Date: Fri, 28 Jul 2023 12:34:12 +0100 Message-Id: <20230728113415.21067-2-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230728113415.21067-1-will@kernel.org> References: <20230728113415.21067-1-will@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org GNU utilities cannot necessarily parse objects built by LLVM, which can result in confusing errors when using 'faddr2line': $ CROSS_COMPILE=aarch64-linux-gnu- ./scripts/faddr2line vmlinux do_one_initcall+0xf4/0x260 aarch64-linux-gnu-addr2line: vmlinux: unknown type [0x13] section `.relr.dyn' aarch64-linux-gnu-addr2line: DWARF error: invalid or unhandled FORM value: 0x25 do_one_initcall+0xf4/0x260: aarch64-linux-gnu-addr2line: vmlinux: unknown type [0x13] section `.relr.dyn' aarch64-linux-gnu-addr2line: DWARF error: invalid or unhandled FORM value: 0x25 $x.73 at main.c:? Although this can be worked around by setting CROSS_COMPILE to "llvm=-", it's cleaner to follow the same syntax as the top-level Makefile and accept LLVM=1 as an indication to use the llvm- tools. Cc: Josh Poimboeuf Cc: John Stultz Signed-off-by: Will Deacon --- scripts/faddr2line | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/faddr2line b/scripts/faddr2line index 0e73aca4f908..62a3fa6f6f59 100755 --- a/scripts/faddr2line +++ b/scripts/faddr2line @@ -58,8 +58,14 @@ die() { exit 1 } -READELF="${CROSS_COMPILE:-}readelf" -ADDR2LINE="${CROSS_COMPILE:-}addr2line" +if [ "${LLVM:-}" == "1" ]; then + UTIL_PREFIX=llvm- +else + UTIL_PREFIX=${CROSS_COMPILE:-} +fi + +READELF="${UTIL_PREFIX}readelf" +ADDR2LINE="${UTIL_PREFIX}addr2line" AWK="awk" GREP="grep" From patchwork Fri Jul 28 11:34:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 13331738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4366CC0015E for ; Fri, 28 Jul 2023 11:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233792AbjG1Lea (ORCPT ); Fri, 28 Jul 2023 07:34:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234904AbjG1Le3 (ORCPT ); Fri, 28 Jul 2023 07:34:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0BE42D5B; Fri, 28 Jul 2023 04:34:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 36184620FF; Fri, 28 Jul 2023 11:34:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3F31C433C8; Fri, 28 Jul 2023 11:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690544066; bh=q08Zp/HrT7heTstkuwX+BMifLSLWW6msQ6kNbV77Ua0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HQdHV/wp9RlqPD9y7oURfC5NiYE9B94pfY5qWKb1wh+dIya3UQtjS0OGzihi4wXS7 Ujw7ZskQgxU7XcGchqZbNK/U8wEM/V+3VEXF06kiOF3ERQVoFY32muocpULA0KkZC7 mOBtXc7YWbTknfzrg9H8oS8V2rM4deH2nrtmrsHwgBDj9OmEEv1dolhbZZfuG7qrFb KI3MOonCq09uBmLerRZjzWpxmKg5TO1GfNWe5MGDYH8nzTFHqiE6w4EbE3WRZsW31X oYmQs6BMM1LSGhJHsd8zFba47LYa7n7CbCTb8sMJP7C7U5ndcCflqoIk0LcXMbZiIN JH/ZJ8URUZCxw== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Josh Poimboeuf , John Stultz , linux-kbuild@vger.kernel.org Subject: [PATCH v3 2/4] scripts/mksysmap: Factor out sed ignored symbols expression into script Date: Fri, 28 Jul 2023 12:34:13 +0100 Message-Id: <20230728113415.21067-3-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230728113415.21067-1-will@kernel.org> References: <20230728113415.21067-1-will@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org To prepare for 'faddr2line' reusing the same ignored symbols list as 'mksysmap', factor out the relevant sed expression into its own script, removing the double-escapes for '$' symbols as they are no longer required. Cc: Masahiro Yamada Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Nicolas Schier Cc: Josh Poimboeuf Cc: John Stultz Cc: linux-kbuild@vger.kernel.org Signed-off-by: Will Deacon Reviewed-by: Nicolas Schier --- scripts/mksysmap | 77 +-------------------------------- scripts/sysmap-ignored-syms.sed | 74 +++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 76 deletions(-) create mode 100644 scripts/sysmap-ignored-syms.sed diff --git a/scripts/mksysmap b/scripts/mksysmap index 9ba1c9da0a40..a98b34363258 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -16,7 +16,7 @@ # 'W' or 'w'. # -${NM} -n ${1} | sed >${2} -e " +${NM} -n ${1} | sed >${2} -f $(dirname $0)/sysmap-ignored-syms.sed -e " # --------------------------------------------------------------------------- # Ignored symbol types # @@ -27,81 +27,6 @@ ${NM} -n ${1} | sed >${2} -e " # w: local weak symbols / [aNUw] /d -# --------------------------------------------------------------------------- -# Ignored prefixes -# (do not forget a space before each pattern) - -# local symbols for ARM, MIPS, etc. -/ \\$/d - -# local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc. -/ \.L/d - -# arm64 EFI stub namespace -/ __efistub_/d - -# arm64 local symbols in PIE namespace -/ __pi_\\$/d -/ __pi_\.L/d - -# arm64 local symbols in non-VHE KVM namespace -/ __kvm_nvhe_\\$/d -/ __kvm_nvhe_\.L/d - -# arm64 lld -/ __AArch64ADRPThunk_/d - -# arm lld -/ __ARMV5PILongThunk_/d -/ __ARMV7PILongThunk_/d -/ __ThumbV7PILongThunk_/d - -# mips lld -/ __LA25Thunk_/d -/ __microLA25Thunk_/d - -# CFI type identifiers -/ __kcfi_typeid_/d -/ __kvm_nvhe___kcfi_typeid_/d -/ __pi___kcfi_typeid_/d - -# CRC from modversions -/ __crc_/d - -# EXPORT_SYMBOL (symbol name) -/ __kstrtab_/d - -# EXPORT_SYMBOL (namespace) -/ __kstrtabns_/d - -# --------------------------------------------------------------------------- -# Ignored suffixes -# (do not forget '$' after each pattern) - -# arm -/_from_arm$/d -/_from_thumb$/d -/_veneer$/d - -# --------------------------------------------------------------------------- -# Ignored symbols (exact match) -# (do not forget a space before and '$' after each pattern) - -# for LoongArch? -/ L0$/d - -# ppc -/ _SDA_BASE_$/d -/ _SDA2_BASE_$/d - -# --------------------------------------------------------------------------- -# Ignored patterns -# (symbols that contain the pattern are ignored) - -# ppc stub -/\.long_branch\./d -/\.plt_branch\./d - # --------------------------------------------------------------------------- # Ignored kallsyms symbols # diff --git a/scripts/sysmap-ignored-syms.sed b/scripts/sysmap-ignored-syms.sed new file mode 100644 index 000000000000..14b9eb2c9ed9 --- /dev/null +++ b/scripts/sysmap-ignored-syms.sed @@ -0,0 +1,74 @@ +# --------------------------------------------------------------------------- +# Ignored prefixes +# (do not forget a space before each pattern) + +# local symbols for ARM, MIPS, etc. +/ \$/d + +# local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc. +/ \.L/d + +# arm64 EFI stub namespace +/ __efistub_/d + +# arm64 local symbols in PIE namespace +/ __pi_\$/d +/ __pi_\.L/d + +# arm64 local symbols in non-VHE KVM namespace +/ __kvm_nvhe_\$/d +/ __kvm_nvhe_\.L/d + +# arm64 lld +/ __AArch64ADRPThunk_/d + +# arm lld +/ __ARMV5PILongThunk_/d +/ __ARMV7PILongThunk_/d +/ __ThumbV7PILongThunk_/d + +# mips lld +/ __LA25Thunk_/d +/ __microLA25Thunk_/d + +# CFI type identifiers +/ __kcfi_typeid_/d +/ __kvm_nvhe___kcfi_typeid_/d +/ __pi___kcfi_typeid_/d + +# CRC from modversions +/ __crc_/d + +# EXPORT_SYMBOL (symbol name) +/ __kstrtab_/d + +# EXPORT_SYMBOL (namespace) +/ __kstrtabns_/d + +# --------------------------------------------------------------------------- +# Ignored suffixes +# (do not forget '$' after each pattern) + +# arm +/_from_arm$/d +/_from_thumb$/d +/_veneer$/d + +# --------------------------------------------------------------------------- +# Ignored symbols (exact match) +# (do not forget a space before and '$' after each pattern) + +# for LoongArch? +/ L0$/d + +# ppc +/ _SDA_BASE_$/d +/ _SDA2_BASE_$/d + +# --------------------------------------------------------------------------- +# Ignored patterns +# (symbols that contain the pattern are ignored) + +# ppc stub +/\.long_branch\./d +/\.plt_branch\./d From patchwork Fri Jul 28 11:34:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 13331739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5759CC00528 for ; Fri, 28 Jul 2023 11:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234904AbjG1Lei (ORCPT ); Fri, 28 Jul 2023 07:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236217AbjG1Lea (ORCPT ); Fri, 28 Jul 2023 07:34:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBE7530F5; Fri, 28 Jul 2023 04:34:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 879FB6211A; Fri, 28 Jul 2023 11:34:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AB64C433C9; Fri, 28 Jul 2023 11:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690544069; bh=ARjM/rczxk3PX8PtoECoSFwHH4d2kchH7iqw5zHKaMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aGRjKZctgpAez9JyZmIp+7xnTxyWs4j6DoLupOz05gTnl75i0k1/pPgpFP6fUQCe/ CQNmYenJ+QmcFLI5n0FpyE4LK9N2UqpxQMLk/UNLnWTVsdYUVzgt0afS/jh0gLykF6 FFenPhN+Ejypv937A0khJmKuj90SGLInsJgo53a3vtLAwtwlnrtl8Z1yzEStb5hW0B jKxrCPoTPXakpnPMbgrjkCzz9+656tB6SW63BjY6FUyiL58NnKOiJ3JWy1SnTt9pN1 hNn4LNpoyHm8sGQbue4fkkKPFKU6iBV1SgJsMbZp03dfVc1/wCfNLyK462Rji9GF+p Qa9mPD9i2uhLA== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Josh Poimboeuf , John Stultz , linux-kbuild@vger.kernel.org Subject: [PATCH v3 3/4] scripts/faddr2line: Constrain readelf output to symbols from System.map Date: Fri, 28 Jul 2023 12:34:14 +0100 Message-Id: <20230728113415.21067-4-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230728113415.21067-1-will@kernel.org> References: <20230728113415.21067-1-will@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Some symbols emitted in the readelf output but filtered from System.map can confuse the 'faddr2line' symbol size calculation, resulting in the erroneous rejection of valid offsets. This is especially prevalent when building an arm64 kernel with CONFIG_CFI_CLANG=y, where most functions are prefixed with a 32-bit data value in a '$d.n' section. For example: 447538: ffff800080014b80 548 FUNC GLOBAL DEFAULT 2 do_one_initcall 104: ffff800080014c74 0 NOTYPE LOCAL DEFAULT 2 $x.73 106: ffff800080014d30 0 NOTYPE LOCAL DEFAULT 2 $x.75 111: ffff800080014da4 0 NOTYPE LOCAL DEFAULT 2 $d.78 112: ffff800080014da8 0 NOTYPE LOCAL DEFAULT 2 $x.79 36: ffff800080014de0 200 FUNC LOCAL DEFAULT 2 run_init_process Adding a warning to do_one_initcall() results in: | WARNING: CPU: 0 PID: 1 at init/main.c:1236 do_one_initcall+0xf4/0x260 Which 'faddr2line' refuses to accept: $ ./scripts/faddr2line vmlinux do_one_initcall+0xf4/0x260 skipping do_one_initcall address at 0xffff800080014c74 due to size mismatch (0x260 != 0x224) no match for do_one_initcall+0xf4/0x260 Filter out entries from readelf using the 'sysmap-ignored-syms.sed' script used to construct System.map, so that the size of a symbol is calculated as a delta to the next symbol present in ksymtab. Cc: Josh Poimboeuf Cc: John Stultz Signed-off-by: Will Deacon --- scripts/faddr2line | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/faddr2line b/scripts/faddr2line index 62a3fa6f6f59..da734af90036 100755 --- a/scripts/faddr2line +++ b/scripts/faddr2line @@ -64,6 +64,7 @@ else UTIL_PREFIX=${CROSS_COMPILE:-} fi +IGNORED_SYMS=$(dirname $0)/sysmap-ignored-syms.sed READELF="${UTIL_PREFIX}readelf" ADDR2LINE="${UTIL_PREFIX}addr2line" AWK="awk" @@ -185,7 +186,7 @@ __faddr2line() { found=2 break fi - done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v sec=$sym_sec '$7 == sec' | sort --key=2) + done < <(${READELF} --symbols --wide $objfile | sed -f ${IGNORED_SYMS} -e 's/\[.*\]//' | ${AWK} -v sec=$sym_sec '$7 == sec' | sort --key=2) if [[ $found = 0 ]]; then warn "can't find symbol: sym_name: $sym_name sym_sec: $sym_sec sym_addr: $sym_addr sym_elf_size: $sym_elf_size" From patchwork Fri Jul 28 11:34:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 13331740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB5DEC0015E for ; Fri, 28 Jul 2023 11:34:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236303AbjG1Lex (ORCPT ); Fri, 28 Jul 2023 07:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236280AbjG1Leu (ORCPT ); Fri, 28 Jul 2023 07:34:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D259E3ABD; Fri, 28 Jul 2023 04:34:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D18F062113; Fri, 28 Jul 2023 11:34:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64DDAC433CA; Fri, 28 Jul 2023 11:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690544071; bh=GJfONZ1HCDvgFwQvE4AFHIvTONGQNDF8BXh10wDQUnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mPn9okbatt3a+j1vX38yIOJxpJjENOWB/nhMO9o9C6D4CeK1tYFlhJ5M2irJfplak nkqDoTzt3Y+Y6B9kzZ1FYVG+JHz6r2i53skj63N0xJIra8JlxOC97zF76nNlUzLSZ4 guIqS9ji9t6IwEh8PPWMK3rtPHmpqB/1YNxMoR87Okk94Y/ImwviIrnPR9UB4uq36W KelocNjmH/aRI8O62O7LR/yCe6/A8IwF/c2hoTTzTHb+8VpHDg/m5lpZollb3lKECz 3CwTmWFn0y9JKZ9RkAt11CG7ZjZhYz2J8yrHTO4jG8V1cHJqo+4u8XOlz4Xh+KF72V MmVOacDXx+7GA== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Josh Poimboeuf , John Stultz , linux-kbuild@vger.kernel.org Subject: [PATCH v3 4/4] scripts/faddr2line: Don't filter out non-function symbols from readelf Date: Fri, 28 Jul 2023 12:34:15 +0100 Message-Id: <20230728113415.21067-5-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230728113415.21067-1-will@kernel.org> References: <20230728113415.21067-1-will@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org As Josh points out in 20230724234734.zy67gm674vl3p3wv@treble: > Problem is, I think the kernel's symbol printing code prints the > nearest kallsyms symbol, and there are some valid non-FUNC code > symbols. For example, syscall_return_via_sysret. so we shouldn't be considering only 'FUNC'-type symbols in the output from readelf. Drop the function symbol type filtering from the faddr2line outer loop. Cc: Josh Poimboeuf Cc: John Stultz Link: https://lore.kernel.org/r/20230724234734.zy67gm674vl3p3wv@treble Signed-off-by: Will Deacon --- scripts/faddr2line | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/faddr2line b/scripts/faddr2line index da734af90036..47a010615903 100755 --- a/scripts/faddr2line +++ b/scripts/faddr2line @@ -267,7 +267,7 @@ __faddr2line() { DONE=1 - done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v fn=$sym_name '$4 == "FUNC" && $8 == fn') + done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v fn=$sym_name '$8 == fn') } [[ $# -lt 2 ]] && usage