1 /* Parse the Linux auxiliary vector.
2 Copyright (C) 1995-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
21 #include <fpu_control.h>
25 typedef ElfW(Addr
) dl_parse_auxv_t
[AT_MINSIGSTKSZ
+ 1];
27 /* Copy the auxiliary vector into AUXV_VALUES and set up GLRO
30 void _dl_parse_auxv (ElfW(auxv_t
) *av
, dl_parse_auxv_t auxv_values
)
32 auxv_values
[AT_ENTRY
] = (ElfW(Addr
)) ENTRY_POINT
;
33 auxv_values
[AT_PAGESZ
] = EXEC_PAGESIZE
;
34 auxv_values
[AT_FPUCW
] = _FPU_DEFAULT
;
36 /* NB: Default to a constant CONSTANT_MINSIGSTKSZ. */
37 _Static_assert (__builtin_constant_p (CONSTANT_MINSIGSTKSZ
),
38 "CONSTANT_MINSIGSTKSZ is constant");
39 auxv_values
[AT_MINSIGSTKSZ
] = CONSTANT_MINSIGSTKSZ
;
41 for (; av
->a_type
!= AT_NULL
; av
++)
42 if (av
->a_type
<= AT_MINSIGSTKSZ
)
43 auxv_values
[av
->a_type
] = av
->a_un
.a_val
;
45 GLRO(dl_pagesize
) = auxv_values
[AT_PAGESZ
];
46 __libc_enable_secure
= auxv_values
[AT_SECURE
];
47 GLRO(dl_platform
) = (void *) auxv_values
[AT_PLATFORM
];
48 GLRO(dl_hwcap
) = auxv_values
[AT_HWCAP
];
49 GLRO(dl_hwcap2
) = auxv_values
[AT_HWCAP2
];
50 GLRO(dl_clktck
) = auxv_values
[AT_CLKTCK
];
51 GLRO(dl_fpu_control
) = auxv_values
[AT_FPUCW
];
52 _dl_random
= (void *) auxv_values
[AT_RANDOM
];
53 GLRO(dl_minsigstacksize
) = auxv_values
[AT_MINSIGSTKSZ
];
54 GLRO(dl_sysinfo_dso
) = (void *) auxv_values
[AT_SYSINFO_EHDR
];
55 #ifdef NEED_DL_SYSINFO
56 if (GLRO(dl_sysinfo_dso
) != NULL
)
57 GLRO(dl_sysinfo
) = auxv_values
[AT_SYSINFO
];