Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp820595iob; Wed, 18 May 2022 13:50:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDDvpGYw4hgpL07xOyZnoFou82DkhaMrapSMING9LDh2JxSOD9l80uY2k0KfZaIzLKyHh0 X-Received: by 2002:a17:903:210:b0:15e:f139:f901 with SMTP id r16-20020a170903021000b0015ef139f901mr1447982plh.66.1652907017836; Wed, 18 May 2022 13:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652907017; cv=none; d=google.com; s=arc-20160816; b=kFWR7/3BKNSLlvXfe2oK9zPjXaXmJR5U1MuryOp0rLYIsuhX4k34PEHuqtKvtdFINN 6Pfje46kKkoZrv3sT+u4Kmy5kB2wa72YmRnlHYwqPnAA19zzF3fa8LIl6Ghpfm49Qy1X JeDXwYzE99kB0kklIhOoaot7J2nKBCzLTnp4Nvf4kbajy8WCPBItQWEf0Fn18DmUu4A3 gHtyMRb909SVExbQv3Vhbg82Vt+7Lh8YzWgCo5bfSuqB+vzxDD0cuKdYE1zKgTs88Vsx lh0XBIrx4r+86XPFXd/b1xRtTsf+WkDQKrfIdhaL/dSOi+2bVTuylbOxSbGfs5+urDv/ NbTQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=gruGbrdspyVPwoLyy8ln9ZbA/MAb51Topq/m47bRbzA=; b=UftlnTD9f4AfuEZnbfI6u+4up4atnbcqLP1/MueLATDgTuiDHWGY6Z/2YVxEfO1v6T 5lOm+R29I45LqtRtuIDD5P4zbbqUCUpb66rjMdEhZ/Ws6+lFzYNTmtQ4qTOnjzgnvwwP pK+JvV2+7VnSvEW+ThOsgWGBlUG6eqQUjpJcv0BevxsNBBbU2e+mZLKg83Iq9feprHIo XFHXaOvuQb91iu8hs7A8YZo83p2o7GGL62Iojd7yFh/TTnEaAhQ2X9v8Hr5XMhIy8jg4 5aNfgQycIssLFusZYEQ5REnQHMdTm+xbuJjULa87vO05XKwlK9mlWMf6BOCcjEpUkdNk oK5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="H9e/AGfg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l132-20020a633e8a000000b003f60899e6d2si3416144pga.832.2022.05.18.13.50.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 13:50:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="H9e/AGfg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CF53B16D120; Wed, 18 May 2022 13:47:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242666AbiERUrL (ORCPT + 99 others); Wed, 18 May 2022 16:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242665AbiERUrK (ORCPT ); Wed, 18 May 2022 16:47:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 387E3166091 for ; Wed, 18 May 2022 13:47:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B70AB820BD for ; Wed, 18 May 2022 20:47:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 270FDC385A9; Wed, 18 May 2022 20:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1652906826; bh=/rxYrjMqwNlL+24I8XRuVFiiERaiBmaRHgjd3WqHu8M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=H9e/AGfg9nDIZpmXwiwrXfey5wMS26IhfiwndlzuAflZx/V2poGYdYQMw6qMLGwMe tmL+pdqdr2nIUad1zE/pXjF2HENquMEFkTlPHZ+DkF9ir5T5uUZjvq0SmwsZHxauHU N5wtP3IFn/vFyQE2TWylQ1ADXUxyu5cq+zQ+p52I= Date: Wed, 18 May 2022 13:47:05 -0700 From: Andrew Morton To: "Naveen N. Rao" Cc: Michael Ellerman , Eric Biederman , , , kexec@lists.infradead.org Subject: Re: [PATCH] kexec_file: Drop weak attribute from arch_kexec_apply_relocations[_add] Message-Id: <20220518134705.7ae186d5419b24d689a38ccc@linux-foundation.org> In-Reply-To: <20220518181828.645877-1-naveen.n.rao@linux.vnet.ibm.com> References: <20220518181828.645877-1-naveen.n.rao@linux.vnet.ibm.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 May 2022 23:48:28 +0530 "Naveen N. Rao" wrote: > Since commit d1bcae833b32f1 ("ELF: Don't generate unused section > symbols") [1], binutils (v2.36+) started dropping section symbols that > it thought were unused. This isn't an issue in general, but with > kexec_file.c, gcc is placing kexec_arch_apply_relocations[_add] into a > separate .text.unlikely section and the section symbol ".text.unlikely" > is being dropped. Due to this, recordmcount is unable to find a non-weak > symbol in .text.unlikely to generate a relocation record against. > > Address this by dropping the weak attribute from these functions: > - arch_kexec_apply_relocations() is not overridden by any architecture > today, so just drop the weak attribute. > - arch_kexec_apply_relocations_add() is only overridden by x86 and s390. > Retain the function prototype for those and move the weak > implementation into the header as a static inline for other > architectures. > > ... > Sigh. This patch demonstrates why I like __weak :< > --- a/include/linux/kexec.h > +++ b/include/linux/kexec.h > @@ -229,6 +225,30 @@ extern int crash_exclude_mem_range(struct crash_mem *mem, > unsigned long long mend); > extern int crash_prepare_elf64_headers(struct crash_mem *mem, int kernel_map, > void **addr, unsigned long *sz); > + > +#if defined(CONFIG_X86_64) || defined(CONFIG_S390) Let's avoid listing the architectures here? Better to add select ARCH_HAVE_ARCH_KEXEC_APPLY_RELOCATIONS_ADD to arch//Kconfig? Please cc me on any additional work on this.