From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80488C25B0E for ; Tue, 16 Aug 2022 14:04:44 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4M6Xvt41ksz3bmc for ; Wed, 17 Aug 2022 00:04:42 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=srs0=mgjk=yu=goodmis.org=rostedt@kernel.org; receiver=) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4M6XvR24Kpz3bc9 for ; Wed, 17 Aug 2022 00:04:19 +1000 (AEST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 2742B60FA3; Tue, 16 Aug 2022 14:04:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACAB4C433C1; Tue, 16 Aug 2022 14:04:15 +0000 (UTC) Date: Tue, 16 Aug 2022 10:04:23 -0400 From: Steven Rostedt To: "Naveen N. Rao" Subject: Re: [PATCH 0/2] ftrace/recordmcount: Handle object files without section symbols Message-ID: <20220816100423.5ee2e17c@gandalf.local.home> In-Reply-To: References: X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: llvm@lists.linux.dev, Nick Desaulniers , linux-kernel@vger.kernel.org, Nathan Chancellor , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, 27 Apr 2022 15:01:20 +0530 "Naveen N. Rao" wrote: > This solves a build issue on powerpc with binutils v2.36 and newer [1]. > Since commit d1bcae833b32f1 ("ELF: Don't generate unused section > symbols") [2], binutils started dropping section symbols that it thought > were unused. Due to this, in certain scenarios, recordmcount is unable > to find a non-weak symbol to generate a relocation record against. > > Clang integrated assembler is also aggressive in dropping section > symbols [3]. > > In the past, there have been various workarounds to address this. See > commits 55d5b7dd6451b5 ("initramfs: fix clang build failure") and > 6e7b64b9dd6d96 ("elfcore: fix building with clang") and a recent patch: > https://lore.kernel.org/linuxppc-dev/20220425174128.11455-1-naveen.n.rao@linux.vnet.ibm.com/T/#u > > Fix this issue by using the weak symbol in the relocation record. This > can result in duplicate locations in the mcount table if those weak > functions are overridden, so have ftrace skip dupicate entries. > > Objtool already follows this approach, so patch 2 updates recordmcount > to do the same. Patch 1 updates ftrace to skip duplicate entries. > > - Naveen > > > [1] https://github.com/linuxppc/issues/issues/388 > [2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1 > [3] https://github.com/ClangBuiltLinux/linux/issues/981 > > There's been work to handle weak functions, but I'm not sure that work handled the issues here. Are these patches still needed, or was there another workaround to handle the problems this addressed? -- Steve