Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4405505rwo; Tue, 25 Jul 2023 05:48:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlHfpJogt2AGjDsnnd6fI8DYcAbXZM7ph46DJhkYW6+sbtDLk17qZjPhGdqK0TjDd/crPCXg X-Received: by 2002:a17:903:1106:b0:1b6:4bbd:c3a7 with SMTP id n6-20020a170903110600b001b64bbdc3a7mr12230959plh.66.1690289338045; Tue, 25 Jul 2023 05:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690289338; cv=none; d=google.com; s=arc-20160816; b=QHUjovw8VHAUT/noJcA8hEnRxhOuMxUnOA/GaMEm1Z5bovH9rUZ1WzK9lU5Xcwjjmx /tPIpkKbt/bvAz84hZxkXXiFBW3B6Lxz8mOknx2yrgy+ZtDBKsw3pM96Jz19zajKPIWj StTBwN+8j/DBVJtrTMIugMfSqgek6AVNCpRRHn7zcSZWrhTK5AkMmIln4sGJSdJH0BE0 Dzg2vBLnq2yJ/jOAiQfmxddJQmJvRK7l3b+JCmVkiW7t/iyhuW5Ga88ip4xKYrTzkTkR w9oshAECGDR41mc8enHV06w1ZMKS4j5V2PwWd1Nkd9PjG26tzZEsrTEBIx9BXPHeIA1p FeOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dBfOJF6wcyEPKiOzCRlb+/ZINYObsi7uGBUstRjgH30=; fh=bt+fV2PXxyEb5lcXBBKB9gibR5cwjHwaRwIF76B6+JE=; b=GTs+HfT+W1TdS3YNwpo2X3C98kgzD83bqGbsnctlZkG5aMpRq4cv1/Jnhd7764NJ1h 7aMLR+L7RKx84B4tDRQKmw9ztpfVhj5bSCRxYBRkfFZhVjDKzh6I9u+8jcuIFGRgtEwI eyinGindCIpwSCft9NR7SfdgfanAfFPwu5acphhYK2iH9pCkvG1Ous1IMSrgE3xBVsKf 0PhzgTQG5WB/OV51lBLEoc7fv6hJ11CbB0xs5OAmhLeWlfcpPF6A3haJzF4jK3oeMZOL qTg78xHu2NtcivwV5Q1F7iMFLyiv/mP2mbqO9CMhW/npqUWKGtfM+Fdzlx9GtZtN9oas YaUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=DtG2frtE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2-20020a170902e54200b001b8847d973fsi12496317plf.219.2023.07.25.05.48.24; Tue, 25 Jul 2023 05:48:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=DtG2frtE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231948AbjGYL4V (ORCPT + 99 others); Tue, 25 Jul 2023 07:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231203AbjGYL4U (ORCPT ); Tue, 25 Jul 2023 07:56:20 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C848A10E5 for ; Tue, 25 Jul 2023 04:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=dBfOJF6wcyEPKiOzCRlb+/ZINYObsi7uGBUstRjgH30=; b=DtG2frtEcur0dl4kw7KmlXLL/V Y32gvAmJDdksIdSKqKhsLYZGclgrNx4kwQ87OjklPNs5C/AcOn3sP2QL8hGt9fVRNieDxbJI4lRNb 1UsgqHv95//JaPdS9DtuS/LYXcxFdkjQGGZEKt8+G3EU7zf1oXiwvU6wQkar0YsfRzx/uLxhUqheT I7Nf5tM51Ei0nrDpEXhujzfP7fjN602/khhGUDLPaGwal/12wATkXfXVtbBBJUGL63IyCFySLl5ab VffY2sB8tVNupxRRqoPDeNuDjYd2cVLm3/vxCK4RafzYoXOx+nUOoGJjnf+ymiu492qvMtqNMndyZ mREs4DYQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qOGeA-005RAh-54; Tue, 25 Jul 2023 11:56:10 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 2C37B3001FD; Tue, 25 Jul 2023 13:56:10 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 114C12612ABE5; Tue, 25 Jul 2023 13:56:10 +0200 (CEST) Date: Tue, 25 Jul 2023 13:56:09 +0200 From: Peter Zijlstra To: Tiezhu Yang Cc: Josh Poimboeuf , Huacai Chen , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: Re: [PATCH v1 4/6] objtool/LoongArch: Enable orc to be built Message-ID: <20230725115609.GD3765278@hirez.programming.kicks-ass.net> References: <1690272910-11869-1-git-send-email-yangtiezhu@loongson.cn> <1690272910-11869-5-git-send-email-yangtiezhu@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1690272910-11869-5-git-send-email-yangtiezhu@loongson.cn> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 Tue, Jul 25, 2023 at 04:15:08PM +0800, Tiezhu Yang wrote: > +void arch_write_orc(struct elf *elf, struct orc_entry *orc) > +{ > + orc->ra_offset = bswap_if_needed(elf, orc->ra_offset); > +} This hardly 'writes' anything, all it does is a bswap. > diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c > index 1eff7e0a..6975056 100644 > --- a/tools/objtool/orc_gen.c > +++ b/tools/objtool/orc_gen.c > @@ -14,6 +14,8 @@ > #include > #include > > +void __weak arch_write_orc(struct elf *elf, struct orc_entry *orc) {} And for that you need a weak function? What's wrong with an inline if anything? > static int write_orc_entry(struct elf *elf, struct section *orc_sec, > struct section *ip_sec, unsigned int idx, > struct section *insn_sec, unsigned long insn_off, > @@ -26,6 +28,7 @@ static int write_orc_entry(struct elf *elf, struct section *orc_sec, > memcpy(orc, o, sizeof(*orc)); > orc->sp_offset = bswap_if_needed(elf, orc->sp_offset); > orc->bp_offset = bswap_if_needed(elf, orc->bp_offset); > + arch_write_orc(elf, orc); Why can't this simply be: orc->ra_offset = bswap_if_needed(elf, orc->ra_offset); AFAICT this won't actually do anything for x86 and I don't think Power got around to doing ORC yet. > > /* populate reloc for ip */ > if (!elf_init_reloc_text_sym(elf, ip_sec, idx * sizeof(int), idx, Again, not much explaination for why you did things