crt1.c (93399) | crt1.c (100167) |
---|---|
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. --- 24 unchanged lines hidden (view full) --- 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 | 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. --- 24 unchanged lines hidden (view full) --- 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 lint |
|
41#ifndef __GNUC__ 42#error "GCC is needed to compile this file" 43#endif | 42#ifndef __GNUC__ 43#error "GCC is needed to compile this file" 44#endif |
45#endif /* lint */ |
|
44 45#include <stdlib.h> | 46 47#include <stdlib.h> |
48 |
|
46#include "libc_private.h" 47#include "crtbrand.c" 48 49struct Struct_Obj_Entry; 50struct ps_strings; 51 | 49#include "libc_private.h" 50#include "crtbrand.c" 51 52struct Struct_Obj_Entry; 53struct ps_strings; 54 |
52#pragma weak _DYNAMIC | |
53extern int _DYNAMIC; | 55extern int _DYNAMIC; |
56#pragma weak _DYNAMIC |
|
54 | 57 |
55extern void _init(void); | |
56extern void _fini(void); | 58extern void _fini(void); |
59extern void _init(void); |
|
57extern int main(int, char **, char **); | 60extern int main(int, char **, char **); |
61extern void _start(int, char **, char **, const struct Struct_Obj_Entry *, 62 void (*)(void), struct ps_strings *); |
|
58 59#ifdef GCRT 60extern void _mcleanup(void); 61extern void monstartup(void *, void *); 62extern int eprol; 63extern int etext; 64#endif 65 66char **environ; 67const char *__progname = ""; 68struct ps_strings *__ps_strings; 69 | 63 64#ifdef GCRT 65extern void _mcleanup(void); 66extern void monstartup(void *, void *); 67extern int eprol; 68extern int etext; 69#endif 70 71char **environ; 72const char *__progname = ""; 73struct ps_strings *__ps_strings; 74 |
70/* The entry function. 71 * | 75/* The entry function. */ 76/* |
72 * First 5 arguments are specified by the PowerPC SVR4 ABI. 73 * The last argument, ps_strings, is a BSD extension. 74 */ | 77 * First 5 arguments are specified by the PowerPC SVR4 ABI. 78 * The last argument, ps_strings, is a BSD extension. 79 */ |
80/* ARGSUSED */ |
|
75void | 81void |
76_start(argc, argv, envp, obj, cleanup, ps_strings) 77 int argc; 78 char **argv, **envp; 79 const struct Struct_Obj_Entry *obj; /* from shared loader */ 80 void (*cleanup)(void); /* from shared loader */ 81 struct ps_strings *ps_strings; /* BSD extension */ | 82_start(int argc, char **argv, char **env, 83 const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void), 84 struct ps_strings *ps_strings) |
82{ | 85{ |
83 char *namep; | |
84 const char *s; 85 | 86 const char *s; 87 |
86 environ = envp; | 88 environ = env; |
87 88 if (argc > 0 && argv[0] != NULL) { 89 __progname = argv[0]; 90 for (s = __progname; *s != '\0'; s++) 91 if (*s == '/') 92 __progname = s + 1; 93 } 94 --- 6 unchanged lines hidden (view full) --- 101#ifdef GCRT 102 atexit(_mcleanup); 103#endif 104 atexit(_fini); 105#ifdef GCRT 106 monstartup(&eprol, &etext); 107#endif 108 _init(); | 89 90 if (argc > 0 && argv[0] != NULL) { 91 __progname = argv[0]; 92 for (s = __progname; *s != '\0'; s++) 93 if (*s == '/') 94 __progname = s + 1; 95 } 96 --- 6 unchanged lines hidden (view full) --- 103#ifdef GCRT 104 atexit(_mcleanup); 105#endif 106 atexit(_fini); 107#ifdef GCRT 108 monstartup(&eprol, &etext); 109#endif 110 _init(); |
109 exit( main(argc, argv, envp) ); | 111 exit( main(argc, argv, env) ); |
110} 111 112#ifdef GCRT 113__asm__(".text"); 114__asm__("eprol:"); 115__asm__(".previous"); 116#endif 117 | 112} 113 114#ifdef GCRT 115__asm__(".text"); 116__asm__("eprol:"); 117__asm__(".previous"); 118#endif 119 |
118__asm__(".ident\t\"$FreeBSD: head/lib/csu/powerpc/crt1.c 93399 2002-03-29 22:43:43Z markm $\""); | 120__asm__(".ident\t\"$FreeBSD: head/lib/csu/powerpc/crt1.c 100167 2002-07-16 12:28:50Z markm $\""); |