08c3a6
commit 056fc1c0e367b9682d89f60fd5c249f80074ff30
08c3a6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
08c3a6
Date:   Mon Jan 24 10:46:17 2022 -0300
08c3a6
08c3a6
    elf: Issue la_symbind for bind-now (BZ #23734)
08c3a6
    
08c3a6
    The audit symbind callback is not called for binaries built with
08c3a6
    -Wl,-z,now or when LD_BIND_NOW=1 is used, nor the PLT tracking callbacks
08c3a6
    (plt_enter and plt_exit) since this would change the expected
08c3a6
    program semantics (where no PLT is expected) and would have performance
08c3a6
    implications (such as for BZ#15533).
08c3a6
    
08c3a6
    LAV_CURRENT is also bumped to indicate the audit ABI change (where
08c3a6
    la_symbind flags are set by the loader to indicate no possible PLT
08c3a6
    trace).
08c3a6
    
08c3a6
    To handle powerpc64 ELFv1 function descriptor, _dl_audit_symbind
08c3a6
    requires to know whether bind-now is used so the symbol value is
08c3a6
    updated to function text segment instead of the OPD (for lazy binding
08c3a6
    this is done by PPC64_LOAD_FUNCPTR on _dl_runtime_resolve).
08c3a6
    
08c3a6
    Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
08c3a6
    powerpc64-linux-gnu.
08c3a6
    
08c3a6
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
08c3a6
    Tested-by: Carlos O'Donell <carlos@redhat.com>
08c3a6
    (cherry picked from commit 32612615c58b394c3eb09f020f31310797ad3854)
08c3a6
    
08c3a6
    Resolved conflicts:
08c3a6
            NEWS - Manual merge.
08c3a6
08c3a6
diff --git a/bits/link_lavcurrent.h b/bits/link_lavcurrent.h
08c3a6
index 44fbea1e8060997f..c48835d12b512355 100644
08c3a6
--- a/bits/link_lavcurrent.h
08c3a6
+++ b/bits/link_lavcurrent.h
08c3a6
@@ -22,4 +22,4 @@
08c3a6
 #endif
08c3a6
 
08c3a6
 /* Version numbers for la_version handshake interface.  */
08c3a6
-#define LAV_CURRENT	1
08c3a6
+#define LAV_CURRENT	2
08c3a6
diff --git a/elf/Makefile b/elf/Makefile
08c3a6
index 3ccf78f62985e2d0..0ab3e885f5e35671 100644
08c3a6
--- a/elf/Makefile
08c3a6
+++ b/elf/Makefile
08c3a6
@@ -370,6 +370,12 @@ tests += \
08c3a6
   tst-audit21 \
08c3a6
   tst-audit22 \
08c3a6
   tst-audit23 \
08c3a6
+  tst-audit24a \
08c3a6
+  tst-audit24b \
08c3a6
+  tst-audit24c \
08c3a6
+  tst-audit24d \
08c3a6
+  tst-audit25a \
08c3a6
+  tst-audit25b \
08c3a6
   tst-auditmany \
08c3a6
   tst-auxobj \
08c3a6
   tst-auxobj-dlopen \
08c3a6
@@ -634,6 +640,18 @@ modules-names = \
08c3a6
   tst-audit18mod \
08c3a6
   tst-audit19bmod \
08c3a6
   tst-audit23mod \
08c3a6
+  tst-audit24amod1 \
08c3a6
+  tst-audit24amod2 \
08c3a6
+  tst-audit24bmod1 \
08c3a6
+  tst-audit24bmod2 \
08c3a6
+  tst-audit24dmod1 \
08c3a6
+  tst-audit24dmod2 \
08c3a6
+  tst-audit24dmod3 \
08c3a6
+  tst-audit24dmod4 \
08c3a6
+  tst-audit25mod1 \
08c3a6
+  tst-audit25mod2 \
08c3a6
+  tst-audit25mod3 \
08c3a6
+  tst-audit25mod4 \
08c3a6
   tst-auditlogmod-1 \
08c3a6
   tst-auditlogmod-2 \
08c3a6
   tst-auditlogmod-3 \
08c3a6
@@ -659,6 +677,11 @@ modules-names = \
08c3a6
   tst-auditmod21b \
08c3a6
   tst-auditmod22 \
08c3a6
   tst-auditmod23 \
08c3a6
+  tst-auditmod24a \
08c3a6
+  tst-auditmod24b \
08c3a6
+  tst-auditmod24c \
08c3a6
+  tst-auditmod24d \
08c3a6
+  tst-auditmod25 \
08c3a6
   tst-auxvalmod \
08c3a6
   tst-big-note-lib \
08c3a6
   tst-deep1mod1 \
08c3a6
@@ -864,7 +887,8 @@ extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
08c3a6
 
08c3a6
 # filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special
08c3a6
 # rules.
08c3a6
-modules-names-nobuild := filtmod1 tst-big-note-lib tst-ro-dynamic-mod
08c3a6
+modules-names-nobuild := filtmod1 tst-big-note-lib tst-ro-dynamic-mod \
08c3a6
+			 tst-audit24bmod1 tst-audit24bmod2.so
08c3a6
 
08c3a6
 tests += $(tests-static)
08c3a6
 
08c3a6
@@ -2060,6 +2084,69 @@ $(objpfx)tst-audit23.out: $(objpfx)tst-auditmod23.so \
08c3a6
 			  $(objpfx)tst-audit23mod.so
08c3a6
 tst-audit23-ARGS = -- $(host-test-program-cmd)
08c3a6
 
08c3a6
+$(objpfx)tst-audit24a.out: $(objpfx)tst-auditmod24a.so
08c3a6
+$(objpfx)tst-audit24a: $(objpfx)tst-audit24amod1.so \
08c3a6
+		       $(objpfx)tst-audit24amod2.so
08c3a6
+tst-audit24a-ENV = LD_AUDIT=$(objpfx)tst-auditmod24a.so
08c3a6
+LDFLAGS-tst-audit24a = -Wl,-z,now
08c3a6
+
08c3a6
+$(objpfx)tst-audit24b.out: $(objpfx)tst-auditmod24b.so
08c3a6
+$(objpfx)tst-audit24b: $(objpfx)tst-audit24bmod1.so \
08c3a6
+		       $(objpfx)tst-audit24bmod2.so
08c3a6
+$(objpfx)tst-audit24bmod1: $(objpfx)tst-audit24bmod2.so
08c3a6
+# The test checks if a library without .gnu.version correctly calls the
08c3a6
+# audit callbacks.  So it uses an explicit link rule to avoid linking
08c3a6
+# against libc.so.
08c3a6
+$(objpfx)tst-audit24bmod1.so: $(objpfx)tst-audit24bmod1.os
08c3a6
+	$(CC) -nostdlib -nostartfiles -shared -o $@.new $(objpfx)tst-audit24bmod1.os \
08c3a6
+	  -Wl,-z,now
08c3a6
+	$(call after-link,$@.new)
08c3a6
+	mv -f $@.new $@
08c3a6
+CFLAGS-.os += $(call elide-stack-protector,.os,tst-audit24bmod1)
08c3a6
+$(objpfx)tst-audit24bmod2.so: $(objpfx)tst-audit24bmod2.os
08c3a6
+	$(CC) -nostdlib -nostartfiles -shared -o $@.new $(objpfx)tst-audit24bmod2.os
08c3a6
+	$(call after-link,$@.new)
08c3a6
+	mv -f $@.new $@
08c3a6
+CFLAGS-.os += $(call elide-stack-protector,.os,tst-audit24bmod2)
08c3a6
+tst-audit24b-ENV = LD_AUDIT=$(objpfx)tst-auditmod24b.so
08c3a6
+LDFLAGS-tst-audit24b = -Wl,-z,now
08c3a6
+
08c3a6
+# Same as tst-audit24a, but tests LD_BIND_NOW
08c3a6
+$(objpfx)tst-audit24c.out: $(objpfx)tst-auditmod24c.so
08c3a6
+$(objpfx)tst-audit24c: $(objpfx)tst-audit24amod1.so \
08c3a6
+		       $(objpfx)tst-audit24amod2.so
08c3a6
+tst-audit24c-ENV = LD_BIND_NOW=1 LD_AUDIT=$(objpfx)tst-auditmod24c.so
08c3a6
+LDFLAGS-tst-audit24b = -Wl,-z,lazy
08c3a6
+
08c3a6
+$(objpfx)tst-audit24d.out: $(objpfx)tst-auditmod24d.so
08c3a6
+$(objpfx)tst-audit24d: $(objpfx)tst-audit24dmod1.so \
08c3a6
+		       $(objpfx)tst-audit24dmod2.so
08c3a6
+$(objpfx)tst-audit24dmod1.so: $(objpfx)tst-audit24dmod3.so
08c3a6
+LDFLAGS-tst-audit24dmod1.so = -Wl,-z,now
08c3a6
+$(objpfx)tst-audit24dmod2.so: $(objpfx)tst-audit24dmod4.so
08c3a6
+LDFLAGS-tst-audit24dmod2.so = -Wl,-z,lazy
08c3a6
+tst-audit24d-ENV = LD_AUDIT=$(objpfx)tst-auditmod24d.so
08c3a6
+LDFLAGS-tst-audit24d = -Wl,-z,lazy
08c3a6
+
08c3a6
+$(objpfx)tst-audit25a.out: $(objpfx)tst-auditmod25.so
08c3a6
+$(objpfx)tst-audit25a: $(objpfx)tst-audit25mod1.so \
08c3a6
+		       $(objpfx)tst-audit25mod2.so \
08c3a6
+		       $(objpfx)tst-audit25mod3.so \
08c3a6
+		       $(objpfx)tst-audit25mod4.so
08c3a6
+$(objpfx)tst-audit25mod1.so: $(objpfx)tst-audit25mod3.so
08c3a6
+LDFLAGS-tst-audit25mod1.so = -Wl,-z,now
08c3a6
+$(objpfx)tst-audit25mod2.so: $(objpfx)tst-audit25mod4.so
08c3a6
+LDFLAGS-tst-audit25mod2.so = -Wl,-z,lazy
08c3a6
+tst-audit25a-ARGS = -- $(host-test-program-cmd)
08c3a6
+
08c3a6
+$(objpfx)tst-audit25b.out: $(objpfx)tst-auditmod25.so
08c3a6
+$(objpfx)tst-audit25b: $(objpfx)tst-audit25mod1.so \
08c3a6
+		       $(objpfx)tst-audit25mod2.so \
08c3a6
+		       $(objpfx)tst-audit25mod3.so \
08c3a6
+		       $(objpfx)tst-audit25mod4.so
08c3a6
+LDFLAGS-tst-audit25b = -Wl,-z,now
08c3a6
+tst-audit25b-ARGS = -- $(host-test-program-cmd)
08c3a6
+
08c3a6
 # tst-sonamemove links against an older implementation of the library.
08c3a6
 LDFLAGS-tst-sonamemove-linkmod1.so = \
08c3a6
   -Wl,--version-script=tst-sonamemove-linkmod1.map \
08c3a6
diff --git a/elf/dl-audit.c b/elf/dl-audit.c
08c3a6
index 152712b12fed6de2..72a50717ef60a357 100644
08c3a6
--- a/elf/dl-audit.c
08c3a6
+++ b/elf/dl-audit.c
08c3a6
@@ -178,16 +178,23 @@ _dl_audit_symbind (struct link_map *l, struct reloc_result *reloc_result,
08c3a6
 		   const ElfW(Sym) *defsym, DL_FIXUP_VALUE_TYPE *value,
08c3a6
 		   lookup_t result)
08c3a6
 {
08c3a6
-  reloc_result->bound = result;
08c3a6
-  /* Compute index of the symbol entry in the symbol table of the DSO with the
08c3a6
-     definition.  */
08c3a6
-  reloc_result->boundndx = (defsym - (ElfW(Sym) *) D_PTR (result,
08c3a6
-							  l_info[DT_SYMTAB]));
08c3a6
+  bool for_jmp_slot = reloc_result == NULL;
08c3a6
+
08c3a6
+  /* Compute index of the symbol entry in the symbol table of the DSO
08c3a6
+     with the definition.  */
08c3a6
+  unsigned int boundndx = defsym - (ElfW(Sym) *) D_PTR (result,
08c3a6
+							l_info[DT_SYMTAB]);
08c3a6
+  if (!for_jmp_slot)
08c3a6
+    {
08c3a6
+      reloc_result->bound = result;
08c3a6
+      reloc_result->boundndx = boundndx;
08c3a6
+    }
08c3a6
 
08c3a6
   if ((l->l_audit_any_plt | result->l_audit_any_plt) == 0)
08c3a6
     {
08c3a6
       /* Set all bits since this symbol binding is not interesting.  */
08c3a6
-      reloc_result->enterexit = (1u << DL_NNS) - 1;
08c3a6
+      if (!for_jmp_slot)
08c3a6
+	reloc_result->enterexit = (1u << DL_NNS) - 1;
08c3a6
       return;
08c3a6
     }
08c3a6
 
08c3a6
@@ -199,12 +206,13 @@ _dl_audit_symbind (struct link_map *l, struct reloc_result *reloc_result,
08c3a6
      two bits.  */
08c3a6
   assert (DL_NNS * 2 <= sizeof (reloc_result->flags) * 8);
08c3a6
   assert ((LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT) == 3);
08c3a6
-  reloc_result->enterexit = LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT;
08c3a6
+  uint32_t enterexit = LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT;
08c3a6
 
08c3a6
   const char *strtab2 = (const void *) D_PTR (result, l_info[DT_STRTAB]);
08c3a6
 
08c3a6
   unsigned int flags = 0;
08c3a6
   struct audit_ifaces *afct = GLRO(dl_audit);
08c3a6
+  uintptr_t new_value = (uintptr_t) sym.st_value;
08c3a6
   for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
08c3a6
     {
08c3a6
       /* XXX Check whether both DSOs must request action or only one */
08c3a6
@@ -215,37 +223,41 @@ _dl_audit_symbind (struct link_map *l, struct reloc_result *reloc_result,
08c3a6
 	{
08c3a6
 	  if (afct->symbind != NULL)
08c3a6
 	    {
08c3a6
-	      uintptr_t new_value = afct->symbind (&sym,
08c3a6
-						   reloc_result->boundndx,
08c3a6
-						   &l_state->cookie,
08c3a6
-						   &result_state->cookie,
08c3a6
-						   &flags,
08c3a6
-						   strtab2 + defsym->st_name);
08c3a6
+	      flags |= for_jmp_slot ? LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT
08c3a6
+				    : 0;
08c3a6
+	      new_value = afct->symbind (&sym, boundndx,
08c3a6
+					 &l_state->cookie,
08c3a6
+					 &result_state->cookie, &flags,
08c3a6
+					 strtab2 + defsym->st_name);
08c3a6
 	      if (new_value != (uintptr_t) sym.st_value)
08c3a6
 		{
08c3a6
 		  flags |= LA_SYMB_ALTVALUE;
08c3a6
-		  sym.st_value = new_value;
08c3a6
+		  sym.st_value = for_jmp_slot
08c3a6
+		    ? DL_FIXUP_BINDNOW_ADDR_VALUE (new_value) : new_value;
08c3a6
 		}
08c3a6
 	    }
08c3a6
 
08c3a6
 	  /* Remember the results for every audit library and store a summary
08c3a6
 	     in the first two bits.  */
08c3a6
-	  reloc_result->enterexit &= flags & (LA_SYMB_NOPLTENTER
08c3a6
-					      | LA_SYMB_NOPLTEXIT);
08c3a6
-	  reloc_result->enterexit |= ((flags & (LA_SYMB_NOPLTENTER
08c3a6
-						| LA_SYMB_NOPLTEXIT))
08c3a6
-				      << ((cnt + 1) * 2));
08c3a6
+	  enterexit &= flags & (LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT);
08c3a6
+	  enterexit |= ((flags & (LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT))
08c3a6
+			<< ((cnt + 1) * 2));
08c3a6
 	}
08c3a6
       else
08c3a6
 	/* If the bind flags say this auditor is not interested, set the bits
08c3a6
 	   manually.  */
08c3a6
-	reloc_result->enterexit |= ((LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT)
08c3a6
-				    << ((cnt + 1) * 2));
08c3a6
+	enterexit |= ((LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT)
08c3a6
+		      << ((cnt + 1) * 2));
08c3a6
       afct = afct->next;
08c3a6
     }
08c3a6
 
08c3a6
-  reloc_result->flags = flags;
08c3a6
-  *value = DL_FIXUP_ADDR_VALUE (sym.st_value);
08c3a6
+  if (!for_jmp_slot)
08c3a6
+    {
08c3a6
+      reloc_result->enterexit = enterexit;
08c3a6
+      reloc_result->flags = flags;
08c3a6
+    }
08c3a6
+
08c3a6
+  DL_FIXUP_BINDNOW_RELOC (value, new_value, sym.st_value);
08c3a6
 }
08c3a6
 
08c3a6
 void
08c3a6
diff --git a/elf/do-rel.h b/elf/do-rel.h
08c3a6
index f441b749190c2641..4b7fc14f74cb5d09 100644
08c3a6
--- a/elf/do-rel.h
08c3a6
+++ b/elf/do-rel.h
08c3a6
@@ -16,6 +16,8 @@
08c3a6
    License along with the GNU C Library; if not, see
08c3a6
    <https://www.gnu.org/licenses/>.  */
08c3a6
 
08c3a6
+#include <ldsodefs.h>
08c3a6
+
08c3a6
 /* This file may be included twice, to define both
08c3a6
    `elf_dynamic_do_rel' and `elf_dynamic_do_rela'.  */
08c3a6
 
08c3a6
@@ -123,6 +125,10 @@ elf_dynamic_do_Rel (struct link_map *map, struct r_scope_elem *scope[],
08c3a6
 
08c3a6
 	  for (; r < end; ++r)
08c3a6
 	    {
08c3a6
+	      ElfW(Half) ndx = version[ELFW(R_SYM) (r->r_info)] & 0x7fff;
08c3a6
+	      const ElfW(Sym) *sym = &symtab[ELFW(R_SYM) (r->r_info)];
08c3a6
+	      void *const r_addr_arg = (void *) (l_addr + r->r_offset);
08c3a6
+	      const struct r_found_version *rversion = &map->l_versions[ndx];
08c3a6
 #if defined ELF_MACHINE_IRELATIVE && !defined RTLD_BOOTSTRAP
08c3a6
 	      if (ELFW(R_TYPE) (r->r_info) == ELF_MACHINE_IRELATIVE)
08c3a6
 		{
08c3a6
@@ -133,10 +139,19 @@ elf_dynamic_do_Rel (struct link_map *map, struct r_scope_elem *scope[],
08c3a6
 		}
08c3a6
 #endif
08c3a6
 
08c3a6
-	      ElfW(Half) ndx = version[ELFW(R_SYM) (r->r_info)] & 0x7fff;
08c3a6
-	      elf_machine_rel (map, scope, r, &symtab[ELFW(R_SYM) (r->r_info)],
08c3a6
-			       &map->l_versions[ndx],
08c3a6
-			       (void *) (l_addr + r->r_offset), skip_ifunc);
08c3a6
+	      elf_machine_rel (map, scope, r, sym, rversion, r_addr_arg,
08c3a6
+			       skip_ifunc);
08c3a6
+#if defined SHARED && !defined RTLD_BOOTSTRAP
08c3a6
+	      if (ELFW(R_TYPE) (r->r_info) == ELF_MACHINE_JMP_SLOT
08c3a6
+		  && GLRO(dl_naudit) > 0)
08c3a6
+		{
08c3a6
+		  struct link_map *sym_map
08c3a6
+		    = RESOLVE_MAP (map, scope, &sym, rversion,
08c3a6
+				   ELF_MACHINE_JMP_SLOT);
08c3a6
+		  if (sym != NULL)
08c3a6
+		    _dl_audit_symbind (map, NULL, sym, r_addr_arg, sym_map);
08c3a6
+		}
08c3a6
+#endif
08c3a6
 	    }
08c3a6
 
08c3a6
 #if defined ELF_MACHINE_IRELATIVE && !defined RTLD_BOOTSTRAP
08c3a6
@@ -158,17 +173,33 @@ elf_dynamic_do_Rel (struct link_map *map, struct r_scope_elem *scope[],
08c3a6
       else
08c3a6
 	{
08c3a6
 	  for (; r < end; ++r)
08c3a6
+	    {
08c3a6
+	      const ElfW(Sym) *sym = &symtab[ELFW(R_SYM) (r->r_info)];
08c3a6
+	      void *const r_addr_arg = (void *) (l_addr + r->r_offset);
08c3a6
 # ifdef ELF_MACHINE_IRELATIVE
08c3a6
-	    if (ELFW(R_TYPE) (r->r_info) == ELF_MACHINE_IRELATIVE)
08c3a6
-	      {
08c3a6
-		if (r2 == NULL)
08c3a6
-		  r2 = r;
08c3a6
-		end2 = r;
08c3a6
-	      }
08c3a6
-	    else
08c3a6
+	      if (ELFW(R_TYPE) (r->r_info) == ELF_MACHINE_IRELATIVE)
08c3a6
+		{
08c3a6
+		  if (r2 == NULL)
08c3a6
+		    r2 = r;
08c3a6
+		  end2 = r;
08c3a6
+		  continue;
08c3a6
+		}
08c3a6
 # endif
08c3a6
-	      elf_machine_rel (map, scope, r, &symtab[ELFW(R_SYM) (r->r_info)], NULL,
08c3a6
-			       (void *) (l_addr + r->r_offset), skip_ifunc);
08c3a6
+	      elf_machine_rel (map, scope, r, sym, NULL, r_addr_arg,
08c3a6
+			       skip_ifunc);
08c3a6
+# if defined SHARED && !defined RTLD_BOOTSTRAP
08c3a6
+	      if (ELFW(R_TYPE) (r->r_info) == ELF_MACHINE_JMP_SLOT
08c3a6
+		  && GLRO(dl_naudit) > 0)
08c3a6
+		{
08c3a6
+		  struct link_map *sym_map
08c3a6
+		    = RESOLVE_MAP (map, scope, &sym,
08c3a6
+				   (struct r_found_version *) NULL,
08c3a6
+				   ELF_MACHINE_JMP_SLOT);
08c3a6
+		  if (sym != NULL)
08c3a6
+		    _dl_audit_symbind (map, NULL , sym,r_addr_arg, sym_map);
08c3a6
+		}
08c3a6
+# endif
08c3a6
+	    }
08c3a6
 
08c3a6
 # ifdef ELF_MACHINE_IRELATIVE
08c3a6
 	  if (r2 != NULL)
08c3a6
diff --git a/elf/sotruss-lib.c b/elf/sotruss-lib.c
08c3a6
index b711f7b0c892a972..e4ebc8dbc697df3f 100644
08c3a6
--- a/elf/sotruss-lib.c
08c3a6
+++ b/elf/sotruss-lib.c
08c3a6
@@ -17,6 +17,7 @@
08c3a6
    License along with the GNU C Library; if not, see
08c3a6
    <https://www.gnu.org/licenses/>.  */
08c3a6
 
08c3a6
+#include <err.h>
08c3a6
 #include <error.h>
08c3a6
 #include <fcntl.h>
08c3a6
 #include <stdio.h>
08c3a6
@@ -232,6 +233,12 @@ uintptr_t
08c3a6
 la_symbind (Elf_Sym *sym, unsigned int ndx, uintptr_t *refcook,
08c3a6
 	    uintptr_t *defcook, unsigned int *flags, const char *symname)
08c3a6
 {
08c3a6
+  if (*flags & LA_SYMB_NOPLTENTER)
08c3a6
+    warnx ("cannot trace PLT enter (bind-now enabled)");
08c3a6
+
08c3a6
+  if (do_exit && *flags & LA_SYMB_NOPLTEXIT)
08c3a6
+    warnx ("cannot trace PLT exit (bind-now enabled)");
08c3a6
+
08c3a6
   if (!do_exit)
08c3a6
     *flags = LA_SYMB_NOPLTEXIT;
08c3a6
 
08c3a6
diff --git a/elf/tst-audit24a.c b/elf/tst-audit24a.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..a1781c9b45f18fa0
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24a.c
08c3a6
@@ -0,0 +1,36 @@
08c3a6
+/* LD_AUDIT test for la_symbind and bind-now.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <support/check.h>
08c3a6
+#include <support/support.h>
08c3a6
+
08c3a6
+int tst_audit24amod1_func1 (void);
08c3a6
+int tst_audit24amod1_func2 (void);
08c3a6
+int tst_audit24amod2_func1 (void);
08c3a6
+
08c3a6
+int
08c3a6
+do_test (void)
08c3a6
+{
08c3a6
+  TEST_COMPARE (tst_audit24amod1_func1 (), 1);
08c3a6
+  TEST_COMPARE (tst_audit24amod1_func2 (), 2);
08c3a6
+  TEST_COMPARE (tst_audit24amod2_func1 (), 10);
08c3a6
+
08c3a6
+  return 0;
08c3a6
+}
08c3a6
+
08c3a6
+#include <support/test-driver.c>
08c3a6
diff --git a/elf/tst-audit24amod1.c b/elf/tst-audit24amod1.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..0289a4abefbc7bbb
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24amod1.c
08c3a6
@@ -0,0 +1,31 @@
08c3a6
+/* Module used by tst-audit24a.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <stdlib.h>
08c3a6
+
08c3a6
+_Noreturn int
08c3a6
+tst_audit24amod1_func1 (void)
08c3a6
+{
08c3a6
+  abort ();
08c3a6
+}
08c3a6
+
08c3a6
+int
08c3a6
+tst_audit24amod1_func2 (void)
08c3a6
+{
08c3a6
+  return 2;
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit24amod2.c b/elf/tst-audit24amod2.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..1562afc9dfc1b9b3
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24amod2.c
08c3a6
@@ -0,0 +1,25 @@
08c3a6
+/* Module used by tst-audit24a.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <stdlib.h>
08c3a6
+
08c3a6
+_Noreturn int
08c3a6
+tst_audit24amod2_func1 (void)
08c3a6
+{
08c3a6
+  abort ();
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit24b.c b/elf/tst-audit24b.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..567bee52c27f4361
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24b.c
08c3a6
@@ -0,0 +1,37 @@
08c3a6
+/* LD_AUDIT test for la_symbind and bind-now.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+/* This is similar to tst-audit24a, with the difference this modules
08c3a6
+   does not have the .gnu.version section header.  */
08c3a6
+
08c3a6
+#include <support/check.h>
08c3a6
+#include <support/support.h>
08c3a6
+
08c3a6
+int tst_audit24bmod1_func1 (void);
08c3a6
+int tst_audit24bmod1_func2 (void);
08c3a6
+
08c3a6
+int
08c3a6
+do_test (void)
08c3a6
+{
08c3a6
+  TEST_COMPARE (tst_audit24bmod1_func1 (), 1);
08c3a6
+  TEST_COMPARE (tst_audit24bmod1_func2 (), 2);
08c3a6
+
08c3a6
+  return 0;
08c3a6
+}
08c3a6
+
08c3a6
+#include <support/test-driver.c>
08c3a6
diff --git a/elf/tst-audit24bmod1.c b/elf/tst-audit24bmod1.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..57ce14a01bf72fb6
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24bmod1.c
08c3a6
@@ -0,0 +1,31 @@
08c3a6
+/* Module used by tst-audit24c.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+int tst_audit24bmod2_func1 (void);
08c3a6
+
08c3a6
+int
08c3a6
+tst_audit24bmod1_func1 (void)
08c3a6
+{
08c3a6
+  return -1;
08c3a6
+}
08c3a6
+
08c3a6
+int
08c3a6
+tst_audit24bmod1_func2 (void)
08c3a6
+{
08c3a6
+  return tst_audit24bmod2_func1 ();
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit24bmod2.c b/elf/tst-audit24bmod2.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..b298ce0a05bf2db2
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24bmod2.c
08c3a6
@@ -0,0 +1,23 @@
08c3a6
+/* Module used by tst-audit24b.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+int
08c3a6
+tst_audit24bmod2_func1 (void)
08c3a6
+{
08c3a6
+  return -1;
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit24c.c b/elf/tst-audit24c.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..46ed328756067276
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24c.c
08c3a6
@@ -0,0 +1,2 @@
08c3a6
+/* It tests LD_BIND_NOW=1 instead of linking with -Wl,-z,now  */
08c3a6
+#include "tst-audit24a.c"
08c3a6
diff --git a/elf/tst-audit24d.c b/elf/tst-audit24d.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..543f3b86a6bbdead
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24d.c
08c3a6
@@ -0,0 +1,36 @@
08c3a6
+/* LD_AUDIT test for la_symbind and bind-now.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <support/check.h>
08c3a6
+#include <support/support.h>
08c3a6
+
08c3a6
+int tst_audit24dmod1_func1 (void);
08c3a6
+int tst_audit24dmod1_func2 (void);
08c3a6
+int tst_audit24dmod2_func1 (void);
08c3a6
+
08c3a6
+int
08c3a6
+do_test (void)
08c3a6
+{
08c3a6
+  TEST_COMPARE (tst_audit24dmod1_func1 (), 1);
08c3a6
+  TEST_COMPARE (tst_audit24dmod1_func2 (), 32);
08c3a6
+  TEST_COMPARE (tst_audit24dmod2_func1 (), 10);
08c3a6
+
08c3a6
+  return 0;
08c3a6
+}
08c3a6
+
08c3a6
+#include <support/test-driver.c>
08c3a6
diff --git a/elf/tst-audit24dmod1.c b/elf/tst-audit24dmod1.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..e563f69d638ac3f5
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24dmod1.c
08c3a6
@@ -0,0 +1,33 @@
08c3a6
+/* Module used by tst-audit24d.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <stdlib.h>
08c3a6
+
08c3a6
+int tst_audit24dmod3_func1 (void);
08c3a6
+
08c3a6
+_Noreturn int
08c3a6
+tst_audit24dmod1_func1 (void)
08c3a6
+{
08c3a6
+  abort ();
08c3a6
+}
08c3a6
+
08c3a6
+int
08c3a6
+tst_audit24dmod1_func2 (void)
08c3a6
+{
08c3a6
+  return 2 + tst_audit24dmod3_func1 ();;
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit24dmod2.c b/elf/tst-audit24dmod2.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..03fe9381281e5790
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24dmod2.c
08c3a6
@@ -0,0 +1,28 @@
08c3a6
+/* Module for tst-audit24d.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <stdlib.h>
08c3a6
+
08c3a6
+int tst_audit24dmod4_func1 (void);
08c3a6
+
08c3a6
+_Noreturn int
08c3a6
+tst_audit24dmod2_func1 (void)
08c3a6
+{
08c3a6
+  tst_audit24dmod4_func1 ();
08c3a6
+  abort ();
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit24dmod3.c b/elf/tst-audit24dmod3.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..106d517d2887d76c
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24dmod3.c
08c3a6
@@ -0,0 +1,31 @@
08c3a6
+/* Module for tst-audit24d.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <stdlib.h>
08c3a6
+
08c3a6
+_Noreturn int
08c3a6
+tst_audit24dmod3_func1 (void)
08c3a6
+{
08c3a6
+  abort ();
08c3a6
+}
08c3a6
+
08c3a6
+int
08c3a6
+tst_audit24dmod3_func2 (void)
08c3a6
+{
08c3a6
+  return 4;
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit24dmod4.c b/elf/tst-audit24dmod4.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..1da3b46917ba1083
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit24dmod4.c
08c3a6
@@ -0,0 +1,25 @@
08c3a6
+/* Module for tst-audit24d.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <stdlib.h>
08c3a6
+
08c3a6
+_Noreturn int
08c3a6
+tst_audit24dmod4_func1 (void)
08c3a6
+{
08c3a6
+  abort ();
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit25a.c b/elf/tst-audit25a.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..49173e862516e876
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit25a.c
08c3a6
@@ -0,0 +1,129 @@
08c3a6
+/* Check LD_AUDIT and LD_BIND_NOW.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <array_length.h>
08c3a6
+#include <errno.h>
08c3a6
+#include <getopt.h>
08c3a6
+#include <limits.h>
08c3a6
+#include <inttypes.h>
08c3a6
+#include <string.h>
08c3a6
+#include <stdlib.h>
08c3a6
+#include <support/capture_subprocess.h>
08c3a6
+#include <support/check.h>
08c3a6
+#include <support/xstdio.h>
08c3a6
+#include <support/support.h>
08c3a6
+#include <sys/auxv.h>
08c3a6
+
08c3a6
+static int restart;
08c3a6
+#define CMDLINE_OPTIONS \
08c3a6
+  { "restart", no_argument, &restart, 1 },
08c3a6
+
08c3a6
+void tst_audit25mod1_func1 (void);
08c3a6
+void tst_audit25mod1_func2 (void);
08c3a6
+void tst_audit25mod2_func1 (void);
08c3a6
+void tst_audit25mod2_func2 (void);
08c3a6
+
08c3a6
+static int
08c3a6
+handle_restart (void)
08c3a6
+{
08c3a6
+  tst_audit25mod1_func1 ();
08c3a6
+  tst_audit25mod1_func2 ();
08c3a6
+  tst_audit25mod2_func1 ();
08c3a6
+  tst_audit25mod2_func2 ();
08c3a6
+
08c3a6
+  return 0;
08c3a6
+}
08c3a6
+
08c3a6
+static inline bool
08c3a6
+startswith (const char *str, const char *pre)
08c3a6
+{
08c3a6
+  size_t lenpre = strlen (pre);
08c3a6
+  size_t lenstr = strlen (str);
08c3a6
+  return lenstr < lenpre ? false : memcmp (pre, str, lenpre) == 0;
08c3a6
+}
08c3a6
+
08c3a6
+static int
08c3a6
+do_test (int argc, char *argv[])
08c3a6
+{
08c3a6
+  /* We must have either:
08c3a6
+     - One or four parameters left if called initially:
08c3a6
+       + path to ld.so         optional
08c3a6
+       + "--library-path"      optional
08c3a6
+       + the library path      optional
08c3a6
+       + the application name  */
08c3a6
+
08c3a6
+  if (restart)
08c3a6
+    return handle_restart ();
08c3a6
+
08c3a6
+  setenv ("LD_AUDIT", "tst-auditmod25.so", 0);
08c3a6
+
08c3a6
+  char *spargv[9];
08c3a6
+  int i = 0;
08c3a6
+  for (; i < argc - 1; i++)
08c3a6
+    spargv[i] = argv[i + 1];
08c3a6
+  spargv[i++] = (char *) "--direct";
08c3a6
+  spargv[i++] = (char *) "--restart";
08c3a6
+  spargv[i] = NULL;
08c3a6
+  TEST_VERIFY_EXIT (i < array_length (spargv));
08c3a6
+
08c3a6
+  {
08c3a6
+    struct support_capture_subprocess result
08c3a6
+      = support_capture_subprogram (spargv[0], spargv);
08c3a6
+    support_capture_subprocess_check (&result, "tst-audit25a", 0,
08c3a6
+				      sc_allow_stderr);
08c3a6
+
08c3a6
+    /* tst-audit25a is build with -Wl,-z,lazy and tst-audit25mod1 with
08c3a6
+       -Wl,-z,now; so only tst_audit25mod3_func1 should be expected to
08c3a6
+       have LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT.  */
08c3a6
+    TEST_COMPARE_STRING (result.err.buffer,
08c3a6
+			 "la_symbind: tst_audit25mod3_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod1_func1 0\n"
08c3a6
+			 "la_symbind: tst_audit25mod1_func2 0\n"
08c3a6
+			 "la_symbind: tst_audit25mod2_func1 0\n"
08c3a6
+			 "la_symbind: tst_audit25mod4_func1 0\n"
08c3a6
+			 "la_symbind: tst_audit25mod2_func2 0\n");
08c3a6
+
08c3a6
+    support_capture_subprocess_free (&result);
08c3a6
+  }
08c3a6
+
08c3a6
+  {
08c3a6
+    setenv ("LD_BIND_NOW", "1", 0);
08c3a6
+    struct support_capture_subprocess result
08c3a6
+      = support_capture_subprogram (spargv[0], spargv);
08c3a6
+    support_capture_subprocess_check (&result, "tst-audit25a", 0,
08c3a6
+				      sc_allow_stderr);
08c3a6
+
08c3a6
+    /* With LD_BIND_NOW all symbols are expected to have
08c3a6
+       LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT.  Also the resolution
08c3a6
+       order is done in breadth-first order.  */
08c3a6
+    TEST_COMPARE_STRING (result.err.buffer,
08c3a6
+			 "la_symbind: tst_audit25mod4_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod3_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod1_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod2_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod1_func2 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod2_func2 1\n");
08c3a6
+
08c3a6
+    support_capture_subprocess_free (&result);
08c3a6
+  }
08c3a6
+
08c3a6
+  return 0;
08c3a6
+}
08c3a6
+
08c3a6
+#define TEST_FUNCTION_ARGV do_test
08c3a6
+#include <support/test-driver.c>
08c3a6
diff --git a/elf/tst-audit25b.c b/elf/tst-audit25b.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..a56638d501f9bff5
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit25b.c
08c3a6
@@ -0,0 +1,128 @@
08c3a6
+/* Check LD_AUDIT and LD_BIND_NOW.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <errno.h>
08c3a6
+#include <getopt.h>
08c3a6
+#include <limits.h>
08c3a6
+#include <inttypes.h>
08c3a6
+#include <string.h>
08c3a6
+#include <stdlib.h>
08c3a6
+#include <support/capture_subprocess.h>
08c3a6
+#include <support/check.h>
08c3a6
+#include <support/xstdio.h>
08c3a6
+#include <support/support.h>
08c3a6
+#include <sys/auxv.h>
08c3a6
+
08c3a6
+static int restart;
08c3a6
+#define CMDLINE_OPTIONS \
08c3a6
+  { "restart", no_argument, &restart, 1 },
08c3a6
+
08c3a6
+void tst_audit25mod1_func1 (void);
08c3a6
+void tst_audit25mod1_func2 (void);
08c3a6
+void tst_audit25mod2_func1 (void);
08c3a6
+void tst_audit25mod2_func2 (void);
08c3a6
+
08c3a6
+static int
08c3a6
+handle_restart (void)
08c3a6
+{
08c3a6
+  tst_audit25mod1_func1 ();
08c3a6
+  tst_audit25mod1_func2 ();
08c3a6
+  tst_audit25mod2_func1 ();
08c3a6
+  tst_audit25mod2_func2 ();
08c3a6
+
08c3a6
+  return 0;
08c3a6
+}
08c3a6
+
08c3a6
+static inline bool
08c3a6
+startswith (const char *str, const char *pre)
08c3a6
+{
08c3a6
+  size_t lenpre = strlen (pre);
08c3a6
+  size_t lenstr = strlen (str);
08c3a6
+  return lenstr >= lenpre && memcmp (pre, str, lenpre) == 0;
08c3a6
+}
08c3a6
+
08c3a6
+static int
08c3a6
+do_test (int argc, char *argv[])
08c3a6
+{
08c3a6
+  /* We must have either:
08c3a6
+     - One or four parameters left if called initially:
08c3a6
+       + path to ld.so         optional
08c3a6
+       + "--library-path"      optional
08c3a6
+       + the library path      optional
08c3a6
+       + the application name  */
08c3a6
+
08c3a6
+  if (restart)
08c3a6
+    return handle_restart ();
08c3a6
+
08c3a6
+  setenv ("LD_AUDIT", "tst-auditmod25.so", 0);
08c3a6
+
08c3a6
+  char *spargv[9];
08c3a6
+  int i = 0;
08c3a6
+  for (; i < argc - 1; i++)
08c3a6
+    spargv[i] = argv[i + 1];
08c3a6
+  spargv[i++] = (char *) "--direct";
08c3a6
+  spargv[i++] = (char *) "--restart";
08c3a6
+  spargv[i] = NULL;
08c3a6
+
08c3a6
+  {
08c3a6
+    struct support_capture_subprocess result
08c3a6
+      = support_capture_subprogram (spargv[0], spargv);
08c3a6
+    support_capture_subprocess_check (&result, "tst-audit25a", 0,
08c3a6
+				      sc_allow_stderr);
08c3a6
+
08c3a6
+    /* tst-audit25a and tst-audit25mod1 are built with -Wl,-z,now, but
08c3a6
+       tst-audit25mod2 is built with -Wl,-z,lazy.  So only
08c3a6
+       tst_audit25mod4_func1 (called by tst_audit25mod2_func1) should not
08c3a6
+       have LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT.  */
08c3a6
+    TEST_COMPARE_STRING (result.err.buffer,
08c3a6
+			 "la_symbind: tst_audit25mod3_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod1_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod2_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod1_func2 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod2_func2 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod4_func1 0\n");
08c3a6
+
08c3a6
+    support_capture_subprocess_free (&result);
08c3a6
+  }
08c3a6
+
08c3a6
+  {
08c3a6
+    setenv ("LD_BIND_NOW", "1", 0);
08c3a6
+    struct support_capture_subprocess result
08c3a6
+      = support_capture_subprogram (spargv[0], spargv);
08c3a6
+    support_capture_subprocess_check (&result, "tst-audit25a", 0,
08c3a6
+				      sc_allow_stderr);
08c3a6
+
08c3a6
+    /* With LD_BIND_NOW all symbols are expected to have
08c3a6
+       LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT.  Also the resolution
08c3a6
+       order is done in breadth-first order.  */
08c3a6
+    TEST_COMPARE_STRING (result.err.buffer,
08c3a6
+			 "la_symbind: tst_audit25mod4_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod3_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod1_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod2_func1 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod1_func2 1\n"
08c3a6
+			 "la_symbind: tst_audit25mod2_func2 1\n");
08c3a6
+
08c3a6
+    support_capture_subprocess_free (&result);
08c3a6
+  }
08c3a6
+
08c3a6
+  return 0;
08c3a6
+}
08c3a6
+
08c3a6
+#define TEST_FUNCTION_ARGV do_test
08c3a6
+#include <support/test-driver.c>
08c3a6
diff --git a/elf/tst-audit25mod1.c b/elf/tst-audit25mod1.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..a132e34a9b2cf51f
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit25mod1.c
08c3a6
@@ -0,0 +1,30 @@
08c3a6
+/* Module used by tst-audit25.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+void tst_audit25mod3_func1 (void);
08c3a6
+
08c3a6
+void
08c3a6
+tst_audit25mod1_func1 (void)
08c3a6
+{
08c3a6
+  tst_audit25mod3_func1 ();
08c3a6
+}
08c3a6
+
08c3a6
+void
08c3a6
+tst_audit25mod1_func2 (void)
08c3a6
+{
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit25mod2.c b/elf/tst-audit25mod2.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..92da26fa80b202c2
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit25mod2.c
08c3a6
@@ -0,0 +1,30 @@
08c3a6
+/* Module used by tst-audit25.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+void tst_audit25mod4_func1 (void);
08c3a6
+
08c3a6
+void
08c3a6
+tst_audit25mod2_func1 (void)
08c3a6
+{
08c3a6
+  tst_audit25mod4_func1 ();
08c3a6
+}
08c3a6
+
08c3a6
+void
08c3a6
+tst_audit25mod2_func2 (void)
08c3a6
+{
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit25mod3.c b/elf/tst-audit25mod3.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..af83e8919083adef
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit25mod3.c
08c3a6
@@ -0,0 +1,22 @@
08c3a6
+/* Module used by tst-audit25.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+void
08c3a6
+tst_audit25mod3_func1 (void)
08c3a6
+{
08c3a6
+}
08c3a6
diff --git a/elf/tst-audit25mod4.c b/elf/tst-audit25mod4.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..6cdf34357582da16
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-audit25mod4.c
08c3a6
@@ -0,0 +1,22 @@
08c3a6
+/* Module used by tst-audit25.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+void
08c3a6
+tst_audit25mod4_func1 (void)
08c3a6
+{
08c3a6
+}
08c3a6
diff --git a/elf/tst-auditmod24.h b/elf/tst-auditmod24.h
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..5fdbfef12dac2b2a
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-auditmod24.h
08c3a6
@@ -0,0 +1,29 @@
08c3a6
+/* Auxiliary functions for tst-audit24x.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#ifndef _TST_AUDITMOD24_H
08c3a6
+#define _TST_AUDITMOD24_H
08c3a6
+
08c3a6
+static void
08c3a6
+test_symbind_flags (unsigned int flags)
08c3a6
+{
08c3a6
+  if ((flags & (LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT)) == 0)
08c3a6
+    abort ();
08c3a6
+}
08c3a6
+
08c3a6
+#endif
08c3a6
diff --git a/elf/tst-auditmod24a.c b/elf/tst-auditmod24a.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..d8e88f3984af1707
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-auditmod24a.c
08c3a6
@@ -0,0 +1,114 @@
08c3a6
+/* Audit modules for tst-audit24a.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <link.h>
08c3a6
+#include <inttypes.h>
08c3a6
+#include <stdlib.h>
08c3a6
+#include <string.h>
08c3a6
+#include <tst-auditmod24.h>
08c3a6
+
08c3a6
+#define AUDIT24_COOKIE     0x1
08c3a6
+#define AUDIT24MOD1_COOKIE 0x2
08c3a6
+#define AUDIT24MOD2_COOKIE 0x3
08c3a6
+
08c3a6
+#ifndef TEST_NAME
08c3a6
+# define TEST_NAME "tst-audit24a"
08c3a6
+#endif
08c3a6
+#ifndef TEST_MOD
08c3a6
+# define TEST_MOD TEST_NAME
08c3a6
+#endif
08c3a6
+#ifndef TEST_FUNC
08c3a6
+# define TEST_FUNC "tst_audit24a"
08c3a6
+#endif
08c3a6
+
08c3a6
+unsigned int
08c3a6
+la_version (unsigned int version)
08c3a6
+{
08c3a6
+  return LAV_CURRENT;
08c3a6
+}
08c3a6
+
08c3a6
+unsigned int
08c3a6
+la_objopen (struct link_map *map, Lmid_t lmid, uintptr_t *cookie)
08c3a6
+{
08c3a6
+  const char *p = strrchr (map->l_name, '/');
08c3a6
+  const char *l_name = p == NULL ? TEST_NAME : p + 1;
08c3a6
+
08c3a6
+  uintptr_t ck = -1;
08c3a6
+  if (strcmp (l_name, TEST_MOD "mod1.so") == 0)
08c3a6
+    ck = AUDIT24MOD1_COOKIE;
08c3a6
+  else if (strcmp (l_name, TEST_MOD "mod2.so") == 0)
08c3a6
+    ck = AUDIT24MOD2_COOKIE;
08c3a6
+  else if (strcmp (l_name, TEST_NAME) == 0)
08c3a6
+    ck = AUDIT24_COOKIE;
08c3a6
+
08c3a6
+  *cookie = ck;
08c3a6
+  return ck == -1 ? 0 : LA_FLG_BINDFROM | LA_FLG_BINDTO;
08c3a6
+}
08c3a6
+
08c3a6
+static int
08c3a6
+tst_func1 (void)
08c3a6
+{
08c3a6
+  return 1;
08c3a6
+}
08c3a6
+
08c3a6
+static int
08c3a6
+tst_func2 (void)
08c3a6
+{
08c3a6
+  return 10;
08c3a6
+}
08c3a6
+
08c3a6
+#if __ELF_NATIVE_CLASS == 64
08c3a6
+uintptr_t
08c3a6
+la_symbind64 (Elf64_Sym *sym, unsigned int ndx,
08c3a6
+	      uintptr_t *refcook, uintptr_t *defcook,
08c3a6
+	      unsigned int *flags, const char *symname)
08c3a6
+#else
08c3a6
+uintptr_t
08c3a6
+la_symbind32 (Elf32_Sym *sym, unsigned int ndx,
08c3a6
+	      uintptr_t *refcook, uintptr_t *defcook,
08c3a6
+	      unsigned int *flags, const char *symname)
08c3a6
+#endif
08c3a6
+{
08c3a6
+  if (*refcook == AUDIT24_COOKIE)
08c3a6
+    {
08c3a6
+      if (*defcook == AUDIT24MOD1_COOKIE)
08c3a6
+	{
08c3a6
+	  /* Check if bind-now symbols are advertised to not call the PLT
08c3a6
+	     hooks.  */
08c3a6
+	  test_symbind_flags (*flags);
08c3a6
+
08c3a6
+	  if (strcmp (symname, TEST_FUNC "mod1_func1") == 0)
08c3a6
+	    return (uintptr_t) tst_func1;
08c3a6
+	  else if (strcmp (symname, TEST_FUNC "mod1_func2") == 0)
08c3a6
+	    return sym->st_value;
08c3a6
+	  abort ();
08c3a6
+	}
08c3a6
+      if (*defcook == AUDIT24MOD2_COOKIE
08c3a6
+	  && (strcmp (symname, TEST_FUNC "mod2_func1") == 0))
08c3a6
+	{
08c3a6
+	  test_symbind_flags (*flags);
08c3a6
+
08c3a6
+	  return (uintptr_t) tst_func2;
08c3a6
+	}
08c3a6
+
08c3a6
+      /* malloc functions.  */
08c3a6
+      return sym->st_value;
08c3a6
+    }
08c3a6
+
08c3a6
+  abort ();
08c3a6
+}
08c3a6
diff --git a/elf/tst-auditmod24b.c b/elf/tst-auditmod24b.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..e98f6d5ec528fe03
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-auditmod24b.c
08c3a6
@@ -0,0 +1,104 @@
08c3a6
+/* Audit modules for tst-audit24b.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <link.h>
08c3a6
+#include <inttypes.h>
08c3a6
+#include <stdlib.h>
08c3a6
+#include <string.h>
08c3a6
+#include <tst-auditmod24.h>
08c3a6
+
08c3a6
+#define TEST_NAME "tst-audit24b"
08c3a6
+#define TEST_FUNC "tst_audit24b"
08c3a6
+
08c3a6
+#define AUDIT24_COOKIE     0x1
08c3a6
+#define AUDIT24MOD1_COOKIE 0x2
08c3a6
+#define AUDIT24MOD2_COOKIE 0x3
08c3a6
+
08c3a6
+unsigned int
08c3a6
+la_version (unsigned int version)
08c3a6
+{
08c3a6
+  return LAV_CURRENT;
08c3a6
+}
08c3a6
+
08c3a6
+unsigned int
08c3a6
+la_objopen (struct link_map *map, Lmid_t lmid, uintptr_t *cookie)
08c3a6
+{
08c3a6
+  const char *p = strrchr (map->l_name, '/');
08c3a6
+  const char *l_name = p == NULL ? TEST_NAME : p + 1;
08c3a6
+
08c3a6
+  uintptr_t ck = -1;
08c3a6
+  if (strcmp (l_name, TEST_NAME "mod1.so") == 0)
08c3a6
+    ck = AUDIT24MOD1_COOKIE;
08c3a6
+  else if (strcmp (l_name, TEST_NAME "mod2.so") == 0)
08c3a6
+    ck = AUDIT24MOD2_COOKIE;
08c3a6
+  else if (strcmp (l_name, TEST_NAME) == 0)
08c3a6
+    ck = AUDIT24_COOKIE;
08c3a6
+
08c3a6
+  *cookie = ck;
08c3a6
+  return ck == -1 ? 0 : LA_FLG_BINDFROM | LA_FLG_BINDTO;
08c3a6
+}
08c3a6
+
08c3a6
+static int
08c3a6
+tst_func1 (void)
08c3a6
+{
08c3a6
+  return 1;
08c3a6
+}
08c3a6
+
08c3a6
+static int
08c3a6
+tst_func2 (void)
08c3a6
+{
08c3a6
+  return 2;
08c3a6
+}
08c3a6
+
08c3a6
+#if __ELF_NATIVE_CLASS == 64
08c3a6
+uintptr_t
08c3a6
+la_symbind64 (Elf64_Sym *sym, unsigned int ndx,
08c3a6
+	      uintptr_t *refcook, uintptr_t *defcook,
08c3a6
+	      unsigned int *flags, const char *symname)
08c3a6
+#else
08c3a6
+uintptr_t
08c3a6
+la_symbind32 (Elf32_Sym *sym, unsigned int ndx,
08c3a6
+	      uintptr_t *refcook, uintptr_t *defcook,
08c3a6
+	      unsigned int *flags, const char *symname)
08c3a6
+#endif
08c3a6
+{
08c3a6
+  if (*refcook == AUDIT24_COOKIE)
08c3a6
+    {
08c3a6
+      if (*defcook == AUDIT24MOD1_COOKIE)
08c3a6
+	  {
08c3a6
+	    if (strcmp (symname, TEST_FUNC "mod1_func1") == 0)
08c3a6
+	      return (uintptr_t) tst_func1;
08c3a6
+	    else if (strcmp (symname, TEST_FUNC "mod1_func2") == 0)
08c3a6
+	      return sym->st_value;
08c3a6
+	    abort ();
08c3a6
+	  }
08c3a6
+      /* malloc functions.  */
08c3a6
+      return sym->st_value;
08c3a6
+    }
08c3a6
+  else if (*refcook == AUDIT24MOD1_COOKIE)
08c3a6
+    {
08c3a6
+      if (*defcook == AUDIT24MOD2_COOKIE
08c3a6
+	  && (strcmp (symname, TEST_FUNC "mod2_func1") == 0))
08c3a6
+	{
08c3a6
+	  test_symbind_flags (*flags);
08c3a6
+	  return (uintptr_t) tst_func2;
08c3a6
+	}
08c3a6
+    }
08c3a6
+
08c3a6
+  abort ();
08c3a6
+}
08c3a6
diff --git a/elf/tst-auditmod24c.c b/elf/tst-auditmod24c.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..67e62c9d332f48a7
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-auditmod24c.c
08c3a6
@@ -0,0 +1,3 @@
08c3a6
+#define TEST_NAME "tst-audit24c"
08c3a6
+#define TEST_MOD  "tst-audit24a"
08c3a6
+#include "tst-auditmod24a.c"
08c3a6
diff --git a/elf/tst-auditmod24d.c b/elf/tst-auditmod24d.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..8c803ecc0a48f21b
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-auditmod24d.c
08c3a6
@@ -0,0 +1,120 @@
08c3a6
+/* Audit module for tst-audit24d.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <link.h>
08c3a6
+#include <inttypes.h>
08c3a6
+#include <stdlib.h>
08c3a6
+#include <string.h>
08c3a6
+#include <tst-auditmod24.h>
08c3a6
+
08c3a6
+#define AUDIT24_COOKIE     0x0
08c3a6
+#define AUDIT24MOD1_COOKIE 0x1
08c3a6
+#define AUDIT24MOD2_COOKIE 0x2
08c3a6
+#define AUDIT24MOD3_COOKIE 0x3
08c3a6
+#define AUDIT24MOD4_COOKIE 0x4
08c3a6
+
08c3a6
+unsigned int
08c3a6
+la_version (unsigned int version)
08c3a6
+{
08c3a6
+  return LAV_CURRENT;
08c3a6
+}
08c3a6
+
08c3a6
+unsigned int
08c3a6
+la_objopen (struct link_map *map, Lmid_t lmid, uintptr_t *cookie)
08c3a6
+{
08c3a6
+  const char *p = strrchr (map->l_name, '/');
08c3a6
+  const char *l_name = p == NULL ? "tst-audit24d" : p + 1;
08c3a6
+
08c3a6
+  uintptr_t ck = -1;
08c3a6
+  if (strcmp (l_name, "tst-audit24dmod1.so") == 0)
08c3a6
+    ck = AUDIT24MOD1_COOKIE;
08c3a6
+  else if (strcmp (l_name, "tst-audit24dmod2.so") == 0)
08c3a6
+    ck = AUDIT24MOD2_COOKIE;
08c3a6
+  else if (strcmp (l_name, "tst-audit24dmod3.so") == 0)
08c3a6
+    ck = AUDIT24MOD3_COOKIE;
08c3a6
+  else if (strcmp (l_name, "tst-audit24dmod.so") == 0)
08c3a6
+    ck = AUDIT24MOD4_COOKIE;
08c3a6
+  else if (strcmp (l_name, "tst-audit24d") == 0)
08c3a6
+    ck = AUDIT24_COOKIE;
08c3a6
+
08c3a6
+  *cookie = ck;
08c3a6
+  return ck == -1 ? 0 : LA_FLG_BINDFROM | LA_FLG_BINDTO;
08c3a6
+}
08c3a6
+
08c3a6
+static int
08c3a6
+tst_audit24dmod1_func1 (void)
08c3a6
+{
08c3a6
+  return 1;
08c3a6
+}
08c3a6
+
08c3a6
+static int
08c3a6
+tst_audit24dmod2_func1 (void)
08c3a6
+{
08c3a6
+  return 10;
08c3a6
+}
08c3a6
+
08c3a6
+static int
08c3a6
+tst_audit24dmod3_func1 (void)
08c3a6
+{
08c3a6
+  return 30;
08c3a6
+}
08c3a6
+
08c3a6
+#include <stdio.h>
08c3a6
+
08c3a6
+#if __ELF_NATIVE_CLASS == 64
08c3a6
+uintptr_t
08c3a6
+la_symbind64 (Elf64_Sym *sym, unsigned int ndx,
08c3a6
+	      uintptr_t *refcook, uintptr_t *defcook,
08c3a6
+	      unsigned int *flags, const char *symname)
08c3a6
+#else
08c3a6
+uintptr_t
08c3a6
+la_symbind32 (Elf32_Sym *sym, unsigned int ndx,
08c3a6
+	      uintptr_t *refcook, uintptr_t *defcook,
08c3a6
+	      unsigned int *flags, const char *symname)
08c3a6
+#endif
08c3a6
+{
08c3a6
+  if (*refcook == AUDIT24_COOKIE)
08c3a6
+    {
08c3a6
+      if (*defcook == AUDIT24MOD1_COOKIE)
08c3a6
+	  {
08c3a6
+	    if (strcmp (symname, "tst_audit24dmod1_func1") == 0)
08c3a6
+	      return (uintptr_t) tst_audit24dmod1_func1;
08c3a6
+	    else if (strcmp (symname, "tst_audit24dmod1_func2") == 0)
08c3a6
+	      return sym->st_value;
08c3a6
+	    abort ();
08c3a6
+	  }
08c3a6
+      if (*defcook == AUDIT24MOD2_COOKIE
08c3a6
+	  && (strcmp (symname, "tst_audit24dmod2_func1") == 0))
08c3a6
+	return (uintptr_t) tst_audit24dmod2_func1;
08c3a6
+
08c3a6
+      /* malloc functions.  */
08c3a6
+      return sym->st_value;
08c3a6
+    }
08c3a6
+  else if (*refcook == AUDIT24MOD1_COOKIE)
08c3a6
+    {
08c3a6
+      if (*defcook == AUDIT24MOD3_COOKIE
08c3a6
+	  && strcmp (symname, "tst_audit24dmod3_func1") == 0)
08c3a6
+	{
08c3a6
+	  test_symbind_flags (*flags);
08c3a6
+
08c3a6
+	  return (uintptr_t) tst_audit24dmod3_func1;
08c3a6
+	}
08c3a6
+    }
08c3a6
+
08c3a6
+  abort ();
08c3a6
+}
08c3a6
diff --git a/elf/tst-auditmod25.c b/elf/tst-auditmod25.c
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..526f5c54bc2c3b8c
08c3a6
--- /dev/null
08c3a6
+++ b/elf/tst-auditmod25.c
08c3a6
@@ -0,0 +1,79 @@
08c3a6
+/* Audit modules for tst-audit25a.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#include <link.h>
08c3a6
+#include <inttypes.h>
08c3a6
+#include <stdlib.h>
08c3a6
+#include <string.h>
08c3a6
+#include <stdio.h>
08c3a6
+
08c3a6
+#define AUDIT25_COOKIE     0x1
08c3a6
+#define AUDIT25MOD1_COOKIE 0x2
08c3a6
+#define AUDIT25MOD2_COOKIE 0x3
08c3a6
+#define AUDIT25MOD3_COOKIE 0x2
08c3a6
+#define AUDIT25MOD4_COOKIE 0x3
08c3a6
+
08c3a6
+#define TEST_NAME "tst-audit25"
08c3a6
+#define TEST_MOD  "tst-audit25"
08c3a6
+#define TEST_FUNC "tst_audit25"
08c3a6
+
08c3a6
+unsigned int
08c3a6
+la_version (unsigned int version)
08c3a6
+{
08c3a6
+  return LAV_CURRENT;
08c3a6
+}
08c3a6
+
08c3a6
+unsigned int
08c3a6
+la_objopen (struct link_map *map, Lmid_t lmid, uintptr_t *cookie)
08c3a6
+{
08c3a6
+  const char *p = strrchr (map->l_name, '/');
08c3a6
+  const char *l_name = p == NULL ? TEST_NAME : p + 1;
08c3a6
+
08c3a6
+  uintptr_t ck = -1;
08c3a6
+  if (strcmp (l_name, TEST_MOD "mod1.so") == 0)
08c3a6
+    ck = AUDIT25MOD1_COOKIE;
08c3a6
+  else if (strcmp (l_name, TEST_MOD "mod2.so") == 0)
08c3a6
+    ck = AUDIT25MOD2_COOKIE;
08c3a6
+  else if (strcmp (l_name, TEST_MOD "mod3.so") == 0)
08c3a6
+    ck = AUDIT25MOD3_COOKIE;
08c3a6
+  else if (strcmp (l_name, TEST_MOD "mod4.so") == 0)
08c3a6
+    ck = AUDIT25MOD4_COOKIE;
08c3a6
+  else if (strncmp (l_name, TEST_NAME, strlen (TEST_NAME)) == 0)
08c3a6
+    ck = AUDIT25_COOKIE;
08c3a6
+
08c3a6
+  *cookie = ck;
08c3a6
+  return ck == -1 ? 0 : LA_FLG_BINDFROM | LA_FLG_BINDTO;
08c3a6
+}
08c3a6
+
08c3a6
+#if __ELF_NATIVE_CLASS == 64
08c3a6
+uintptr_t
08c3a6
+la_symbind64 (Elf64_Sym *sym, unsigned int ndx,
08c3a6
+	      uintptr_t *refcook, uintptr_t *defcook,
08c3a6
+	      unsigned int *flags, const char *symname)
08c3a6
+#else
08c3a6
+uintptr_t
08c3a6
+la_symbind32 (Elf32_Sym *sym, unsigned int ndx,
08c3a6
+	      uintptr_t *refcook, uintptr_t *defcook,
08c3a6
+	      unsigned int *flags, const char *symname)
08c3a6
+#endif
08c3a6
+{
08c3a6
+  if (*refcook != -1 && *defcook != -1)
08c3a6
+    fprintf (stderr, "la_symbind: %s %u\n", symname,
08c3a6
+	     *flags & (LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT) ? 1 : 0);
08c3a6
+  return sym->st_value;
08c3a6
+}
08c3a6
diff --git a/sysdeps/generic/dl-lookupcfg.h b/sysdeps/generic/dl-lookupcfg.h
08c3a6
index c038c31ce6550059..a15fd32771d42f2a 100644
08c3a6
--- a/sysdeps/generic/dl-lookupcfg.h
08c3a6
+++ b/sysdeps/generic/dl-lookupcfg.h
08c3a6
@@ -26,3 +26,6 @@
08c3a6
 #define DL_FIXUP_VALUE_CODE_ADDR(value) (value)
08c3a6
 #define DL_FIXUP_VALUE_ADDR(value) (value)
08c3a6
 #define DL_FIXUP_ADDR_VALUE(addr) (addr)
08c3a6
+#define DL_FIXUP_BINDNOW_ADDR_VALUE(addr) (addr)
08c3a6
+#define DL_FIXUP_BINDNOW_RELOC(value, new_value, st_value) \
08c3a6
+  (*value) = st_value;
08c3a6
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
08c3a6
index a56060d0204cc453..a38de94bf7ea8e93 100644
08c3a6
--- a/sysdeps/generic/ldsodefs.h
08c3a6
+++ b/sysdeps/generic/ldsodefs.h
08c3a6
@@ -1403,7 +1403,10 @@ void _dl_audit_objclose (struct link_map *l)
08c3a6
 /* Call the la_preinit from the audit modules for the link_map L.  */
08c3a6
 void _dl_audit_preinit (struct link_map *l);
08c3a6
 
08c3a6
-/* Call the la_symbind{32,64} from the audit modules for the link_map L.  */
08c3a6
+/* Call the la_symbind{32,64} from the audit modules for the link_map L.  If
08c3a6
+   RELOC_RESULT is NULL it assumes the symbol to be bind-now and will set
08c3a6
+   the flags with LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT prior calling
08c3a6
+   la_symbind{32,64}.  */
08c3a6
 void _dl_audit_symbind (struct link_map *l, struct reloc_result *reloc_result,
08c3a6
 			const ElfW(Sym) *defsym, DL_FIXUP_VALUE_TYPE *value,
08c3a6
 			lookup_t result)
08c3a6
diff --git a/sysdeps/hppa/dl-lookupcfg.h b/sysdeps/hppa/dl-lookupcfg.h
08c3a6
index 2f6991aa16e87a00..f4f00714fa158e18 100644
08c3a6
--- a/sysdeps/hppa/dl-lookupcfg.h
08c3a6
+++ b/sysdeps/hppa/dl-lookupcfg.h
08c3a6
@@ -81,3 +81,6 @@ void attribute_hidden _dl_unmap (struct link_map *map);
08c3a6
 #define DL_FIXUP_VALUE_CODE_ADDR(value) ((value).ip)
08c3a6
 #define DL_FIXUP_VALUE_ADDR(value) ((uintptr_t) &(value))
08c3a6
 #define DL_FIXUP_ADDR_VALUE(addr) (*(struct fdesc *) (addr))
08c3a6
+#define DL_FIXUP_BINDNOW_ADDR_VALUE(addr) (addr)
08c3a6
+#define DL_FIXUP_BINDNOW_RELOC(value, new_value, st_value) \
08c3a6
+  (*value) = *(struct fdesc *) (st_value)
08c3a6
diff --git a/sysdeps/ia64/dl-lookupcfg.h b/sysdeps/ia64/dl-lookupcfg.h
08c3a6
index 58ca32424b08aaf4..2b8b2fa5db9d7093 100644
08c3a6
--- a/sysdeps/ia64/dl-lookupcfg.h
08c3a6
+++ b/sysdeps/ia64/dl-lookupcfg.h
08c3a6
@@ -74,3 +74,6 @@ extern void attribute_hidden _dl_unmap (struct link_map *map);
08c3a6
 
08c3a6
 #define DL_FIXUP_VALUE_ADDR(value) ((uintptr_t) &(value))
08c3a6
 #define DL_FIXUP_ADDR_VALUE(addr) (*(struct fdesc *) (addr))
08c3a6
+#define DL_FIXUP_BINDNOW_ADDR_VALUE(addr) (addr)
08c3a6
+#define DL_FIXUP_BINDNOW_RELOC(value, new_value, st_value) \
08c3a6
+  (*value) = *(struct fdesc *) (st_value)
08c3a6
diff --git a/sysdeps/powerpc/dl-lookupcfg.h b/sysdeps/powerpc/dl-lookupcfg.h
08c3a6
new file mode 100644
08c3a6
index 0000000000000000..25abcc1d12b15bfc
08c3a6
--- /dev/null
08c3a6
+++ b/sysdeps/powerpc/dl-lookupcfg.h
08c3a6
@@ -0,0 +1,39 @@
08c3a6
+/* Configuration of lookup functions.  PowerPC version.
08c3a6
+   Copyright (C) 2022 Free Software Foundation, Inc.
08c3a6
+   This file is part of the GNU C Library.
08c3a6
+
08c3a6
+   The GNU C Library is free software; you can redistribute it and/or
08c3a6
+   modify it under the terms of the GNU Lesser General Public
08c3a6
+   License as published by the Free Software Foundation; either
08c3a6
+   version 2.1 of the License, or (at your option) any later version.
08c3a6
+
08c3a6
+   The GNU C Library is distributed in the hope that it will be useful,
08c3a6
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
08c3a6
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
08c3a6
+   Lesser General Public License for more details.
08c3a6
+
08c3a6
+   You should have received a copy of the GNU Lesser General Public
08c3a6
+   License along with the GNU C Library; if not, see
08c3a6
+   <https://www.gnu.org/licenses/>.  */
08c3a6
+
08c3a6
+#define DL_FIXUP_VALUE_TYPE ElfW(Addr)
08c3a6
+#define DL_FIXUP_MAKE_VALUE(map, addr) (addr)
08c3a6
+#define DL_FIXUP_VALUE_CODE_ADDR(value) (value)
08c3a6
+#define DL_FIXUP_VALUE_ADDR(value) (value)
08c3a6
+#define DL_FIXUP_ADDR_VALUE(addr) (addr)
08c3a6
+#if __WORDSIZE == 64 && _CALL_ELF == 1
08c3a6
+/* We need to correctly set the audit modules value for bind-now.  */
08c3a6
+# define DL_FIXUP_BINDNOW_ADDR_VALUE(addr) \
08c3a6
+ (((Elf64_FuncDesc *)(addr))->fd_func)
08c3a6
+# define DL_FIXUP_BINDNOW_RELOC(value, new_value, st_value)	\
08c3a6
+ ({								\
08c3a6
+    Elf64_FuncDesc *opd = (Elf64_FuncDesc *) (value);		\
08c3a6
+    opd->fd_func = (st_value);					\
08c3a6
+    if ((new_value) != (uintptr_t) (st_value))			\
08c3a6
+     opd->fd_toc = ((Elf64_FuncDesc *)(new_value))->fd_toc;	\
08c3a6
+  })
08c3a6
+#else
08c3a6
+# define DL_FIXUP_BINDNOW_ADDR_VALUE(addr) (addr)
08c3a6
+# define DL_FIXUP_BINDNOW_RELOC(value, new_value, st_value)	\
08c3a6
+  (*value) = st_value;
08c3a6
+#endif