199282790SJohn Baldwin /* LINTLIBRARY */ 299282790SJohn Baldwin /*- 399282790SJohn Baldwin * SPDX-License-Identifier: BSD-4-Clause 499282790SJohn Baldwin * 599282790SJohn Baldwin * Copyright 2001 David E. O'Brien. 699282790SJohn Baldwin * All rights reserved. 799282790SJohn Baldwin * Copyright 1996-1998 John D. Polstra. 899282790SJohn Baldwin * All rights reserved. 999282790SJohn Baldwin * Copyright (c) 1997 Jason R. Thorpe. 1099282790SJohn Baldwin * Copyright (c) 1995 Christopher G. Demetriou 1199282790SJohn Baldwin * All rights reserved. 1299282790SJohn Baldwin * 1399282790SJohn Baldwin * Redistribution and use in source and binary forms, with or without 1499282790SJohn Baldwin * modification, are permitted provided that the following conditions 1599282790SJohn Baldwin * are met: 1699282790SJohn Baldwin * 1. Redistributions of source code must retain the above copyright 1799282790SJohn Baldwin * notice, this list of conditions and the following disclaimer. 1899282790SJohn Baldwin * 2. Redistributions in binary form must reproduce the above copyright 1999282790SJohn Baldwin * notice, this list of conditions and the following disclaimer in the 2099282790SJohn Baldwin * documentation and/or other materials provided with the distribution. 2199282790SJohn Baldwin * 3. All advertising materials mentioning features or use of this software 2299282790SJohn Baldwin * must display the following acknowledgement: 2399282790SJohn Baldwin * This product includes software developed for the 2499282790SJohn Baldwin * FreeBSD Project. See https://www.freebsd.org/ for 2599282790SJohn Baldwin * information about FreeBSD. 2699282790SJohn Baldwin * This product includes software developed for the 2799282790SJohn Baldwin * NetBSD Project. See http://www.netbsd.org/ for 2899282790SJohn Baldwin * information about NetBSD. 2999282790SJohn Baldwin * 4. The name of the author may not be used to endorse or promote products 3099282790SJohn Baldwin * derived from this software without specific prior written permission 3199282790SJohn Baldwin * 3299282790SJohn Baldwin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 3399282790SJohn Baldwin * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 3499282790SJohn Baldwin * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 3599282790SJohn Baldwin * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 3699282790SJohn Baldwin * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 3799282790SJohn Baldwin * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3899282790SJohn Baldwin * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3999282790SJohn Baldwin * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 4099282790SJohn Baldwin * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 4199282790SJohn Baldwin * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4299282790SJohn Baldwin */ 4399282790SJohn Baldwin 4499282790SJohn Baldwin #include <sys/cdefs.h> 4599282790SJohn Baldwin __FBSDID("$FreeBSD$"); 4699282790SJohn Baldwin 4799282790SJohn Baldwin #include <sys/param.h> 4899282790SJohn Baldwin #include <sys/elf_common.h> 4999282790SJohn Baldwin 5099282790SJohn Baldwin #include "libc_private.h" 51*51015e6dSKonstantin Belousov #include "csu_common.h" 5299282790SJohn Baldwin 5399282790SJohn Baldwin struct Struct_Obj_Entry; 5499282790SJohn Baldwin struct ps_strings; 5599282790SJohn Baldwin 56*51015e6dSKonstantin Belousov void _start(int, char **, char **, const struct Struct_Obj_Entry *, 57*51015e6dSKonstantin Belousov void (*)(void), struct ps_strings *) __dead2; 5899282790SJohn Baldwin 5999282790SJohn Baldwin struct ps_strings *__ps_strings; 6099282790SJohn Baldwin 6199282790SJohn Baldwin void __start(int, char **, char **, struct ps_strings *, 62*51015e6dSKonstantin Belousov const struct Struct_Obj_Entry *, void (*)(void)) __dead2; 6399282790SJohn Baldwin 6499282790SJohn Baldwin void 6599282790SJohn Baldwin __start(int argc, char **argv, char **env, struct ps_strings *ps_strings, 6699282790SJohn Baldwin const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void)) 6799282790SJohn Baldwin { 6899282790SJohn Baldwin if (ps_strings != (struct ps_strings *)0) 6999282790SJohn Baldwin __ps_strings = ps_strings; 7099282790SJohn Baldwin 7199282790SJohn Baldwin #ifdef GCRT 72*51015e6dSKonstantin Belousov __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext); 73*51015e6dSKonstantin Belousov #else 74*51015e6dSKonstantin Belousov __libc_start1(argc, argv, env, cleanup, main); 7599282790SJohn Baldwin #endif 7699282790SJohn Baldwin } 7799282790SJohn Baldwin 7899282790SJohn Baldwin #ifdef GCRT 7999282790SJohn Baldwin __asm__(".text"); 8099282790SJohn Baldwin __asm__("eprol:"); 8199282790SJohn Baldwin __asm__(".previous"); 8299282790SJohn Baldwin #endif 83