00c0d4
commit 5325233313c66aea13e86f5dd59618e9dd74b510
00c0d4
Author: Stefan Liebler <stli@linux.ibm.com>
00c0d4
Date:   Thu Apr 7 13:59:48 2022 +0200
00c0d4
00c0d4
    S390: Fix elf/tst-audit25[ab]
00c0d4
    
00c0d4
    If glibc is configured with --disable-default-pie and build on
00c0d4
    s390 with -O3, the tests elf/tst-audit25a and elf/tst-audit25b are
00c0d4
    failing as there are additional la_symbind lines for free and malloc.
00c0d4
    It turns out that those belong to the executable. In fact those are
00c0d4
    the PLT-stubs. Furthermore la_symbind is also called for calloc and
00c0d4
    realloc symbols, but those belong to libc.
00c0d4
    
00c0d4
    Those functions are not called at all, but dlsym'ed in
00c0d4
    elf/dl-minimal.c:
00c0d4
    __rtld_malloc_init_real (struct link_map *main_map)
00c0d4
    {
00c0d4
    ...
00c0d4
      void *new_calloc = lookup_malloc_symbol (main_map, "calloc", &version);
00c0d4
      void *new_free = lookup_malloc_symbol (main_map, "free", &version);
00c0d4
      void *new_malloc = lookup_malloc_symbol (main_map, "malloc", &version);
00c0d4
      void *new_realloc = lookup_malloc_symbol (main_map, "realloc", &version);
00c0d4
    ...
00c0d4
    }
00c0d4
    
00c0d4
    Therefore, this commit just ignored symbols with LA_SYMB_DLSYM flag.
00c0d4
    Reviewed-by: Adheemrval Zanella  <adhemerval.zanella@linaro.org>
00c0d4
00c0d4
diff --git a/elf/tst-auditmod25.c b/elf/tst-auditmod25.c
00c0d4
index 20640a8daf346b5f..0524c5aab17fabba 100644
00c0d4
--- a/elf/tst-auditmod25.c
00c0d4
+++ b/elf/tst-auditmod25.c
00c0d4
@@ -72,7 +72,8 @@ la_symbind32 (Elf32_Sym *sym, unsigned int ndx,
00c0d4
 	      unsigned int *flags, const char *symname)
00c0d4
 #endif
00c0d4
 {
00c0d4
-  if (*refcook != -1 && *defcook != -1 && symname[0] != '\0')
00c0d4
+  if (*refcook != -1 && *defcook != -1 && symname[0] != '\0'
00c0d4
+      && (*flags & LA_SYMB_DLSYM) == 0)
00c0d4
     fprintf (stderr, "la_symbind: %s %u\n", symname,
00c0d4
 	     *flags & (LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT) ? 1 : 0);
00c0d4
   return sym->st_value;