libc_start1.c (241a55b4615ef671583db13e6729b0028539c063) libc_start1.c (9684658e35ab033c79e0519e3681d9a194976b71)
1/*-
2 * SPDX-License-Identifier: BSD-1-Clause
3 *
4 * Copyright 2012 Konstantin Belousov <kib@FreeBSD.org>
5 * Copyright (c) 2018, 2023 The FreeBSD Foundation
6 *
7 * Parts of this software was developed by Konstantin Belousov
8 * <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation.

--- 123 unchanged lines hidden (view full) ---

132 __progname = argv[0];
133 for (s = __progname; *s != '\0'; s++) {
134 if (*s == '/')
135 __progname = s + 1;
136 }
137 }
138}
139
1/*-
2 * SPDX-License-Identifier: BSD-1-Clause
3 *
4 * Copyright 2012 Konstantin Belousov <kib@FreeBSD.org>
5 * Copyright (c) 2018, 2023 The FreeBSD Foundation
6 *
7 * Parts of this software was developed by Konstantin Belousov
8 * <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation.

--- 123 unchanged lines hidden (view full) ---

132 __progname = argv[0];
133 for (s = __progname; *s != '\0'; s++) {
134 if (*s == '/')
135 __progname = s + 1;
136 }
137 }
138}
139
140static void
141handle_irelocs(char *env[])
142{
143#ifndef CRT_IRELOC_SUPPRESS
144 const Elf_Auxinfo *aux;
145
146 /* Find the auxiliary vector on the stack. */
147 while (*env++ != 0) /* Skip over environment, and NULL terminator */
148 ;
149 aux = (const Elf_Auxinfo *)env;
150
151 ifunc_init(aux);
152 process_irelocs();
153#else
154 (void)env;
155#endif
156}
157
140void
141__libc_start1(int argc, char *argv[], char *env[], void (*cleanup)(void),
142 int (*mainX)(int, char *[], char *[]))
143{
144 handle_argv(argc, argv, env);
145
146 if (&_DYNAMIC != NULL) {
147 atexit(cleanup);
148 } else {
158void
159__libc_start1(int argc, char *argv[], char *env[], void (*cleanup)(void),
160 int (*mainX)(int, char *[], char *[]))
161{
162 handle_argv(argc, argv, env);
163
164 if (&_DYNAMIC != NULL) {
165 atexit(cleanup);
166 } else {
149#ifndef CRT_IRELOC_SUPPRESS
150 INIT_IRELOCS;
151 process_irelocs();
152#endif
167 handle_irelocs(env);
153 _init_tls();
154 }
155
156 handle_static_init(argc, argv, env);
157 exit(mainX(argc, argv, env));
158}
159
160/* XXXKIB _mcleanup and monstartup defs */

--- 5 unchanged lines hidden (view full) ---

166 void (*cleanup)(void), int (*mainX)(int, char *[], char *[]),
167 int *eprolp, int *etextp)
168{
169 handle_argv(argc, argv, env);
170
171 if (&_DYNAMIC != NULL) {
172 atexit(cleanup);
173 } else {
168 _init_tls();
169 }
170
171 handle_static_init(argc, argv, env);
172 exit(mainX(argc, argv, env));
173}
174
175/* XXXKIB _mcleanup and monstartup defs */

--- 5 unchanged lines hidden (view full) ---

181 void (*cleanup)(void), int (*mainX)(int, char *[], char *[]),
182 int *eprolp, int *etextp)
183{
184 handle_argv(argc, argv, env);
185
186 if (&_DYNAMIC != NULL) {
187 atexit(cleanup);
188 } else {
174#ifndef CRT_IRELOC_SUPPRESS
175 INIT_IRELOCS;
176 process_irelocs();
177#endif
189 handle_irelocs(env);
178 _init_tls();
179 }
180
181 atexit(_mcleanup);
182 monstartup(eprolp, etextp);
183
184 handle_static_init(argc, argv, env);
185 exit(mainX(argc, argv, env));
186}
190 _init_tls();
191 }
192
193 atexit(_mcleanup);
194 monstartup(eprolp, etextp);
195
196 handle_static_init(argc, argv, env);
197 exit(mainX(argc, argv, env));
198}