[gold][patch] Small code refactoring

Rafael Espindola espindola@google.com
Fri Feb 13 16:31:00 GMT 2009


> Actually, I think you are taking slightly the wrong approach here.  The
> two cases have different error handling behaviour--that's why they wound
> up being different.  In the archive case, if it's not an ELF file, we
> fail immediately.  In the readsyms case, we go on to check for a linker
> script.

That is still the case with the patch.  The new make_elf_object will
return null. The archive case will fail an the readsyms
case will check for an script.

> Also, your version calls get_view twice in the normal case.  gold gets a
> surprising amount of its speed by carefully avoiding these sorts of
> micro-deoptimizations in the normal case.  I spent a lot of time
> profiling to find them.

That is true. The get_view is cached, no?

> One approach here would be to write a predicate is_elf_object which
> takes read_size and ehdr and returns whether it looks like ELF.  Then if
> is_elf_object returns true, call make_elf_object.

I can try that, but one of the things I like about my patch is that it
makes the make_elf_object interface a bit simpler.

> Thanks for looking at this.
>
> Ian
>

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047



More information about the Binutils mailing list