Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1246042pxb; Fri, 22 Jan 2021 10:27:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4YL3d0P3RlgpxUD0V2Dy8kTjG0J1GOAzsTessnCTLEeVOUzKhnt6SX8yXmoPTyPZR16JS X-Received: by 2002:a05:6402:1045:: with SMTP id e5mr4363727edu.40.1611340028740; Fri, 22 Jan 2021 10:27:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611340028; cv=none; d=google.com; s=arc-20160816; b=hHAr8Ja1Vh3EqTMmFhoaAwjlho9LfqeVo2GX6epu7Ck3HYCTIcxPbgwFBp7ypEadnc 0H/3fELl+lazfxmk8D4wv+OaMCVXQHdAJiaqFHLKu4Cg42eCs2lcT4u1316JlOcFnq01 XTTWt6N0HMp6Ez4Rf6VUlaTEEgh23UM68AFytdaF7rErRqotvBUR1ZyoP9HGsMkwlDtu NF6fbM5qE1Em1l0KwGBmEXAs9U9YNVcJPl6tXk3VMsjT0V0AoYc9a+jH+6fwSIZE3koA UZB/MaBIcF/Saabop9BScEtwfBmw2ThIFkfCtXo3kg3KBsZVr53qNv8vha5dXILSaAdn 7AkA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OyosjFD+nG4+cZ9XGUWnMvaGzy2W+8ZywjyRT1tWz94=; b=XBhqNgiCHOZ8JCnR5CWieqvPg7D6WcZO0LQlYZtdXbUr4tvP/p0lPDFxr6wNv7fTfd WL+mS1dfvhiOzAHifw2MzVZBSKTvtPFydlbCAMEPXOIx41o/Jlw6A1Of3nWLumG/xi1T JSuWE001YPb0Kk/rReqIa0phGldPONWnaDpAjkoyMQZzk5nI/9nmChHLignzKqLcO7VM YDwdBSlzz/huqpnaq3SfyAm8YVSvjAALQQgbZVlOgoGTqlP/bkn2FCVq6imlxkIKd303 iKQR7R8dsJzQ17lLP1Buo3wpgCrLrQkwB8gqEpHW87BZCLH1llAcha3p+Hb31G019IS8 a5Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VmMAAGHj; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm24si3886588edb.590.2021.01.22.10.26.44; Fri, 22 Jan 2021 10:27: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=@linuxfoundation.org header.s=korg header.b=VmMAAGHj; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730061AbhAVSYW (ORCPT + 99 others); Fri, 22 Jan 2021 13:24:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:39962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728568AbhAVOXA (ORCPT ); Fri, 22 Jan 2021 09:23:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5771123B70; Fri, 22 Jan 2021 14:16:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611325013; bh=2unsYnbqU3VXbkIxy0M8gfwixFW5ttWx8J23aoYZiHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmMAAGHjvP3A32fZUAYDPkfVOu0rEaL87xKBSml9pVNFUzV7JAGAjpNkYrlqqAahm rkNKhzW6Us7hdbMswy22O6H8gfwYQa4Pm5a9xZFS4nqIbX1xGFTUhJiBKn2qQbW2rN HpJoglTt3Y3Na+3uqO1eL1Jy9GDylAGCc5yQghtk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Barret Rhoden , Andrew Morton , Linus Torvalds , Jian Cai Subject: [PATCH 5.4 04/33] elfcore: fix building with clang Date: Fri, 22 Jan 2021 15:12:20 +0100 Message-Id: <20210122135733.751633696@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135733.565501039@linuxfoundation.org> References: <20210122135733.565501039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit 6e7b64b9dd6d96537d816ea07ec26b7dedd397b9 upstream. kernel/elfcore.c only contains weak symbols, which triggers a bug with clang in combination with recordmcount: Cannot find symbol for section 2: .text. kernel/elfcore.o: failed Move the empty stubs into linux/elfcore.h as inline functions. As only two architectures use these, just use the architecture specific Kconfig symbols to key off the declaration. Link: https://lkml.kernel.org/r/20201204165742.3815221-2-arnd@kernel.org Signed-off-by: Arnd Bergmann Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Barret Rhoden Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Cc: Jian Cai Signed-off-by: Greg Kroah-Hartman --- include/linux/elfcore.h | 22 ++++++++++++++++++++++ kernel/Makefile | 1 - kernel/elfcore.c | 26 -------------------------- 3 files changed, 22 insertions(+), 27 deletions(-) --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h @@ -58,6 +58,7 @@ static inline int elf_core_copy_task_xfp } #endif +#if defined(CONFIG_UM) || defined(CONFIG_IA64) /* * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out * extra segments containing the gate DSO contents. Dumping its @@ -72,5 +73,26 @@ elf_core_write_extra_phdrs(struct coredu extern int elf_core_write_extra_data(struct coredump_params *cprm); extern size_t elf_core_extra_data_size(void); +#else +static inline Elf_Half elf_core_extra_phdrs(void) +{ + return 0; +} + +static inline int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset) +{ + return 1; +} + +static inline int elf_core_write_extra_data(struct coredump_params *cprm) +{ + return 1; +} + +static inline size_t elf_core_extra_data_size(void) +{ + return 0; +} +#endif #endif /* _LINUX_ELFCORE_H */ --- a/kernel/Makefile +++ b/kernel/Makefile @@ -93,7 +93,6 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayac obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o obj-$(CONFIG_TRACEPOINTS) += tracepoint.o obj-$(CONFIG_LATENCYTOP) += latencytop.o -obj-$(CONFIG_ELFCORE) += elfcore.o obj-$(CONFIG_FUNCTION_TRACER) += trace/ obj-$(CONFIG_TRACING) += trace/ obj-$(CONFIG_TRACE_CLOCK) += trace/ --- a/kernel/elfcore.c +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include -#include -#include -#include - -Elf_Half __weak elf_core_extra_phdrs(void) -{ - return 0; -} - -int __weak elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset) -{ - return 1; -} - -int __weak elf_core_write_extra_data(struct coredump_params *cprm) -{ - return 1; -} - -size_t __weak elf_core_extra_data_size(void) -{ - return 0; -}