Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4064882pxb; Mon, 8 Feb 2021 07:09:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPQBvi4Z3diWjpd+Xt6zGTrVqaAuvjfS9djMWA4+/wRe5JnT76yzMSJUF1XB5DCwSIGVKD X-Received: by 2002:aa7:c78e:: with SMTP id n14mr17443367eds.31.1612796961901; Mon, 08 Feb 2021 07:09:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612796961; cv=none; d=google.com; s=arc-20160816; b=k1DCNqA8gHc0yuRb3xmidR31cHxcbUSkka8+20XYNlxtbKTBsNwS1AcwAH3rQiHHgt CvrGTQa7LjFFv52fSjFO/dWDXOlltfFemsHdjYBFq0Iftf7PmTHwAIWFPY4LTx+2J7/6 wBCWOCTuPK0BsT9sKQI/yilH1mRkT7we7aJJF2hk8NgYag8p9qLlJlhwgRi1bI2mIkM8 BswxMcFW4SQ0n0WEeKrCJG0jRhCZ+2EZ16iPmXPNHk3vvrLblvCKCRXnusJlsqh0wHah iw1SP1gEl4t2kzCc5t3fhHQTUvnF6BAxakK6Bn886wh08n06CcegjbHDvGap+521qh5q GHmA== 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=mbUWFrQF3wEb8RZbm3pEkul251nLk96m6ifxfG3c0ZU=; b=ftsFTKU42X7kx2zWqgK2njCK/tXmhoC3tPgZlmjqXKJNKrwYZIwMofL3WEjo0kk+Xh Yx5DzWLHWkZuWQY7JYjl7gvXgqmbWAkXXi8I2SRj9e4JOn/i7sfockEw5ixPcGtVVCx1 eXpTyJu01UXH3XLJE6rUOtqFXUUHvXJa3OjTiXGW5GG4DEWhPa8EeuEmpU2i89ibLjSZ 2ZaAI2pB01B8Lp+s3T4xjQh3vNvXmaF/kEuSQVAqXMMCWWJVeA64oEsFgr1Jt99M1/aI Kf/3nUdFOiPWxgaj14wAUnmoukJD55LH43dtxgco0iJ9NmQe5OtJoB59U1Ek7ZKoxXtl POPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eI27AJY9; 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 b9si11147995edt.398.2021.02.08.07.08.43; Mon, 08 Feb 2021 07:09:21 -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=eI27AJY9; 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 S232072AbhBHPGF (ORCPT + 99 others); Mon, 8 Feb 2021 10:06:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:51778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232380AbhBHPDU (ORCPT ); Mon, 8 Feb 2021 10:03:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2FA964EB7; Mon, 8 Feb 2021 15:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612796555; bh=KVhmUdS4Zyo2qiysiPo3/3eJXXQ/2cbzLr1owaatF9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eI27AJY95Ic+vg+6+7M2cvyvJ4f8tuS9C7mMALUaaDxuDqTQjCOEPnmH4s6xQzhG3 lcgBY5KYxoN4DReOmJRxu6c/twP9qMf/vT9CXPKr8Nz3ZOnoJEesQXZKTZmzsW2rjp lfplzd3SRJBbDMGwxkcDNSZHnWbzPEyaYDHSdp28= 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.4 22/38] elfcore: fix building with clang Date: Mon, 8 Feb 2021 16:00:44 +0100 Message-Id: <20210208145806.154119176@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210208145805.279815326@linuxfoundation.org> References: <20210208145805.279815326@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 | 25 ------------------------- 3 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 kernel/elfcore.c --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h @@ -55,6 +55,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 @@ -69,5 +70,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 @@ -77,7 +77,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,25 +0,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; -}