b1dca6
commit d330f31af68f96dde82840d1e9343b479a8c179e
b1dca6
Author: Carlos O'Donell <carlos@redhat.com>
b1dca6
Date:   Thu Aug 30 11:01:33 2018 -0400
b1dca6
b1dca6
    Fix test failure with -DNDEBUG.
b1dca6
    
b1dca6
    The elf/tst-dlopen-aout.c test uses asserts to verify properties of the
b1dca6
    test execution.  Instead of using assert it should use xpthread_create
b1dca6
    and xpthread_join to catch errors starting the threads and fail the
b1dca6
    test.  This shows up in Fedora 28 when building for i686-pc-linux-gnu
b1dca6
    and using gcc 8.1.1.
b1dca6
    
b1dca6
    Tested on i686, and fixes a check failure with -DNDEBUG.
b1dca6
    
b1dca6
    Signed-off-by: Carlos O'Donell <carlos@redhat.com>
b1dca6
b1dca6
diff --git a/elf/tst-dlopen-aout.c b/elf/tst-dlopen-aout.c
b1dca6
index 9038e2096add8798..b0264515cfe62276 100644
b1dca6
--- a/elf/tst-dlopen-aout.c
b1dca6
+++ b/elf/tst-dlopen-aout.c
b1dca6
@@ -27,6 +27,7 @@
b1dca6
 #include <dlfcn.h>
b1dca6
 #include <stdio.h>
b1dca6
 #include <pthread.h>
b1dca6
+#include <support/xthread.h>
b1dca6
 
b1dca6
 __thread int x;
b1dca6
 
b1dca6
@@ -45,7 +46,6 @@ do_test (int argc, char *argv[])
b1dca6
     {
b1dca6
       pthread_t thr;
b1dca6
       void *p;
b1dca6
-      int rc;
b1dca6
 
b1dca6
       p = dlopen (argv[0], RTLD_LAZY);
b1dca6
       if (p != NULL)
b1dca6
@@ -53,11 +53,11 @@ do_test (int argc, char *argv[])
b1dca6
           fprintf (stderr, "dlopen unexpectedly succeeded\n");
b1dca6
           return 1;
b1dca6
         }
b1dca6
-      rc = pthread_create (&thr, NULL, fn, NULL);
b1dca6
-      assert (rc == 0);
b1dca6
-
b1dca6
-      rc = pthread_join (thr, NULL);
b1dca6
-      assert (rc == 0);
b1dca6
+      /* We create threads to force TLS allocation, which triggers
b1dca6
+	 the original bug i.e. running out of surplus slotinfo entries
b1dca6
+	 for TLS.  */
b1dca6
+      thr = xpthread_create (NULL, fn, NULL);
b1dca6
+      xpthread_join (thr);
b1dca6
     }
b1dca6
 
b1dca6
   return 0;