On 18 August 2016 at 15:46, Richard Henderson <r...@twiddle.net> wrote: > On 08/18/2016 07:14 AM, Peter Maydell wrote: >> While we're on the subject, can somebody explain to me why we >> use ifuncs at all? I couldn't work out why it would be better than >> just using a straightforward function pointer -- when I tried single >> stepping through things the ifunc approach still seemed to indirect >> through some table or other so it wasn't actually resolving to >> a direct function call anyway.
> No reason, I suppose. > > It's particularly helpful for libraries, where we don't really want the > overhead of the initialization when it's not used. Ah, I see. > But (1) we don't have many of these and (2) we really don't care *that* much > about startup time. > > So a simple function pointer initialized by a constructor has the same > effect. That seems like it would be a worthwhile change since (a) I think it's easier to understand than ifunc magic (b) it means we don't unnecessarily restrict ourselves to a libc with ifunc support (musl libc doesn't do ifuncs, for instance) thanks -- PMM