From patchwork Mon Feb 8 15:00:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 378562 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp4768602jah; Mon, 8 Feb 2021 07:16:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvVhTQsnlL8nXe/DJoOS2I0+dREVc4YeRRhqpf/ERnD/+W0IXQNKB9V7ChO9sVjudE9qdo X-Received: by 2002:a17:906:46ce:: with SMTP id k14mr17741757ejs.480.1612797393613; Mon, 08 Feb 2021 07:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612797393; cv=none; d=google.com; s=arc-20160816; b=B5anEHKU4I6UOiDw9X0rjve7StLaLgrkwHGeCHGGnV4jgTTw1qmC9zfoQf8tZMSHyh 0RHEedHBTFGWlygByomEQQvp3FQUw20LOFvPwiI9SByKgGjt1VUhI6gDcgc0gQI/Acpg xsKOSDbJoLelVrMsik20z9uJLM7zPx/LIpEp0PI29qPesszf+hoBietlvKBQ4clslQ51 KYYcsGOtwGJJcTH0WXGl0Zx+m3uZ6+dU4AA5n9+ny1oZ0ek9jU+BNoVa0XpF2Rn5O3bq L0RKUKA9ttgEbUREdx2VdourHAqK/DGx0PsOP01mrbJFWhhPpLQmb0NG1DjOviTP+UyZ A7Vg== 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=1UkZipK2+oFG19cExgw15yHSXZK3pJLmZiIPEPH1/J4=; b=NycylDuzGyeyTtAuLhJtrnhyrwNS8ta94gVr1yw8gukhMp/vSznkX5kW5eenf1D+Br Tc0qmu8x115YU85xMshT6sbIGM7jznuW3/1YRGYkq6GR+K9/YrN5ODn7VmESoUbH3uU0 JLqvMHmkIGQQOxQp1UI0MonFcIUrDGkykIzj0SlRQcM9szsrG/e1UMKT2WhvEF8MlFe7 aNb3X0USilYYaMyUJ1R9jcMkj/KLyzK09Pm4p499VaA+PetE3RShPJKtIrhOzw64jj5D gFEtQc6q+9riDF0xRa5sxXESgriRyn0O5RsCEpPDnwPkrr31X+W3rJYSekAdVtDHA/YO Wygg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CKXiigX/"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 k3si13131522eds.581.2021.02.08.07.16.33; Mon, 08 Feb 2021 07:16:33 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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="CKXiigX/"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S232135AbhBHPP0 (ORCPT + 13 others); Mon, 8 Feb 2021 10:15:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:55768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231995AbhBHPLj (ORCPT ); Mon, 8 Feb 2021 10:11:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 578A264EE7; Mon, 8 Feb 2021 15:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612796920; bh=NqXv7MiDfSAas23UZ7y5XWx6QI+fE1q6ngNEVJcUs3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CKXiigX/D4PjKQ71sup2VXp02mT6xHOBgajJwrVONL5IkkvXSYRsFAUT4spGGAoIe 0B8LXKFlcv9ns3H6VbAPZ0nS2YqXaFcubQ6M2RS0GxAFvsWJ/nKk+MsID70+7GuwmG 8KCXI7tOOnJCpN0LB9C80diB7OjNRtbm9UPMU8qA= 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 Subject: [PATCH 4.19 04/38] elfcore: fix building with clang Date: Mon, 8 Feb 2021 16:00:51 +0100 Message-Id: <20210208145806.310937132@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210208145806.141056364@linuxfoundation.org> References: <20210208145806.141056364@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 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(-) delete mode 100644 kernel/elfcore.c --- 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 @@ -92,7 +92,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; -}