Closed Bug 1593104 Opened 5 years ago Closed 5 years ago

Linker errors when building for Android under higher optimization levels

Categories

(Core :: Disability Access APIs, defect, P3)

Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: acreskey, Assigned: acreskey)

References

Details

Attachments

(1 file)

In Bug 1591725 we're looking at building on Android with different optimization flags such as -O2.

I noticed a number of linker errors in accessibility for Android when building with -Os, -O2, and -O3 instead the default, -Oz.

I'll put up a work-in-progress patch with what I've managed to resolve, but I think I'll need some help with two of the issues.

The errors I ran into:

.../mozilla-central/accessible/android/AccessibleWrap.cpp:361: error: undefined reference to 'mozilla::a11y::HyperTextAccessible::SetCaretOffset(int)'
.../mozilla-central/accessible/android/AccessibleWrap.cpp:369: error: undefined reference to 'mozilla::a11y::HyperTextAccessible::SetCaretOffset(int)'
.../mozilla-central/accessible/android/AccessibleWrap.cpp:384: error: undefined reference to 'mozilla::a11y::HyperTextAccessible::CutText(int, int)'
.../mozilla-central/accessible/android/AccessibleWrap.cpp:392: error: undefined reference to 'mozilla::a11y::HyperTextAccessible::CopyText(int, int)'
.../mozilla-central/accessible/android/AccessibleWrap.cpp:406: error: undefined reference to 'mozilla::a11y::HyperTextAccessible::DeleteText(int, int)'
.../mozilla-central/accessible/android/AccessibleWrap.cpp:408: error: undefined reference to 'mozilla::a11y::HyperTextAccessible::PasteText(int)'

These I fixed by adding the include "HyperTextAccessible-inl.h" to accessible/android/AccessibleWrap.cpp

.../mozilla-central/accessible/android/AccessibleWrap.cpp:770:47: error: expected unqualified-id
                            java::sdk::Boolean::TRUE());
 
.../obj-release-android/dist/include/unicode/umachine.h:265:18: note: expanded from macro 'TRUE'
                            #   define TRUE  1

Here icuTRUE is conflicting with java::sdk::Boolean::TRUE()
https://searchfox.org/mozilla-central/rev/ce02064d8afc8673cef83c92896ee873bd35e7ae/intl/icu/source/common/unicode/umachine.h#265
https://searchfox.org/mozilla-central/source/__GENERATED__/widget/android/bindings/JavaBuiltins.h#78
I've crudely #undef'ed icu's TRUE but I'm not sure the best way to resolve this -- perhaps the TRUE symbol in java::sdk::Boolean:: is too problematic and could be renamed to True?

.../mozilla-central/accessible/android/ProxyAccessibleWrap.cpp:157: error: undefined reference to 'mozilla::a11y::Accessible::HasNumericValue() const'

Here I added the #include "Accessible-inl.h" to ProxyAccessibleWrap.cpp

.../mozilla-central/accessible/android/TraversalRule.cpp:135: error: undefined reference to 'mozilla::a11y::Accessible::Role() const'
.../mozilla-central/accessible/android/TraversalRule.cpp:125: error: undefined reference to 'mozilla::a11y::Accessible::Role() const'
.../mozilla-central/accessible/android/TraversalRule.cpp:143: error: undefined reference to 'mozilla::a11y::Accessible::Role() const'
.../mozilla-central/accessible/android/TraversalRule.cpp:153: error: undefined reference to 'mozilla::a11y::Accessible::Role() const'

Here I also added the include inline header: #include "Accessible-inl.h"

And that's leaving me with these, which I haven't successfully found a solution to yet because their origin isn't clear.

.../mozilla-central/accessible/generic/Accessible.h:581: error: undefined reference to 'mozilla::a11y::Accessible::HasGenericType(mozilla::a11y::AccGenericType) const'
.../mozilla-central/accessible/generic/Accessible.h:581: error: undefined reference to 'mozilla::a11y::Accessible::HasGenericType(mozilla::a11y::AccGenericType) const'

The HasGenericType issue also needs an include of "Accessible-inl.h"; we're running into the same issues when building Android with ASan. You need the includes in SessionAccessibility.cpp and TraversalRule.cpp.

Thank you Nathan, that was it.
The patch is updated, the only question is the best way to deal with java::sdk::Boolean::TRUE conflicting with ICU's TRUE.
Eitan looks to be the most active here but is on leave at the moment.

The fuzzing patch just #undef'd things in the appropriate .cpp.

(In reply to Andrew Creskey from comment #3)

The patch is updated, the only question is the best way to deal with java::sdk::Boolean::TRUE conflicting with ICU's TRUE.
Eitan looks to be the most active here but is on leave at the moment.

Neither of these "TRUE"s is in our module, so I'm not sure we can make the "right" decision here. To complicate things, AFAIK these are both in third party code. I think I'd just undef ICU's TRUE as you're doing.

Priority: -- → P3

Ok, then I think that patch is ready for review - James, can I put you down as reviewer, or is there someone else?

Flags: needinfo?(jteh)

I can review it. Thanks.

Flags: needinfo?(jteh)
Attachment #9105622 - Attachment description: Bug 1593104 - Wip fixes to issues encountered when building on Android with optimization r=? → Bug 1593104 - Fixes to issues encountered when building on Android with optimization r=?jteh
Attachment #9105622 - Attachment description: Bug 1593104 - Fixes to issues encountered when building on Android with optimization r=?jteh → Bug 1593104 - Fixes to issues encountered when building on Android with optimization r=jteh
Assignee: nobody → acreskey
Status: NEW → ASSIGNED
Pushed by csabou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/782960ed4fe0 Fixes to issues encountered when building on Android with optimization r=Jamie
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: