Bug 1530874 - Version the mozglue symbols on Android. r=froydnj
authorGeoff Brown <gbrown@mozilla.com>
Thu, 18 Apr 2019 21:39:10 +0000
changeset 470151 9bcfda8f31f02b5ff21557f7a1aee55cade3ef53
parent 470150 d23c0160234dd213fd9b59635afca4b4a8b2b19d
child 470152 ef991fe893a435f4416bde5f518135655a9740e1
push id112843
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:50:22 +0000
treeherdermozilla-inbound@c06f27cbfe40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1530874, 1531887
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1530874 - Version the mozglue symbols on Android. r=froydnj See comment 24 in the bug for details on what can go wrong without this change. This change ensures system libraries are not going to pick symbols from mozglue when running processes outside dalvik. As a side effect, this makes things kind of closer to what happens when dalvik is involved, exposing unit tests to possible allocator mismatches that could happen like bug 1531887. On the flip side, libraries that link against mozglue explicitly are going to get a reference to the versioned symbols, so everything is fine in that regard. The custom linker, however, will ignore the versions altogether, and its symbols resolution just ends up unchanged. So we're fine there too. We use something that is close to what using a SYMBOLS_FILE would generate as a version script, but we need to do so manually because SYMBOLS_FILE doesn't support exporting all the symbols. Differential Revision: https://phabricator.services.mozilla.com/D28030
mozglue/build/moz.build
mozglue/build/mozglue.ver
--- a/mozglue/build/moz.build
+++ b/mozglue/build/moz.build
@@ -10,16 +10,17 @@
 if CONFIG['JS_STANDALONE'] and not CONFIG['MOZ_MEMORY']:
     Library('mozglue')
 elif CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'):
     SharedLibrary('mozglue')
 else:
     Library('mozglue')
 
 if CONFIG['OS_TARGET'] == 'Android':
+    LDFLAGS += ['-Wl,--version-script,%s/mozglue.ver' % SRCDIR]
     SOURCES += [
         'BionicGlue.cpp',
     ]
 
 if CONFIG['MOZ_ASAN']:
     SOURCES += [
         'AsanOptions.cpp',
     ]
new file mode 100644
--- /dev/null
+++ b/mozglue/build/mozglue.ver
@@ -0,0 +1,4 @@
+libmozglue.so {
+global:
+  *;
+};