Closed
Bug 723939
Opened 13 years ago
Closed 13 years ago
Linker needs to align to 16k boundaries on armv6
Categories
(Core :: mozglue, defect)
Tracking
()
RESOLVED
FIXED
mozilla13
People
(Reporter: ted, Assigned: glandium)
References
Details
Attachments
(2 files, 3 obsolete files)
1.91 KB,
patch
|
taras.mozilla
:
review+
|
Details | Diff | Splinter Review |
1.41 KB,
patch
|
ted
:
review+
|
Details | Diff | Splinter Review |
After some detective work by glandium, sewardj, and jbramley, we found out that the reason the linker is failing on my armv6 builds is because there's a 16k alignment requirement.
Assignee | ||
Updated•13 years ago
|
Component: General → mozglue
Product: Fennec Native → Core
QA Contact: general → mozglue
Assignee | ||
Comment 1•13 years ago
|
||
Attachment #595355 -
Flags: review?(taras.mozilla)
Assignee | ||
Comment 2•13 years ago
|
||
As mentioned on IRC, another part of the problem is that the static linker doesn't help either, and we want it to align segments at 16k boundaries (that is, we need (p_vaddr - p_offset) % 16384 == 0).
This can be done with -Wl,-z,max-page-size=0x4000 in LDFLAGS. I'm not completely sure which of configure.in or mozconfig this should live in.
Reporter | ||
Comment 3•13 years ago
|
||
I think we should automatically add that to LDFLAGS in configure if we're targeting Android-armv6.
Assignee | ||
Comment 4•13 years ago
|
||
armv6 or less, since armv5 code can run on armv6.
Comment 5•13 years ago
|
||
Comment on attachment 595355 [details] [diff] [review]
When reserving memory for the loaded library, ensure correct alignment for future MAP_SHARED mappings
seems harmless
Attachment #595355 -
Flags: review?(taras.mozilla) → review+
Assignee | ||
Comment 6•13 years ago
|
||
Mmmmm interestingly, this breaks the linker on desktop :-/
Assignee | ||
Comment 7•13 years ago
|
||
I'm not entirely sure why it was breaking desktop and not android, but there seems to be pretty bad side effects keeping the mapping MAP_SHARED. So once we get a base address that can hold the library and that will work with MAP_SHARED later, just remap it MAP_PRIVATE instead.
Attachment #597384 -
Flags: review?(taras.mozilla)
Assignee | ||
Updated•13 years ago
|
Attachment #595355 -
Attachment is obsolete: true
Assignee | ||
Comment 8•13 years ago
|
||
Attachment #597402 -
Flags: review?(ted.mielczarek)
Updated•13 years ago
|
Attachment #597384 -
Flags: review?(taras.mozilla) → review+
Assignee | ||
Comment 9•13 years ago
|
||
There were single quotes instead of double quotes in the previous patch
Attachment #597711 -
Flags: review?(ted.mielczarek)
Assignee | ||
Updated•13 years ago
|
Attachment #597402 -
Attachment is obsolete: true
Attachment #597402 -
Flags: review?(ted.mielczarek)
Assignee | ||
Comment 10•13 years ago
|
||
This applies the flag to nspr, too.
Attachment #597872 -
Flags: review?(ted.mielczarek)
Assignee | ||
Updated•13 years ago
|
Attachment #597711 -
Attachment is obsolete: true
Attachment #597711 -
Flags: review?(ted.mielczarek)
Reporter | ||
Comment 11•13 years ago
|
||
Comment on attachment 597872 [details] [diff] [review]
part 2 - Ensure 16k alignment of ELF segments when building for ARM < v7
Review of attachment 597872 [details] [diff] [review]:
-----------------------------------------------------------------
::: configure.in
@@ +4091,5 @@
> +dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
> +if test -n "$MOZ_LINKER"; then
> + if test "$CPU_ARCH" = arm; then
> + dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
> + ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
Kind of awkward, but I don't have a better suggestion.
@@ +4095,5 @@
> + ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
> + dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
> + if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
> + LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
> + _SUBDIR_LDFLAGS="$LDFLAGS"
Do we really want to stick all of our LDFLAGS in SUBDIR_LDFLAGS, or just this one thing?
Attachment #597872 -
Flags: review?(ted.mielczarek) → review+
Assignee | ||
Comment 12•13 years ago
|
||
Comment 13•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/8a9d1df1c762
https://hg.mozilla.org/mozilla-central/rev/a69b347c4d35
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in
before you can comment on or make changes to this bug.
Description
•