From patchwork Sat Sep 1 12:38:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 10584685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 345CA139B for ; Sat, 1 Sep 2018 12:39:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 244702A9CE for ; Sat, 1 Sep 2018 12:39:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15C782A9E2; Sat, 1 Sep 2018 12:39:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E8882A9CE for ; Sat, 1 Sep 2018 12:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=f3puv27t6lM8WaVsy4VyYkbMx1s17Hlyi5tGVq+YLP4=; b=dnp1STKp3sjb3W FY00OgRBI2/6Qxncoti+uCHWMOtamKLDbw57nbW7mF8ymRXtZY+7ylQwHpSo0sOd7mWl60JUX2J1h hKczzChk0+0OCAnKv5prFg7YOdlwutNWdCIpXsUz455cS5IWLWhcLrHZRuTBvO9jtTD3NwWE6xIva uHMDRm+JmaW+JQRdF2wMczoDfy7c/qYAedvxYPOvjGGMr54GIaVsvztN/JRsA7OkOftPhpXCCYY1z HGPDmVOvYDWOHn/8KkHfiRIHM4q6bO6exdbyAhqu+/1TWlP6aFVa+bPonPrGyPN3KtrlEORrBPbwX QM4vu5TyaDg7F7EbYNvw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fw5Ax-0004NC-FK; Sat, 01 Sep 2018 12:38:51 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fw5Au-0004M9-Rz for linux-arm-kernel@lists.infradead.org; Sat, 01 Sep 2018 12:38:50 +0000 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8A0962083B; Sat, 1 Sep 2018 12:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1535805517; bh=yrA8Izz7I4BDIPMaW2hIHPnRrsVRlQC9HKKS4CzJU/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=PiJ8uQL+uf8MHpHDFvAoXGy+BJH6Xl4Y8Not5xBf2K3olecPgt6IE5u6HdqMtGXEP cm6ivAdm7Q+SiLQVUscDETQVzMRrG/n0gOf5WYO2Tn4rXsUR4nDTiSG/YslKXz1hEb nCXQVyD6OkitpjBysHbvCLE0ZwyRXLLl41JtE1k4= From: Masami Hiramatsu To: Russell King Subject: [PATCH] ARM: linker script: GCOV kernel may refers data in __exit Date: Sat, 1 Sep 2018 21:38:13 +0900 Message-Id: <153580549235.10130.1495077983569784123.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180901185017.0a81bc3e61f5d021664f13f3@kernel.org> References: <20180901185017.0a81bc3e61f5d021664f13f3@kernel.org> In-Reply-To: <20180901185017.0a81bc3e61f5d021664f13f3@kernel.org> References: <20180901185017.0a81bc3e61f5d021664f13f3@kernel.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180901_053848_925864_59C2EB82 X-CRM114-Status: GOOD ( 13.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Pitre , Stephen Rothwell , Arnd Bergmann , linux-kernel@vger.kernel.org, Steven Rostedt , Linux-Next Mailing List , Masami Hiramatsu , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP GCOV kernel embeds counters in the kernel for each line and a part of that embed in __exit text. So we need to keep the __exit text if CONFIG_GCOV_KERNEL=y. Without this patch, if we discards __exit text (e.g. disables CONFIG_GENERIC_BUG, CONFIG_JUMP_LABEL and CONFIG_SMP_ON_UP) but enables CONFIG_GCOV_PROFILE_FTRACE, ld will error like below on ARM. `.text.exit' referenced in section `.ARM.exidx.text.exit' of kernel/trace/trace_clock.o: defined in discarded section `.text.exit' of kernel/trace/trace_clock.o To fix this issue, we keep __exit when CONFIG_GCOV_KERNEL=y. The reason why not depending CONFIG_GCOV_PROFILE_X, is that the Documentation/dev-tools/gcov.rst says that the developer can enable gcov profile on a file or a directory by customizing Makefile, and that will only depend on CONFIG_GCOV_KERNEL. Signed-off-by: Masami Hiramatsu Reported-by: Arnd Bergmann --- arch/arm/kernel/vmlinux.lds.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/kernel/vmlinux.lds.h index ae5fdff18406..baaacee9f5ce 100644 --- a/arch/arm/kernel/vmlinux.lds.h +++ b/arch/arm/kernel/vmlinux.lds.h @@ -9,7 +9,8 @@ #endif #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \ - defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL) + defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL) || \ + defined(CONFIG_GCOV_KERNEL) #define ARM_EXIT_KEEP(x) x #define ARM_EXIT_DISCARD(x) #else