Bug 1505608 - Try to ensure the bss section of the elfhack testcase stays large enough. r=froydnj, a=jcristau
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 08 Nov 2018 14:50:22 +0000
changeset 498427 6598cfafc162
parent 498426 2da6ab9b72ac
child 498428 d84c76f0dddd
push id10154
push userryanvm@gmail.com
push dateFri, 09 Nov 2018 16:38:03 +0000
treeherdermozilla-beta@d84c76f0dddd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, jcristau
bugs1505608, 1470701
milestone64.0
Bug 1505608 - Try to ensure the bss section of the elfhack testcase stays large enough. r=froydnj, a=jcristau In bug 1470701, we added a dummy global variable so that it ends up in the bss section, making it large enough for two pointers. Unfortunately, in some cases, the symbol is eliminated by the linker because it is unused. So we try to ensure it stays there. Differential Revision: https://phabricator.services.mozilla.com/D11257
build/unix/elfhack/test.c
--- a/build/unix/elfhack/test.c
+++ b/build/unix/elfhack/test.c
@@ -131,18 +131,22 @@ int print_status() {
 
 /* We need a .bss that can hold at least 2 pointers. The static in
  * end_test() plus this variable should do. */
 size_t dummy;
 
 void end_test() {
     static size_t count = 0;
     /* Only exit when both constructors have been called */
-    if (++count == 2)
+    if (++count == 2) {
         ret = 0;
+        // Avoid the dummy variable being stripped out at link time because
+        // it's unused.
+        dummy = 1;
+    }
 }
 
 void test() {
     int i = 0, j = 0;
 #define DEF_(a,i,w) \
     if (a[i++] != str_ ## w) return;
 #define DEF(w) DEF_(strings,i,w)
 #include "test.c"