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