Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1948603ybb; Sat, 21 Mar 2020 09:13:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuWzZZOeK1/j95/nrwQZZXiXga1Q5LYYB0gJYCOeWrp6T7bTJ9HWrEkMr36/9PbHlM8nT1m X-Received: by 2002:a05:6830:451:: with SMTP id d17mr11233424otc.184.1584807226929; Sat, 21 Mar 2020 09:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584807226; cv=none; d=google.com; s=arc-20160816; b=jLpP0XRYtz51q+ol8QdyGZqSSZUhaoejvUfMeJl/FWSgM/gbgM3XcRwKVNR2zqzb8M x8cGKNT6nwFdmhMlfcDC/pI+W71FylZTkYmc4Rm2PArZ8Av3KrRDq4lzkt3ow5M89mjr +W6QqgOrZgGfilMPcDTESnrUo9d3Xe2xMeSYNoVMcKpwqWtTquwNsCCqpdu5kJ3b+iRf daf7Fd8FFjuw2R0AW1XIQEbUXhbvHMlEkGKclqZcGvuGIGiKHnfg8pULCzf5AxnWTScl NxiuFDgtKmhL3FiL9ZI8cF6s0ql9pprplqJgth+Gx86/CnZiEGlczdhB8hitPO3EEuDz lG2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rDHp5EkQVqal1KnnLcQv1KsG4j/TBGs8Jpkhs3ktxK0=; b=qmVPBxV2P4K/53MmbpN7QdXAt/bbqRDF/MudZqClGgui9hEb61cJU+cDM68O7aKCw2 zWXMwjQFafZkK6EhwU8Vz8pX/AwoTNgxBh10C5+41i0SvQzuhhJKXKahHByyLe1Ql+ys 8VbDZTg8xz16S/X2Ison7vr2UkW39RGXmfBehPbE6I4O9VS1v+PymyBBttZOMcEmlFEG uQOegv8+52Xnp+2zojz2n/yxP/kLnB9E+XU0vDzrUS3q6kfgCEmSJ5Ol6giyz3wNdfLY HKHVjMYq9HGiyrEsU/yaTbq3pCgf5yDF9mQGAtamiRJTF2D5Df5c2YEQd8KJmLRdDsij +/VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=HXtwAPOs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c23si4674824oic.53.2020.03.21.09.13.21; Sat, 21 Mar 2020 09:13:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=HXtwAPOs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727314AbgCUQL6 (ORCPT + 99 others); Sat, 21 Mar 2020 12:11:58 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44876 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727128AbgCUQL6 (ORCPT ); Sat, 21 Mar 2020 12:11:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=rDHp5EkQVqal1KnnLcQv1KsG4j/TBGs8Jpkhs3ktxK0=; b=HXtwAPOsfT+13uB7XIgG4qtOHz z/ve7Xn0NvjqHtqTnSKLQ3Yz7DzFg/PP3qLLkQ1vewmKWjEPJB+RI79N2dVmn2FNUN3PGFXQd8LB+ IQ9/vQciIg1V103pnfOafymjZhyjGdLVzS2QOUMM0c+JXt7v5w3xH+SqQjtmzeSlxpAUvw7/2hR/i x9Mva5axNRiL8IU5odbqCMin3JyYNfzFL962tB7PdgSiIVqe0Os+CrCURM4Pm+tS6ymjjPDcvzkH8 q1AR3sdPNFfUfPTF7Jy9UinuE+VyMrDFTC1NT0uAIa+LaICsMjLOxeAhtrMlS7EeT5H9kVyeLdfhf 353bILTw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jFgj4-0004AS-8d; Sat, 21 Mar 2020 16:11:54 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id C393E983502; Sat, 21 Mar 2020 17:11:51 +0100 (CET) Date: Sat, 21 Mar 2020 17:11:51 +0100 From: Peter Zijlstra To: Miroslav Benes Cc: tglx@linutronix.de, jpoimboe@redhat.com, linux-kernel@vger.kernel.org, x86@kernel.org, mhiramat@kernel.org, brgerst@gmail.com Subject: Re: [PATCH v2 17/19] objtool: Optimize !vmlinux.o again Message-ID: <20200321161151.GB3323@worktop.programming.kicks-ass.net> References: <20200317170234.897520633@infradead.org> <20200317170910.819744197@infradead.org> <20200318132025.GH20730@hirez.programming.kicks-ass.net> <20200321151421.GD2452@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200321151421.GD2452@worktop.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 21, 2020 at 04:14:21PM +0100, Peter Zijlstra wrote: > On Fri, Mar 20, 2020 at 05:20:47PM +0100, Miroslav Benes wrote: > > > I think there is one more missing in create_orc_entry(). > > I'm thikning you're quite right about that.... lemme see what to do > about that. --- --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -472,6 +472,14 @@ static int read_symbols(struct elf *elf) return -1; } +void elf_add_rela(struct elf *elf, struct rela *rela) +{ + struct section *sec = rela->sec; + + list_add_tail(&rela->list, &sec->rela_list); + elf_hash_add(elf->rela_hash, &rela->hash, rela_hash(rela)); +} + static int read_relas(struct elf *elf) { struct section *sec; @@ -519,8 +527,7 @@ static int read_relas(struct elf *elf) return -1; } - list_add_tail(&rela->list, &sec->rela_list); - elf_hash_add(elf->rela_hash, &rela->hash, rela_hash(rela)); + elf_add_rela(elf, rela); nr_rela++; } max_rela = max(max_rela, nr_rela); --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h @@ -127,6 +127,7 @@ struct section *elf_create_rela_section( int elf_rebuild_rela_section(struct section *sec); int elf_write(struct elf *elf); void elf_close(struct elf *elf); +void elf_add_rela(struct elf *elf, struct rela *rela); #define for_each_sec(file, sec) \ list_for_each_entry(sec, &file->elf->sections, list) --- a/tools/objtool/orc_gen.c +++ b/tools/objtool/orc_gen.c @@ -111,8 +111,7 @@ static int create_orc_entry(struct elf * rela->offset = idx * sizeof(int); rela->sec = ip_relasec; - list_add_tail(&rela->list, &ip_relasec->rela_list); - hash_add(elf->rela_hash, &rela->hash, rela_hash(rela)); + elf_add_rela(elf, rela); return 0; }