Back to index

glibc  2.9
dl-sysdep.c
Go to the documentation of this file.
00001 /* Operating system support for run-time dynamic linker.  Linux/PPC version.
00002    Copyright (C) 1997, 1998, 2001, 2003, 2006, 2007
00003    Free Software Foundation, Inc.
00004    This file is part of the GNU C Library.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #include <config.h>
00022 #include <kernel-features.h>
00023 #include <ldsodefs.h>
00024 
00025 int __cache_line_size attribute_hidden;
00026 
00027 /* Scan the Aux Vector for the "Data Cache Block Size" entry.  If found
00028    verify that the static extern __cache_line_size is defined by checking
00029    for not NULL.  If it is defined then assign the cache block size
00030    value to __cache_line_size.  */
00031 #define DL_PLATFORM_AUXV                                             \
00032       case AT_DCACHEBSIZE:                                           \
00033        __cache_line_size = av->a_un.a_val;                                  \
00034        break;
00035 
00036 #ifndef __ASSUME_STD_AUXV
00037 
00038 /* The PowerPC's auxiliary argument block gets aligned to a 16-byte
00039    boundary.  This is history and impossible to change compatibly.  */
00040 
00041 #define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \
00042   do {                                                               \
00043     char **_tmp;                                                     \
00044     size_t _test;                                                    \
00045     (argc) = *(long int *) cookie;                                   \
00046     (argv) = (char **) cookie + 1;                                   \
00047     (envp) = (argv) + (argc) + 1;                                    \
00048     for (_tmp = (envp); *_tmp; ++_tmp)                                      \
00049       continue;                                                             \
00050     /* The following '++' is important!  */                                 \
00051     ++_tmp;                                                          \
00052                                                                      \
00053     _test = (size_t)_tmp;                                            \
00054     _test = (_test + 0xf) & ~0xf;                                    \
00055     /* Under some circumstances, MkLinux (up to at least DR3a5)                    \
00056        omits the padding.  To work around this, we make a                   \
00057        basic sanity check of the argument vector.  Of                       \
00058        course, this means that in future, the argument                      \
00059        vector will have to be laid out to allow for this                    \
00060        test :-(.  */                                                 \
00061      if (((ElfW(auxv_t) *)_test)->a_type <= 0x10)                           \
00062        _tmp = (char **)_test;                                               \
00063     (auxp) = (ElfW(auxv_t) *) _tmp;                                         \
00064   } while (0)
00065 #endif
00066 
00067 #include <sysdeps/unix/sysv/linux/dl-sysdep.c>