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