Closed Bug 894829 Opened 11 years ago Closed 11 years ago

Avoid symbol resolution for relocations for the same symbol

Categories

(Core :: mozglue, defect)

All
Android
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: glandium, Assigned: glandium)

Details

Attachments

(1 file, 1 obsolete file)

The static linker usefully lays out relocations ordered by symbol, which means relocations for the same symbol are following each other. Instead of resolving the same symbol over and over, just resolve it once and reuse the resolved value subsequently.
This cuts startup by about 40 to 50ms on my nexus S, but this is without elfhack, so it might be less in reality. But it's an easy win.
With a brown-paper bag fix.
Attachment #777603 - Flags: review?(nfroyd)
Attachment #777001 - Attachment is obsolete: true
Attachment #777001 - Flags: review?(nfroyd)
Comment on attachment 777603 [details] [diff] [review]
Avoid symbol resolution for relocations for the same symbol in faulty.lib

Review of attachment 777603 [details] [diff] [review]:
-----------------------------------------------------------------

::: mozglue/linker/CustomElf.cpp
@@ +652,5 @@
>      /* Other relocation types need a symbol resolution */
> +    /* Avoid symbol resolution when it's the same symbol as last iteration */
> +    if (symtab_index != ELF_R_SYM(rel->r_info)) {
> +      symtab_index = ELF_R_SYM(rel->r_info);
> +      const Sym sym = symtab[ELF_R_SYM(rel->r_info)];

Nit: might as well use symtab_index here?
Attachment #777603 - Flags: review?(nfroyd) → review+
https://hg.mozilla.org/mozilla-central/rev/5435370944bf
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: