08c3a6
commit 458733fffe2c410418b5f633ffd6ed65efd2aac0
08c3a6
Author: Florian Weimer <fweimer@redhat.com>
08c3a6
Date:   Thu Feb 3 10:58:59 2022 +0100
08c3a6
08c3a6
    Linux: Remove DL_FIND_ARG_COMPONENTS
08c3a6
    
08c3a6
    The generic definition is always used since the Native Client
08c3a6
    port has been removed.
08c3a6
    
08c3a6
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
08c3a6
    (cherry picked from commit 2d47fa68628e831a692cba8fc9050cef435afc5e)
08c3a6
08c3a6
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
08c3a6
index aae983777ba15fae..e36b3e6b63b1aa7e 100644
08c3a6
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
08c3a6
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
08c3a6
@@ -59,19 +59,6 @@ void *__libc_stack_end attribute_relro = NULL;
08c3a6
 rtld_hidden_data_def(__libc_stack_end)
08c3a6
 void *_dl_random attribute_relro = NULL;
08c3a6
 
08c3a6
-#ifndef DL_FIND_ARG_COMPONENTS
08c3a6
-# define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp)	\
08c3a6
-  do {									      \
08c3a6
-    void **_tmp;							      \
08c3a6
-    (argc) = *(long int *) cookie;					      \
08c3a6
-    (argv) = (char **) ((long int *) cookie + 1);			      \
08c3a6
-    (envp) = (argv) + (argc) + 1;					      \
08c3a6
-    for (_tmp = (void **) (envp); *_tmp; ++_tmp)			      \
08c3a6
-      continue;								      \
08c3a6
-    (auxp) = (void *) ++_tmp;						      \
08c3a6
-  } while (0)
08c3a6
-#endif
08c3a6
-
08c3a6
 #ifndef DL_STACK_END
08c3a6
 # define DL_STACK_END(cookie) ((void *) (cookie))
08c3a6
 #endif
08c3a6
@@ -90,8 +77,16 @@ _dl_sysdep_start (void **start_argptr,
08c3a6
 #endif
08c3a6
 
08c3a6
   __libc_stack_end = DL_STACK_END (start_argptr);
08c3a6
-  DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, _dl_argv, _environ,
08c3a6
-			  GLRO(dl_auxv));
08c3a6
+  _dl_argc = (intptr_t) *start_argptr;
08c3a6
+  _dl_argv = (char **) (start_argptr + 1); /* Necessary aliasing violation.  */
08c3a6
+  _environ = _dl_argv + _dl_argc + 1;
08c3a6
+  for (char **tmp = _environ + 1; ; ++tmp)
08c3a6
+    if (*tmp == NULL)
08c3a6
+      {
08c3a6
+	/* Another necessary aliasing violation.  */
08c3a6
+	GLRO(dl_auxv) = (ElfW(auxv_t) *) (tmp + 1);
08c3a6
+	break;
08c3a6
+      }
08c3a6
 
08c3a6
   user_entry = (ElfW(Addr)) ENTRY_POINT;
08c3a6
   GLRO(dl_platform) = NULL; /* Default to nothing known about the platform.  */