Closed Bug 628232 Opened 9 years ago Closed 9 years ago

Add thumb support for elfhack

Categories

(Firefox Build System :: General, defect)

ARM
Linux
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla2.0b11

People

(Reporter: glandium, Assigned: glandium)

Details

Attachments

(2 files)

Currently, elfhack doesn't support that the injected code is compiled as thumb. This is due to the pseudo linker considers the inject code entry point being 0x0, while it should be taken from the symbols table from the injected object (which would give a value of 0x1 when compiled as thumb).
This patch takes the actual value of the init symbol from the injected code object and uses it for DT_INIT instead of hardcoding 0, which was wrong when the injected is compiled as thumb.
Attachment #507099 - Flags: review?(tglek)
This removes the hack that forced the injected code to never be built as thumb.

With both patches, thumb code is supported as long as we inject arm-noinit.o and not arm.o. In the arm.o case, there's a R_ARM_THM_CALL relocation created that elfhack doesn't handle. I just hope we don't have to handle these just yet. Try will tell.
Attachment #507102 - Flags: review?(tglek)
(In reply to comment #2)
> Try will tell.

Try says it builds on maemo and android with these 2 patches only.
Comment on attachment 507099 [details] [diff] [review]
part 1 - Use the init symbol from elfhack injected code as an entry point instead of hardcoding 0

use stl find where you say // find in comments :)
Attachment #507099 - Flags: review?(tglek) → review-
Attachment #507102 - Flags: review?(tglek) → review+
Comment on attachment 507099 [details] [diff] [review]
part 1 - Use the init symbol from elfhack injected code as an entry point instead of hardcoding 0

mike says stl find is too bothersome
Attachment #507099 - Flags: review- → review+
Attachment #507099 - Flags: approval2.0?
Attachment #507102 - Flags: approval2.0?
These patches add proper support for thumb for the elfhack injected code. This was successfully tested on try in ceae7158f7f6.
(In reply to comment #6)
> These patches add proper support for thumb for the elfhack injected code. This
> was successfully tested on try in ceae7158f7f6.

Said differently, this makes the entire binary thumb when building for thumb, instead of having a small bit still compiled as arm.
Attachment #507099 - Flags: approval2.0? → approval2.0+
Attachment #507102 - Flags: approval2.0? → approval2.0+
http://hg.mozilla.org/mozilla-central/rev/072b2d4fa117
http://hg.mozilla.org/mozilla-central/rev/d99da3128e4f
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b11
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.