Update.
[jlayton/glibc.git] / sysdeps / unix / sysv / linux / powerpc / dl-sysdep.c
1 /* Operating system support for run-time dynamic linker.  Linux/PPC version.
2    Copyright (C) 1997, 1998 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Library General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Library General Public License for more details.
14
15    You should have received a copy of the GNU Library General Public
16    License along with the GNU C Library; see the file COPYING.LIB.  If not,
17    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18    Boston, MA 02111-1307, USA.  */
19
20
21 /* The PowerPC's auxiliary argument block gets aligned to a 16-byte
22    boundary.  This is history and impossible to change compatibly.  */
23
24 #define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp)  \
25   do {                                                          \
26     char **_tmp;                                                \
27     (argc) = *(long *) cookie;                                  \
28     (argv) = (char **) cookie + 1;                              \
29     (envp) = (argv) + (argc) + 1;                               \
30     for (_tmp = (envp); *_tmp; ++_tmp)                          \
31       continue;                                                 \
32     /* The following '++' is important!  */                     \
33     ++_tmp;                                                     \
34     if (*_tmp == 0)                                             \
35       {                                                         \
36         size_t _test = (size_t)_tmp;                            \
37         _test = _test + 0xf & ~0xf;                             \
38         /* When ld.so is being run directly, there is no        \
39            alignment (and no argument vector), so we make a     \
40            basic sanity check of the argument vector.  Of       \
41            course, this means that in future, the argument      \
42            vector will have to be laid out to allow for this    \
43            test :-(.  */                                        \
44         if (((ElfW(auxv_t) *)_test)->a_type <= AT_PHDR)         \
45       }                                                         \
46     (auxp) = (ElfW(auxv_t) *) _tmp;                             \
47   } while (0)
48
49
50 #include <sysdeps/unix/sysv/linux/dl-sysdep.c>