From: Tom Rini Date: Sun, 10 Feb 2019 08:16:10 -0500 Subject: [U-Boot] [PATCH] initcall: Move to inline function In-Reply-To: <34BDEC8E-73B3-474C-9BB5-2E4CD4A21B40@suse.de> References: <20190131150623.47464-1-agraf@suse.de> <4503365F-C0FE-4D5A-999E-CB325E6375EE@suse.de> <34BDEC8E-73B3-474C-9BB5-2E4CD4A21B40@suse.de> Message-ID: <20190210131610.GX16814@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, Feb 08, 2019 at 08:58:18AM +0100, Alexander Graf wrote: > > > > Am 08.02.2019 um 05:11 schrieb Simon Glass : > > > > Hi Alex, > > > >> On Sat, 2 Feb 2019 at 09:07, Alexander Graf wrote: > >> > >> > >> > >>> Am 02.02.2019 um 15:13 schrieb Simon Glass : > >>> > >>> Hi Alex, > >>> > >>>> On Thu, 31 Jan 2019 at 08:06, Alexander Graf wrote: > >>>> > >>>> The board_r init function was complaining that we are looping through > >>>> an array, calling all our tiny init stubs sequentially via indirect > >>>> function calls (which can't be speculated, so they are slow). > >>> > >>> Is this a compiler warning? Could you let me know what this is? > >> > >> It's the code comment I'm removing with this patch :). > >> > >>> > >>>> > >>>> The solution to that is pretty easy though. All we need to do is inline > >>>> the function that loops through the functions and the compiler will > >>>> automatically convert almost all indirect calls into direct inlined code. > >>> > >>> You mean it calls the functions one after the other without a > >>> function-table array? > >> > >> Exactly. Magical, eh? It even inlines them! > > > > Yes it is surprising. I am also surprised that it reduces code size, > > but I suppose that is why it does it. Presumably the inlining is what > > does that. > > Yes, of course. With separate object files, the compiler can not > inline anything at all, because it does not know how the function > pointers get used. > > The alternative to this *might* be LTO, which we could think about as > well. It should help reduce indirection and code size overall. But I > don't know how well gold works with the linker scripts we have. I don't object to LTO but there's a LOT of groundwork before it's an option. I think in addition to switching to gcc for ld, looking over an old git stash from when I tried this last, we need to globally switch to the "clang" method of keeping track of gd rather than how we do it today. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: