-z max-page-size doesn't have the expected effect when using gold

RESOLVED FIXED in mozilla20

Status

Firefox Build System
General
RESOLVED FIXED
6 years ago
4 months ago

People

(Reporter: glandium, Assigned: kats)

Tracking

unspecified
mozilla20
ARM
Android
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
-z max-page-size is used in bug 723939 and bug 772886 to have a working alignment on some armv6 devices, such that the linker doesn't fail. It however doesn't affect PT_LOAD's p_align when linking with gold.
Blocks: 816993
I just want to make sure: this bug manifests as a linker error on startup, right? Or could there be more subtle manifestations of this bug? My local builds of ARMv6 fennec with gcc-4.6 and gold start up fine so I want to know if this bug is still an issue.
(Reporter)

Comment 2

6 years ago
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #1)
> I just want to make sure: this bug manifests as a linker error on startup,
> right? Or could there be more subtle manifestations of this bug? My local
> builds of ARMv6 fennec with gcc-4.6 and gold start up fine so I want to know
> if this bug is still an issue.

The problem is that the bug may show up pretty much randomly depending how things align in PT_LOADs, and how lucky you are with mmap. Can you attach the output for readelf -l *.so ?
Created attachment 695502 [details]
readelf -l *.so output

Here's the output from readelf -l *.so. Is the problem here that the alignment of the LOAD sections is 0x1000 instead of 0x4000?
Created attachment 695508 [details] [diff] [review]
Set common-page-size as well

Also, if that is indeed the problem, the attached patch makes the LOAD alignment 0x4000 when building with NDK r8c/gcc-4.6/gold-1.10. The build seems to work fine on my device, but I don't know if it will have other side-effects that are not obvious.
(Reporter)

Comment 5

6 years ago
I know i've tried common-page-size before settling on max-page-size, and i remember there were problems with it, although i don't remember what specifically. However, I'm not sure i tried both at the same time. Anyways, it would be better to double check the resulting binaries.
When I tried it, common-page-size by itself didn't fix the alignment. Only when I set both does the alignment change. I'll do more thorough testing once NDK r8c is rolled out and I can build this on try.
Comment on attachment 695508 [details] [diff] [review]
Set common-page-size as well

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

The try build at https://tbpl.mozilla.org/?tree=Try&rev=2c0744d1d581 with this patch (plus one to work around the SIGILL thing from bug 803601) work fine with gold and gcc-4.6. Any objections to landing this patch? I also verified the alignment on the LOAD segments is 0x4000 on the .so files in the try build.
Attachment #695508 - Flags: review?(mh+mozilla)
(Reporter)

Updated

6 years ago
Attachment #695508 - Flags: review?(mh+mozilla) → review+
Blocks: 825453
https://hg.mozilla.org/mozilla-central/rev/2aa360eb664c
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20

Updated

4 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.