crt1.c (216338) | crt1.c (232832) |
---|---|
1/* LINTLIBRARY */ 2/*- 3 * Copyright 2001 David E. O'Brien. 4 * All rights reserved. 5 * Copyright 1996-1998 John D. Polstra. 6 * All rights reserved. 7 * Copyright (c) 1997 Jason R. Thorpe. 8 * Copyright (c) 1995 Christopher G. Demetriou --- 26 unchanged lines hidden (view full) --- 35 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 39 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 */ 41 42#include <sys/cdefs.h> | 1/* LINTLIBRARY */ 2/*- 3 * Copyright 2001 David E. O'Brien. 4 * All rights reserved. 5 * Copyright 1996-1998 John D. Polstra. 6 * All rights reserved. 7 * Copyright (c) 1997 Jason R. Thorpe. 8 * Copyright (c) 1995 Christopher G. Demetriou --- 26 unchanged lines hidden (view full) --- 35 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 39 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 */ 41 42#include <sys/cdefs.h> |
43__FBSDID("$FreeBSD: head/lib/csu/powerpc/crt1.c 216338 2010-12-09 21:31:21Z dim $"); | 43__FBSDID("$FreeBSD: head/lib/csu/powerpc/crt1.c 232832 2012-03-11 20:04:09Z kib $"); |
44 45#ifndef lint 46#ifndef __GNUC__ 47#error "GCC is needed to compile this file" 48#endif 49#endif /* lint */ 50 51#include <stdlib.h> 52 53#include "libc_private.h" 54#include "crtbrand.c" | 44 45#ifndef lint 46#ifndef __GNUC__ 47#error "GCC is needed to compile this file" 48#endif 49#endif /* lint */ 50 51#include <stdlib.h> 52 53#include "libc_private.h" 54#include "crtbrand.c" |
55#include "ignore_init.c" |
|
55 56struct Struct_Obj_Entry; 57struct ps_strings; 58 | 56 57struct Struct_Obj_Entry; 58struct ps_strings; 59 |
59extern int _DYNAMIC; 60#pragma weak _DYNAMIC 61 62extern void _fini(void); 63extern void _init(void); 64extern int main(int, char **, char **); 65 | |
66#ifdef GCRT 67extern void _mcleanup(void); 68extern void monstartup(void *, void *); 69extern int eprol; 70extern int etext; 71#endif 72 | 60#ifdef GCRT 61extern void _mcleanup(void); 62extern void monstartup(void *, void *); 63extern int eprol; 64extern int etext; 65#endif 66 |
73char **environ; 74const char *__progname = ""; | |
75struct ps_strings *__ps_strings; 76 77void _start(int, char **, char **, const struct Struct_Obj_Entry *, 78 void (*)(void), struct ps_strings *); 79 80/* The entry function. */ 81/* 82 * First 5 arguments are specified by the PowerPC SVR4 ABI. 83 * The last argument, ps_strings, is a BSD extension. 84 */ 85/* ARGSUSED */ 86void 87_start(int argc, char **argv, char **env, 88 const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void), 89 struct ps_strings *ps_strings) 90{ | 67struct ps_strings *__ps_strings; 68 69void _start(int, char **, char **, const struct Struct_Obj_Entry *, 70 void (*)(void), struct ps_strings *); 71 72/* The entry function. */ 73/* 74 * First 5 arguments are specified by the PowerPC SVR4 ABI. 75 * The last argument, ps_strings, is a BSD extension. 76 */ 77/* ARGSUSED */ 78void 79_start(int argc, char **argv, char **env, 80 const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void), 81 struct ps_strings *ps_strings) 82{ |
91 const char *s; | |
92 93 environ = env; 94 | 83 84 environ = env; 85 |
95 if (argc > 0 && argv[0] != NULL) { 96 __progname = argv[0]; 97 for (s = __progname; *s != '\0'; s++) 98 if (*s == '/') 99 __progname = s + 1; 100 } | 86 if (argc > 0 && argv[0] != NULL) 87 handle_progname(argv[0]); |
101 102 if (ps_strings != (struct ps_strings *)0) 103 __ps_strings = ps_strings; 104 105 if (&_DYNAMIC != NULL) 106 atexit(cleanup); 107 else 108 _init_tls(); 109 110#ifdef GCRT 111 atexit(_mcleanup); | 88 89 if (ps_strings != (struct ps_strings *)0) 90 __ps_strings = ps_strings; 91 92 if (&_DYNAMIC != NULL) 93 atexit(cleanup); 94 else 95 _init_tls(); 96 97#ifdef GCRT 98 atexit(_mcleanup); |
112#endif 113 atexit(_fini); 114#ifdef GCRT | |
115 monstartup(&eprol, &etext); 116#endif | 99 monstartup(&eprol, &etext); 100#endif |
117 _init(); 118 exit( main(argc, argv, env) ); | 101 102 handle_static_init(argc, argv, env); 103 exit(main(argc, argv, env)); |
119} 120 121#ifdef GCRT 122__asm__(".text"); 123__asm__("eprol:"); 124__asm__(".previous"); 125#endif | 104} 105 106#ifdef GCRT 107__asm__(".text"); 108__asm__("eprol:"); 109__asm__(".previous"); 110#endif |