1/*- 2 * Copyright 2001 David E. O'Brien. 3 * All rights reserved. 4 * Copyright 1996-1998 John D. Polstra. 5 * All rights reserved. 6 * Copyright (c) 1997 Jason R. Thorpe. 7 * Copyright (c) 1995 Christopher G. Demetriou 8 * All rights reserved. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed for the 21 * FreeBSD Project. See http://www.freebsd.org/ for 22 * information about FreeBSD. 23 * This product includes software developed for the 24 * NetBSD Project. See http://www.netbsd.org/ for 25 * information about NetBSD. 26 * 4. The name of the author may not be used to endorse or promote products 27 * derived from this software without specific prior written permission 28 * 29 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 30 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 31 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 32 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 33 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 34 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 38 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 */ 40 41#ifndef __GNUC__ 42#error "GCC is needed to compile this file" 43#endif 44 45#include <stdlib.h> 46#include "crtbrand.c" 47 48struct Struct_Obj_Entry; 49struct ps_strings; 50 51#pragma weak _DYNAMIC 52extern int _DYNAMIC; 53 54extern void _init(void); 55extern void _fini(void); 56extern int main(int, char **, char **); 57 58#ifdef GCRT 59extern void _mcleanup(void); 60extern void monstartup(void *, void *); 61extern int eprol; 62extern int etext; 63#endif 64 65/* 66 * First 5 arguments are specified by the PowerPC SVR4 ABI. 67 * The last argument, ps_strings, is a BSD extension. 68 */ 69void _start __P((int, char **, char **, const struct Struct_Obj_Entry *, 70 void (*) __P((void)), struct ps_strings *)); 71 72char **environ; 73char *__progname = ""; 74struct ps_strings *__ps_strings; 75 76/* The entry function. */ 77void 78_start(argc, argv, envp, obj, cleanup, ps_strings) 79 int argc; 80 char **argv, **envp; 81 const struct Struct_Obj_Entry *obj; /* from shared loader */ 82 void (*cleanup) __P((void)); /* from shared loader */ 83 struct ps_strings *ps_strings; /* BSD extension */ 84{ 85 char *namep; 86 87 environ = envp; 88
|