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/powerpc64/crt1.c 216338 2010-12-09 21:31:21Z dim $"); | 43__FBSDID("$FreeBSD: head/lib/csu/powerpc64/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 **); | |
65extern void _start(int, char **, char **, const struct Struct_Obj_Entry *, 66 void (*)(void), struct ps_strings *); 67 68#ifdef GCRT 69extern void _mcleanup(void); 70extern void monstartup(void *, void *); 71extern int eprol; 72extern int etext; 73#endif 74 | 60extern void _start(int, char **, char **, const struct Struct_Obj_Entry *, 61 void (*)(void), struct ps_strings *); 62 63#ifdef GCRT 64extern void _mcleanup(void); 65extern void monstartup(void *, void *); 66extern int eprol; 67extern int etext; 68#endif 69 |
75char **environ; 76const char *__progname = ""; | |
77struct ps_strings *__ps_strings; 78 79/* The entry function. */ 80/* 81 * First 5 arguments are specified by the PowerPC SVR4 ABI. 82 * The last argument, ps_strings, is a BSD extension. 83 */ 84/* ARGSUSED */ 85void 86_start(int argc, char **argv, char **env, 87 const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void), 88 struct ps_strings *ps_strings) 89{ | 70struct ps_strings *__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{ |
90 const char *s; | |
91 92 environ = env; 93 | 83 84 environ = env; 85 |
94 if (argc > 0 && argv[0] != NULL) { 95 __progname = argv[0]; 96 for (s = __progname; *s != '\0'; s++) 97 if (*s == '/') 98 __progname = s + 1; 99 } | 86 if (argc > 0 && argv[0] != NULL) 87 handle_progname(argv[0]); |
100 101 if (ps_strings != (struct ps_strings *)0) 102 __ps_strings = ps_strings; 103 104 if (&_DYNAMIC != NULL) 105 atexit(cleanup); 106 else 107 _init_tls(); 108 109#ifdef GCRT 110 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); |
111#endif 112 atexit(_fini); 113#ifdef GCRT | |
114 monstartup(&eprol, &etext); 115#endif | 99 monstartup(&eprol, &etext); 100#endif |
116 _init(); 117 exit( main(argc, argv, env) ); | 101 102 handle_static_init(argc, argv, env); 103 exit(main(argc, argv, env)); |
118} 119 120#ifdef GCRT 121__asm__(".text"); 122__asm__("eprol:"); 123__asm__(".previous"); 124#endif | 104} 105 106#ifdef GCRT 107__asm__(".text"); 108__asm__("eprol:"); 109__asm__(".previous"); 110#endif |