I take some time to read Firefox build on Android and try to put it into practice, but at present I have no plan to release an available Firefox build edition on Android.
Don’t use the linker switch, which will cause libxul has no symbols
2) -flto -fuse-linker-plugin and linker switch -flto
They are not compatible with -mfpu=neon, which has been fixed in gcc side ( https://gcc.gnu.org/ml/gcc-patches/2016-01/msg00248.html ). Considering some LTO bugs, we may rebuild gcc and binutils ourselves in order to use LTO ( avoiding some ICE ).
-mfpu=neon exists in https://dxr.mozilla.org/mozilla-central/search?q=mfpu%3Dneon&redirect=false&case=true, if we don’t patch gcc and binutils, we can add -fno-lto to the Makefile.
And firefox’s stlport also can’t use LTO, which will not find some symbols, but I have no time to check it.
3) -ffunction-sections -fdata-sections -fvisibility=hidden and linker switch -Wl,–gc-sections
Some modules will cause symbols error.
4) -Os -finline-limit=64
inline-limit is set to 64 for arm and set to 300 for x86 and mips
Optimization flag is set to -Os (optimize for size) for arm and set to -O2 (optimize for performance) for x86 and mips
5) PGO? -fprofile-generate and -fprofile-use ( Compiler and Linker switch )
At present I don’t know how to make it work on Android.
Maybe see : https://bugzilla.mozilla.org/show_bug.cgi?id=632954