From patchwork Fri Mar 12 09:55:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 12134079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ADD8C433DB for ; Fri, 12 Mar 2021 09:56:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 231A665070 for ; Fri, 12 Mar 2021 09:56:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233006AbhCLJ4A (ORCPT ); Fri, 12 Mar 2021 04:56:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232834AbhCLJzm (ORCPT ); Fri, 12 Mar 2021 04:55:42 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9338EC061574; Fri, 12 Mar 2021 01:55:41 -0800 (PST) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1lKeW2-00F7m8-Jg; Fri, 12 Mar 2021 10:55:30 +0100 From: Johannes Berg To: linux-kernel@vger.kernel.org, linux-um@lists.infradead.org Cc: Jessica Yu , Alexander Viro , linux-fsdevel@vger.kernel.org, Johannes Berg Subject: [PATCH 5/6] um: fix CONFIG_GCOV for built-in code Date: Fri, 12 Mar 2021 10:55:25 +0100 Message-Id: <20210312104627.9355049045fe.Ie4896d26d2a4e1116c760cdb91087a1817807ca6@changeid> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210312095526.197739-1-johannes@sipsolutions.net> References: <20210312095526.197739-1-johannes@sipsolutions.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Johannes Berg With contemporary toolchains, CONFIG_GCOV doesn't work because gcov now relies on both init and exit handlers, but those are discarded from the binary. Fix the linker scripts to keep them instead, so that CONFIG_GCOV can work again. Note that this does not make it work in modules yet, since we don't call their exit handlers. Signed-off-by: Johannes Berg --- arch/um/include/asm/common.lds.S | 2 ++ arch/um/kernel/vmlinux.lds.S | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S index eca6c452a41b..1223dcaaf7e3 100644 --- a/arch/um/include/asm/common.lds.S +++ b/arch/um/include/asm/common.lds.S @@ -84,11 +84,13 @@ .init_array : { __init_array_start = .; *(.init_array) + *(.init_array.*) __init_array_end = .; } .fini_array : { __fini_array_start = .; *(.fini_array) + *(.fini_array.*) __fini_array_end = .; } diff --git a/arch/um/kernel/vmlinux.lds.S b/arch/um/kernel/vmlinux.lds.S index 16e49bfa2b42..2245ae4907d2 100644 --- a/arch/um/kernel/vmlinux.lds.S +++ b/arch/um/kernel/vmlinux.lds.S @@ -1,6 +1,8 @@ KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER); +#define RUNTIME_DISCARD_EXIT + #ifdef CONFIG_LD_SCRIPT_STATIC #include "uml.lds.S" #else