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

RESOLVED FIXED in Firefox 55

Status

()

P1
normal
RESOLVED FIXED
2 years ago
11 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

2 years 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

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

Updated

2 years ago
Priority: -- → P3
(Assignee)

Updated

2 years ago
Assignee: nobody → gbrown
Priority: P3 → P1
(Assignee)

Comment 2

2 years 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)

Updated

2 years 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 5

2 years 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

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

Comment 8

2 years 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)
Attachment #8845529 - Flags: review?(mh+mozilla) → review+

Comment 10

2 years 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

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/9632421756fa
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
status-firefox54: affected → wontfix
(Assignee)

Updated

11 months ago
See Also: → bug 1425381
You need to log in before you can comment on or make changes to this bug.