Deleted Added
full compact
crt1.c (81586) crt1.c (91430)
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
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
89 if(argc > 0 && argv[0] != NULL) {
89 if (argc > 0 && argv[0] != NULL) {
90 char *s;
91 __progname = argv[0];
92 for (s = __progname; *s != '\0'; s++)
93 if (*s == '/')
94 __progname = s + 1;
95 }
96
97 if (ps_strings != (struct ps_strings *)0)
98 __ps_strings = ps_strings;
99
100 if (&_DYNAMIC != NULL)
101 atexit(cleanup);
102
103#ifdef GCRT
104 atexit(_mcleanup);
105#endif
106 atexit(_fini);
107#ifdef GCRT
108 monstartup(&eprol, &etext);
109#endif
110 _init();
111 exit( main(argc, argv, envp) );
112}
113
114#ifdef GCRT
115__asm__(".text");
116__asm__("eprol:");
117__asm__(".previous");
118#endif
119
90 char *s;
91 __progname = argv[0];
92 for (s = __progname; *s != '\0'; s++)
93 if (*s == '/')
94 __progname = s + 1;
95 }
96
97 if (ps_strings != (struct ps_strings *)0)
98 __ps_strings = ps_strings;
99
100 if (&_DYNAMIC != NULL)
101 atexit(cleanup);
102
103#ifdef GCRT
104 atexit(_mcleanup);
105#endif
106 atexit(_fini);
107#ifdef GCRT
108 monstartup(&eprol, &etext);
109#endif
110 _init();
111 exit( main(argc, argv, envp) );
112}
113
114#ifdef GCRT
115__asm__(".text");
116__asm__("eprol:");
117__asm__(".previous");
118#endif
119
120/*
121 * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
122 */
123#ifndef lint
124static const char rcsid[] =
125 "$FreeBSD: head/lib/csu/powerpc/crt1.c 81586 2001-08-13 14:06:34Z ru $";
126#endif
120__asm__(".ident\t\"$FreeBSD: head/lib/csu/powerpc/crt1.c 91430 2002-02-27 22:13:02Z obrien $\"");