Closed Bug 1525510 Opened 6 years ago Closed 6 years ago

elfhack causes PGO'd Android builds to crash when loading libxul.so

Categories

(Firefox Build System :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(firefox-esr60 wontfix, firefox65 wontfix, firefox66 wontfix, firefox67 fixed)

RESOLVED FIXED
mozilla67
Tracking Status
firefox-esr60 --- wontfix
firefox65 --- wontfix
firefox66 --- wontfix
firefox67 --- fixed

People

(Reporter: mshal, Assigned: glandium)

References

Details

(Whiteboard: [geckoview:p1] [geckoview:fenix:p2])

Attachments

(1 file)

I'm testing out PGO-enabled Android builds by generating an instrumented build (with -fprofile-generate=/data/local/tmp), and triggering the profile data writing by sending a signal to the native process via adb since the normal Android process shutdown doesn't call atexit() handlers. This gets us profile data for libxul.so, at least, which is then used on a subsequent build with -fprofile-use. Just mentioning this since these are differences from Linux PGO builds, which way or may not be relevant.

Unfortunately the final profile-use build crashes on startup when loading libxul.so, which glandium traced to a weird jump instruction in elfhack. Re-building the profile-use stage with --disable-elf-hack makes the crash go away, but we will ultimately need a fix in elfhack.

The problem is the address difference between the elfhack-inject code and the location of the original init function in libxul is too large for ARM instructions. Elfhack would need to detect this is the case and inject a trampoline, or something akin to this.

Assignee: nobody → mh+mozilla

Can you test the attached patch?

Flags: needinfo?(mshal)
OS: Unspecified → Android
Hardware: Unspecified → ARM
Whiteboard: [geckoview:p1] [geckoview:fenix:p2]

Yep, that works for me. Thanks for the quick fix!

Flags: needinfo?(mshal)
Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/94ab0cf7c69f Add a trampoline to call original_init when it's not possible directly. r=froydnj
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: