Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1914133pxb; Wed, 10 Feb 2021 22:17:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJy09ZsAvy9I/4nV9ra2KQgw5Uf7DXTDMTvck+D+dVKHcFkM2OF7gMTTC85j2nLGUI7uWtjj X-Received: by 2002:a17:906:6b02:: with SMTP id q2mr6811942ejr.122.1613024228486; Wed, 10 Feb 2021 22:17:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613024228; cv=none; d=google.com; s=arc-20160816; b=B9nertG/bG0bUkXuteEFnCpkzLc2YO+QgDDluFbSIGBKJCd+X79WfmVaYMKYqUoeUN eyxXEw7kkUsW0Qg3W7+WDNNmOW/7+Xux9Zmi0CzjJpXoZGraQVg2UQwMuLjl0yjzFdd6 9p833ssk8zmmvTRFVCBlqSouQBTxm6MQcTzdv3Ay8Vt9QUH6hFUi55awwT/CCSNhfmca lxwHGH9OAGdTwaSYnvQjPHv6/Lw8qpdyB5VR+pZm/3b1ptuS3uwwDK/4baoC+QkrcD5K JRTJTUQhIHig7eZTsbmQghYmlu6lwKo9TK4CG6gSddsF3pPBQMf2IEFobiIyMXg86eRY E4ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=jGTzkZH/trtyFuuFzWsVpFh/JBCkhkOXTqBjHWcukIs=; b=WqAciICXZTS7ThRn4iNYD5KsxJbkoKnpDr1xmotCTq59U6vIG+xKnNdCi7ed/AHdEG Zlgp18+sfGHAypARzzDcaf2zCcnPOlJx6bOdrP7xylkbzefOYvHZbKreL+LAysKGpIhm Smu4gi3ppaWLl7lIBDjyfLPxYmr15y7mEJZDCy1DsWwJIVdytNCDXIiDUjsZu+kTJ0sb 2Oys9RsARiCTfq3REeUInHKYMxGpCg8/y0kPFXCT24w4ACcG8kdI1XLgd0FNqDAQP7ar 8dFUtdXnYCjBFVNhLcwuoKyhapLv0qyQhJPU1+s84mmq0Y0D85VQfbZ0U4qTtJd4uKpn pxvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=g8fj8Z7Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jj13si2918401ejc.60.2021.02.10.22.16.45; Wed, 10 Feb 2021 22:17:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=g8fj8Z7Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229647AbhBKGPk (ORCPT + 99 others); Thu, 11 Feb 2021 01:15:40 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:17872 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbhBKGPj (ORCPT ); Thu, 11 Feb 2021 01:15:39 -0500 Received: from oscar.flets-west.jp (softbank126026094251.bbtec.net [126.26.94.251]) (authenticated) by conuserg-07.nifty.com with ESMTP id 11B6EG4R023930; Thu, 11 Feb 2021 15:14:17 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 11B6EG4R023930 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1613024057; bh=jGTzkZH/trtyFuuFzWsVpFh/JBCkhkOXTqBjHWcukIs=; h=From:To:Cc:Subject:Date:From; b=g8fj8Z7Qz9Se1kaKjDKpSlER2ahG5fnR9g7ixWnsvQ0MThrah5h/jWwqn4DkIrl+e 5OBI4RRDGBgiFT5FsbT0rehP09MsSXjLWBvFPd9Wjfz6Cs2JHzfx5WMeDrc+3xqfYm jWFKP6E1wJfdr35Yc6l/JJzAbowThaqo7LiJ3FL1t6aiU0g/uZpHY4wuLnIsZZZfCB o/TdZYZGaP4jjOV1gH08+WRzn8ozGoIu5KIFKHe5U9h7WB0xug/ZeOUIZogI0GzjEV +9tGz8sXrGJGZ0+wOyUxdXR4nREnJCLwZ+TJMVuJfENTEQj5t3fBWbp7O1pVqDpDt2 9MvXcqfW7h8yw== X-Nifty-SrcIP: [126.26.94.251] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Stephen Rothwell , Jessica Yu , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: fix CONFIG_TRIM_UNUSED_KSYMS build for ppc64 Date: Thu, 11 Feb 2021 15:14:16 +0900 Message-Id: <20210211061416.3747231-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Stephen Rothwell reported a build error on ppc64 when CONFIG_TRIM_UNUSED_KSYMS is enabled. Jessica Yu pointed out the cause of the error with the reference to the ppc64 elf ABI: "Symbol names with a dot (.) prefix are reserved for holding entry point addresses. The value of a symbol named ".FN", if it exists, is the entry point of the function "FN". As it turned out, CONFIG_TRIM_UNUSED_KSYMS has never worked for ppc64, which has been unnoticed until recently because this option depends on !UNUSED_SYMBOLS hence is disabled by all{mod,yes}config. (Then, it was uncovered by another patch removing UNUSED_SYMBOLS.) Removing the dot prefix in scripts/gen_autoksyms.sh fixes the issue. Please note it must be done before 'sort -u', because modules have both ._mcount and _mcount undefined when CONFIG_FUNCTION_TRACER=y. Link: https://lore.kernel.org/lkml/20210209210843.3af66662@canb.auug.org.au/ Reported-by: Stephen Rothwell Signed-off-by: Masahiro Yamada --- scripts/gen_autoksyms.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh index 16c0b2ddaa4c..d54dfba15bf2 100755 --- a/scripts/gen_autoksyms.sh +++ b/scripts/gen_autoksyms.sh @@ -43,6 +43,9 @@ EOT sed 's/ko$/mod/' $modlist | xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | cat - "$ksym_wl" | +# Remove the dot prefix for ppc64; symbol names with a dot (.) hold entry +# point addresses. +sed -e 's/^\.//' | sort -u | sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$output_file" -- 2.27.0