Attempting to run xpcshell tests on Android 5+ fails with "error: only position independent executables (PIE) are supported."

RESOLVED FIXED in Firefox 55

Status

()

Firefox for Android
Testing
P1
normal
RESOLVED FIXED
8 months ago
6 months ago

People

(Reporter: JanH, Assigned: gbrown)

Tracking

Trunk
Firefox 55
All
Android
Points:
---

Firefox Tracking Flags

(firefox54 wontfix, firefox55 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

8 months ago
I assume this happens when you try running xpcshell tests on a physical device running Android 5.0 or newer (my phone runs 6.0.1).
(Assignee)

Comment 1

8 months ago
I think the issue is we don't build PIE versions of xpcshell (or cppunit tests).
See Also: → bug 1238611
(Assignee)

Updated

8 months ago
Priority: -- → P3
(Assignee)

Updated

7 months ago
Assignee: nobody → gbrown
Priority: P3 → P1
(Assignee)

Comment 2

7 months ago
In review, PIE is required on Android 5.0 and up. PIE will not work on Android 4.0 and earlier.

It seems unlikely that anyone would be particularly interested in running xpcshell on Android 4.0, so the plan here is to just build xpcshell as PIE, dropping support for xpcshell on Android 4.0 and earlier.
(Assignee)

Comment 3

7 months ago
https://treeherder.mozilla.org/#/jobs?repo=try&revision=3b111aa2a1d3d97f0c2c1fd457cc1383502b546d
(Assignee)

Updated

7 months ago
Summary: Attempting to run xpcshell tests locally fails with "error: only position independent executables (PIE) are supported." → Attempting to run xpcshell tests on Android 5+ fails with "error: only position independent executables (PIE) are supported."
(Assignee)

Comment 4

7 months ago
Simpler: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9f903aaa37d53799d9253448e8e4111c0140c612
(Assignee)

Comment 5

7 months ago
Created attachment 8844921 [details] [diff] [review]
build Android xpcshell as PIE

My intention here is to only affect xpcshell, and only on Android.

The resulting executable works for me in local tests on Android 4.3 and Android 6.0, and continues to work on try.
Attachment #8844921 - Flags: review?(mh+mozilla)
Comment on attachment 8844921 [details] [diff] [review]
build Android xpcshell as PIE

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

::: js/xpconnect/shell/moz.build
@@ +50,5 @@
>          'xul.dll',
>      ]
>  
> +if CONFIG['OS_TARGET'] == 'Android':
> +    LDFLAGS += ['-fPIE']

You don't need -fPIE, only -pie.

With that said, considering https://developer.android.com/about/dashboards/index.html says there's only 2% of devices with < 4.1, is there a reason we simply don't enable pie globally for android builds (and drop support for < 4.1)?

This would allow to get rid of the workaround we have in place to support both PIE and non-PIE for the plugin-container executable.
Attachment #8844921 - Flags: review?(mh+mozilla)
(Assignee)

Comment 7

7 months ago
:snorp - Can you comment on dropping support for < 4.1?
Flags: needinfo?(snorp)
(Assignee)

Comment 8

7 months ago
Created attachment 8845529 [details] [diff] [review]
build Android xpcshell as PIE

Right you are - -fPIE is not needed here. Thanks.

My read of bug 1316462 with respect to dropping support for < 4.1 is that we're thinking about it, but we're not there yet, and it might happen soon, but it might not. In case it doesn't happen soon, I'd like to proceed with this patch since a few people have complained to me recently about having trouble with xpcshell on Android 5+.
Attachment #8844921 - Attachment is obsolete: true
Attachment #8845529 - Flags: review?(mh+mozilla)
Yeah I think we can unconditionally build xpcshell wth PIE, but let's hold off on the other stuff for now.
Flags: needinfo?(snorp)

Updated

7 months ago
Attachment #8845529 - Flags: review?(mh+mozilla) → review+

Comment 10

7 months ago
Pushed by gbrown@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9632421756fa
Build android xpcshell as position independent executable; r=glandium

Comment 11

7 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/9632421756fa
Status: NEW → RESOLVED
Last Resolved: 7 months ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
status-firefox54: affected → wontfix
You need to log in before you can comment on or make changes to this bug.