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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 46888C433FE for ; Fri, 8 Apr 2022 18:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pH4ILETTz+ltyS8GBMa5gaB2d69RP+Va9nqfzyHhLtI=; b=NEs2SePlKuINl1 3pbLpsVEc8ZdUPLrLLt2MbEYNuBDJm55iTHPkVWSux0qGZxGfYEbpdtsZBlsFWrRqgna4UrJX2muv N4JqI6N6aWEdYP7XJpiNdyPRay5Ogz3p5xkvqwi9T13xTqfxZno14IPmTKeoCiGACa8tXaaTmNzJJ tXhnPkP+/LhEayb1XdfNn9wAyyarEbMNB7q28u77RINEZPxUPfCUH7qRsGBKQpbE1hVTdTCOYaXwI 7LjEVoRHNSJ/uRJOSCN18Ymy9s6A5XYXcnE+v6YBfBHQ+7N7o6YylURDgd2VoIqA4TMSgmFmgsvId iY8vdrzb+5Qb8EOrvqwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nctUB-000yHS-Ju; Fri, 08 Apr 2022 18:37:31 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nctU8-000yH2-4Z for linux-arm-kernel@lists.infradead.org; Fri, 08 Apr 2022 18:37:29 +0000 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 5D9856223E; Fri, 8 Apr 2022 18:37:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67CD0C385A3; Fri, 8 Apr 2022 18:37:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649443046; bh=1uXXyszSBW6TxLDCg2SpXvfmXvgsFQ3XelZPfe9dclg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lVr0pHkput3V17t4p4Zw+wHKrxZ1zobZRBRCeH9VsQIEBn0fYKKNQdLRDbelZJ6fc a9YJ2m0PZtySXjd+tGEM3rF+EBrD7L8f+tiRtal376Al7pElKK4fTxybZYaBJI7YPS RTTkWplXJbSmvHPxz3Lqr2/GpHZIwvz6OZt+46nW1qIBZHteXBhw0dE6fU7ClZibW/ T3ZV/sT0SBx8Ff6AS6CI1IPMbtVmWexAl2Ony5aSiA3rQ3ndphm5yBP87WPyrnK3LB /fgSui91kiWFk1iWoRff6TM60op/ktnNAUJoSOS/LaYGGuwhrl3BE3JUhLLzdxzir+ XvZPsdt+rkjLw== Date: Fri, 8 Apr 2022 11:37:24 -0700 From: Nathan Chancellor To: Will Deacon Cc: Mark Rutland , linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, keescook@chromium.org, ardb@kernel.org Subject: Re: allmodconfig builds failing to link on arm64 Message-ID: References: <20220408115407.GA27685@willie-the-truck> <20220408161344.GA28108@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220408_113728_299293_B6882E86 X-CRM114-Status: GOOD ( 22.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Apr 08, 2022 at 10:17:21AM -0700, Nathan Chancellor wrote: > On Fri, Apr 08, 2022 at 05:13:44PM +0100, Will Deacon wrote: > > Damn, sorry for the mis-diagnosis then. I only just started seeing it, but > > thinking about it I _usually_ build with LLVM=1 which probably rules out > > binutils entirely. For some reason, I ended up in the mixed case today > > and ran into this. > > > > In any case, it would be good to get it resolved and I'm happy to test out > > any fixes. > > I came up with the following diff. I could make the second "depends on" > line a little more readable by splitting it out to two different symbols > such as GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS and > CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS, which lines up with Linus' > preference here: A sample of what that might look like is below. Additionally, I think I understand why this is happening now. We turned on the integrated assembler by default in 5.15, even with just "CC=clang", see commit f12b034afeb3 ("scripts/Makefile.clang: default to LLVM_IAS=1"). When __patchable_function_entries was implemented in clang 10.0.0, Fangrui added a follow-up change that generated different section flags based on whether or not the integrated assembler was being used, due to binutils deficiencies at the time that did not exist in the integrated assembler or ld.lld: https://github.com/llvm/llvm-project/commit/7fa5290d5bd5632d7a36a4ea9f46e81e04fb819e This did not account for the fact that someone might use the integrated assembler with GNU ld. That case was rarely triggered prior to the Linux commit though, as people would either use: $ make CC=clang (clang, GNU as, GNU ld) $ make LLVM=1 (clang, GNU as, ld.lld) $ make LLVM=1 LLVM_IAS=1 (clang, integrated assembler, ld.lld) which would mean that the integrated assembler and GNU ld were never used together, unless someone used "CC=clang LLVM_IAS=1", which clearly no one ever did :) After the default change on the Linux side, we end up with: $ make CC=clang (clang, integrated assembler, GNU ld) $ make LLVM=1 (clang, integrated assembler, ld.lld) $m ake LLVM=1 LLVM_IAS=1 (equivalent to above) The first case is the one we are running into right now. I included this assembler dependency below, which should handle clang 11 and 12 and the follow up change in clang 13+: https://github.com/llvm/llvm-project/commit/853a2649160c1c80b9bbd38a20b53ca8fab704e8 I'll run it through a full set of build tests and wait for some feedback before sending formally, just to make sure I am on the right track. Cheers, Nathan diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 57c4c995965f..1fd16faa7f31 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -175,8 +175,6 @@ config ARM64 select HAVE_DEBUG_KMEMLEAK select HAVE_DMA_CONTIGUOUS select HAVE_DYNAMIC_FTRACE - select HAVE_DYNAMIC_FTRACE_WITH_REGS \ - if $(cc-option,-fpatchable-function-entry=2) select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \ if DYNAMIC_FTRACE_WITH_REGS select HAVE_EFFICIENT_UNALIGNED_ACCESS @@ -228,6 +226,17 @@ config ARM64 help ARM 64-bit (AArch64) Linux support. +config CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS + def_bool CC_IS_CLANG + # https://github.com/ClangBuiltLinux/linux/issues/1507 + depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600)) + select HAVE_DYNAMIC_FTRACE_WITH_REGS + +config GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS + def_bool CC_IS_GCC + depends on $(cc-option,-fpatchable-function-entry=2) + select HAVE_DYNAMIC_FTRACE_WITH_REGS + config 64BIT def_bool y _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel