Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4106511pxb; Mon, 8 Feb 2021 08:06:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxtqtj6eELhb5cRWA/Q10Aju4108m/xdBnRXnW1BWDNLxqUbBBi+NayipVfLkeRk/zL//u X-Received: by 2002:a50:eb49:: with SMTP id z9mr8452155edp.234.1612800377095; Mon, 08 Feb 2021 08:06:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612800377; cv=none; d=google.com; s=arc-20160816; b=YD4GM4L50VM17lnGDY03Q1ZC8l3RUQ8Zgz/gHkqcOHdnrOkLbPthHWg98qtXKzT1he H+5F8jhKd0LsNSQhezFLNWEllBiDU04WhUJJIZrj+Ol+IW0PDq1s7M43eJyhTH9DxMXd wCeaZYxN+DC5ZiPxoRAbeI1w+N/HNjnTn0Vq0fmTrePCTqMjdnrJII6UcQozJKr1yaBA etVNNL29zlvu301UXUHNkVYk1JuWyFMR0kE9CgE++5mmhwPFUt2N88mWglEjfrgk8+wS ebNf7XyGU3uXwmM0N3tJfijM0hvNjBekghc5O0uqMFLy7AjrOwwBTBkLCjMr/dC59G8Z 4cBQ== 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=nr1D1SVwU//4PLHDXwuvQgaVQJx/uHc0B7FiWcXUsEY=; b=ammiL8xHw88WK4qbEEgwu+u+X+jXmkiuNbpPOItEhXpfsJn+WQx2bfDGNz128bH6Bv CBkiqtDXrGV/UUV0z0dci5YoN/XQ1isQUjk57ZzYFd4ki660mweQ/0wzC6BJI2wFTXT4 wjFZkSW8nWVgt/IqoLbaTSrFncmRJlnqJaOWwCL4Dg7sAY41nk7WrxX/rSx+mebeqX3y NWul/pVSe80DywgPYX7V6xp6rzRjl/9WsErlkHOaQaXwIzcp91eSlCRHsoh8uXoo2QL2 fGrCLRmLH79ButEuQvnZiN9d7oOX96olm+refy+bDnPVXXg+L4bod9rpB9wWALSyXOKf p+1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2I0R7qVI; 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 i8si4694290edg.104.2021.02.08.08.05.51; Mon, 08 Feb 2021 08:06:17 -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=2I0R7qVI; 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 S230217AbhBHQC1 (ORCPT + 99 others); Mon, 8 Feb 2021 11:02:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:56630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232200AbhBHPKS (ORCPT ); Mon, 8 Feb 2021 10:10:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 85D8F64ED4; Mon, 8 Feb 2021 15:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612796835; bh=7QAP6juxWHp+KETu5g2tT4DiAtwc6vaVDvyDdb2MMKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2I0R7qVI65eG9T7mMro/04iWLSH0QBcHjxP1f4q/OTHmakpMhmvd07TEt4xVGfn4n sM+bPLGgKNAPm+2bMOl/0P8yEicL0q1lZRo6S0m4WxqgZYFAuX30gHhCX8wZWjOpA1 10PZ+aINuzVRCrSXIjTv22miQmX57UqdhfFcwttQ= 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.14 08/30] elfcore: fix building with clang Date: Mon, 8 Feb 2021 16:00:54 +0100 Message-Id: <20210208145805.582779586@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210208145805.239714726@linuxfoundation.org> References: <20210208145805.239714726@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 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 @@ -90,7 +90,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; -}