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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90554C433EF for ; Sat, 21 May 2022 10:57:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237382AbiEUK5b (ORCPT ); Sat, 21 May 2022 06:57:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235388AbiEUK51 (ORCPT ); Sat, 21 May 2022 06:57:27 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C96C580D7 for ; Sat, 21 May 2022 03:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=J/wgaEZZPzTbr+Xe8tD8yBF1WihgmlBahTE13m1ErG0=; b=QvqJ/Te08o3S0En7DTuvQtGdBy PTlNWP8rCToOfbw95crDdvNcDSGr+0ZJ2KO3LFvqgNjgfNv/vfpNYr3nwMVg3BtKt79cWeIdzCr/i JJUPjI8O+s4P4haCaPRlbJkQHbdw20zrXjs7rcGdUlnO6pZPFALmR7CUbgDPonoZCMsa2wSEPSx6g Qa61+TCrQYSst0qOcKrqVwRGstWehT4/dPr1f3Y42gQSgE3LUKuYZZG2rRzQKA5i6RfRGC+a80X6s 0nzKCW7Nj7tcysZg4GAmxSJggDrOddUS6lh3p9zccF/VH3781qSrf9MK/WEZVhP7Uhew3xHnqkLlj tzzQAMsQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nsMnA-000D1N-Uh; Sat, 21 May 2022 10:57:05 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 75EB6980E99; Sat, 21 May 2022 12:57:04 +0200 (CEST) Date: Sat, 21 May 2022 12:57:04 +0200 From: Peter Zijlstra To: Christophe Leroy Cc: Josh Poimboeuf , Josh Poimboeuf , "aik@ozlabs.ru" , "linux-kernel@vger.kernel.org" , "rostedt@goodmis.org" , "naveen.n.rao@linux.vnet.ibm.com" , "linuxppc-dev@lists.ozlabs.org" , Sathvika Vasireddy Subject: Re: [RFC PATCH 3/3] objtool/mcount: Add powerpc specific functions Message-ID: <20220521105704.GE2578@worktop.programming.kicks-ass.net> References: <20220318105140.43914-1-sv@linux.ibm.com> <20220318105140.43914-4-sv@linux.ibm.com> <0b55f122-4760-c1ba-840a-0911cefec2ad@csgroup.eu> <20220328195920.dqlfra3lcardko6r@treble> <20220512151206.dphxz5jyeshwc4jb@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 21, 2022 at 09:38:35AM +0000, Christophe Leroy wrote: > I gave it a try this morning, I selected HAVE_OBJTOOL and > HAVE_OBJTOOL_MCOUNT from arch/powerpc/Kconfig > > > Seems like there are still some x86 arch specific stuff in common common > code and I get the following errors. I'm assuming there's a metric ton of x86 specific stuff in there. That'll take a while to clean out. Mostly Josh's rewrite was centered around splitting out the runtime options, but objtool is still always build with all options included, even the ones you're not using for your arch, which is what's triggering the problems you see here, I suppose... > Also, is it normal to get those functions built allthough I have not > selected HAVE_STACK_VALIDATION ? > > CC /home/chleroy/linux-powerpc/tools/objtool/check.o > check.c: In function 'has_valid_stack_frame': > check.c:2369:30: error: 'CFI_BP' undeclared (first use in this > function); did you mean 'CFI_SP'? > 2369 | if (cfi->cfa.base == CFI_BP && > | ^~~~~~ > | CFI_SP > check.c:2369:30: note: each undeclared identifier is reported only once > for each function it appears in > check.c:2371:44: error: 'CFI_RA' undeclared (first use in this > function); did you mean 'CFI_R3'? > 2371 | check_reg_frame_pos(&cfi->regs[CFI_RA], > -cfi->cfa.offset + 8)) > | ^~~~~~ > | CFI_R3 > check.c: In function 'update_cfi_state': > check.c:2499:70: error: 'CFI_BP' undeclared (first use in this > function); did you mean 'CFI_SP'? > 2499 | if (op->src.reg == CFI_SP && > op->dest.reg == CFI_BP && > | > ^~~~~~ > | > CFI_SP > make[3]: *** [/home/chleroy/linux-powerpc/tools/build/Makefile.build:97: > /home/chleroy/linux-powerpc/tools/objtool/check.o] Error 1 > make[2]: *** [Makefile:54: > /home/chleroy/linux-powerpc/tools/objtool/objtool-in.o] Error 2 > make[1]: *** [Makefile:69: objtool] Error 2 > make: *** [Makefile:1337: tools/objtool] Error 2 > > > What would be the best approach to fix that ? Define CFI_BP to your frame register (r2, afaict) I suppose. If you're only using OBJTOOL_MCOUNT this code will never run, so all you have to ensure is that it compiles, not that it makes sense (-: The very long and complicated way would be to propagate the various CONFIG_HAVE_* build time things to the objtool build and librally sprinkle a lot of #ifdef around.