Index: head/lib/csu/aarch64/crt1.c =================================================================== --- head/lib/csu/aarch64/crt1.c (revision 291999) +++ head/lib/csu/aarch64/crt1.c (revision 292000) @@ -1,104 +1,98 @@ /* LINTLIBRARY */ /*- * Copyright 1996-1998 John D. Polstra. * Copyright 2014 Andrew Turner. * Copyright 2014-2015 The FreeBSD Foundation. * All rights reserved. * * Portions of this software were developed by Andrew Turner * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); -#ifndef lint -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif -#endif /* lint */ - #include #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); extern int eprol; extern int etext; #endif extern long * _end; void __start(int, char **, char **, void (*)(void)); /* The entry function. */ __asm(" .text \n" " .align 0 \n" " .globl _start \n" " _start: \n" /* TODO: Remove this when the kernel correctly aligns the stack */ " cbnz x0, 1f \n" /* Are we using a new kernel? */ " mov x0, sp \n" /* No, load the args from sp */ " and sp, x0, #~0xf \n" /* And align the stack */ "1: mov x3, x2 \n" /* cleanup */ " add x1, x0, #8 \n" /* load argv */ " ldr x0, [x0] \n" /* load argc */ " add x2, x1, x0, lsl #3 \n" /* env is after argv */ " add x2, x2, #8 \n" /* argv is null terminated */ " b __start "); /* The entry function. */ void __start(int argc, char *argv[], char *env[], void (*cleanup)(void)) { handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else { /* * Hack to resolve _end so we read the correct symbol. * Without this it will resolve to the copy in the library * that firsts requests it. We should fix the toolchain, * however this is is needed until this can take place. */ *(volatile long *)&_end; _init_tls(); } #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); __asm__("eprol:"); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); } Index: head/lib/csu/amd64/crt1.c =================================================================== --- head/lib/csu/amd64/crt1.c (revision 291999) +++ head/lib/csu/amd64/crt1.c (revision 292000) @@ -1,79 +1,73 @@ /* LINTLIBRARY */ /*- * Copyright 1996-1998 John D. Polstra. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); -#ifndef lint -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif -#endif /* lint */ - #include #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" typedef void (*fptr)(void); #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); extern int eprol; extern int etext; #endif void _start(char **, void (*)(void)); /* The entry function. */ void _start(char **ap, void (*cleanup)(void)) { int argc; char **argv; char **env; argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else _init_tls(); #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); __asm__("eprol:"); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); } Index: head/lib/csu/arm/crt1.c =================================================================== --- head/lib/csu/arm/crt1.c (revision 291999) +++ head/lib/csu/arm/crt1.c (revision 292000) @@ -1,136 +1,130 @@ /* LINTLIBRARY */ /*- * Copyright 2001 David E. O'Brien. * All rights reserved. * Copyright 1996-1998 John D. Polstra. * All rights reserved. * Copyright (c) 1997 Jason R. Thorpe. * Copyright (c) 1995 Christopher G. Demetriou * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for the * FreeBSD Project. See http://www.freebsd.org/ for * information about FreeBSD. * This product includes software developed for the * NetBSD Project. See http://www.netbsd.org/ for * information about NetBSD. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); -#ifndef lint -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif -#endif /* lint */ - #include #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" struct Struct_Obj_Entry; struct ps_strings; extern void _start(int, char **, char **, const struct Struct_Obj_Entry *, void (*)(void), struct ps_strings *); #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); extern int eprol; extern int etext; #endif struct ps_strings *__ps_strings; void __start(int, char **, char **, struct ps_strings *, const struct Struct_Obj_Entry *, void (*)(void)); /* The entry function. */ __asm(" .text \n" " .align 0 \n" " .globl _start \n" " _start: \n" " mov r5, r2 /* cleanup */ \n" " mov r4, r1 /* obj_main */ \n" " mov r3, r0 /* ps_strings */ \n" " /* Get argc, argv, and envp from stack */ \n" " ldr r0, [sp, #0x0000] \n" " add r1, sp, #0x0004 \n" " add r2, r1, r0, lsl #2 \n" " add r2, r2, #0x0004 \n" " /* Ensure the stack is properly aligned before calling C code. */\n" " bic sp, sp, #7 \n" " sub sp, sp, #8 \n" " str r5, [sp, #4] \n" " str r4, [sp, #0] \n" "\n" " b __start "); /* ARGSUSED */ void __start(int argc, char **argv, char **env, struct ps_strings *ps_strings, const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void)) { handle_argv(argc, argv, env); if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; if (&_DYNAMIC != NULL) atexit(cleanup); else _init_tls(); #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); } static const struct { int32_t namesz; int32_t descsz; int32_t type; char name[sizeof(NOTE_FREEBSD_VENDOR)]; char desc[sizeof(MACHINE_ARCH)]; } archtag __attribute__ ((section (NOTE_SECTION), aligned(4))) __used = { .namesz = sizeof(NOTE_FREEBSD_VENDOR), .descsz = sizeof(MACHINE_ARCH), .type = ARCH_NOTETYPE, .name = NOTE_FREEBSD_VENDOR, .desc = MACHINE_ARCH }; #ifdef GCRT __asm__(".text"); __asm__("eprol:"); __asm__(".previous"); #endif Index: head/lib/csu/i386/crt1_c.c =================================================================== --- head/lib/csu/i386/crt1_c.c (revision 291999) +++ head/lib/csu/i386/crt1_c.c (revision 292000) @@ -1,80 +1,74 @@ /* LINTLIBRARY */ /*- * Copyright 1996-1998 John D. Polstra. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #include __FBSDID("$FreeBSD$"); -#ifndef lint -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif -#endif /* lint */ - #include #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" typedef void (*fptr)(void); extern void _start(char *, ...); #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); extern int eprol; extern int etext; #endif void _start1(fptr, int, char *[]) __dead2; /* The entry function, C part. */ void _start1(fptr cleanup, int argc, char *argv[]) { char **env; env = argv + argc + 1; handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else _init_tls(); #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); __asm__("eprol:"); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); } __asm(".hidden _start1"); Index: head/lib/csu/mips/crt1.c =================================================================== --- head/lib/csu/mips/crt1.c (revision 291999) +++ head/lib/csu/mips/crt1.c (revision 292000) @@ -1,94 +1,90 @@ /*- * Copyright 1996-1998 John D. Polstra. * All rights reserved. * Copyright (c) 1995 Christopher G. Demetriou * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Christopher G. Demetriou * for the NetBSD Project. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #include __FBSDID("$FreeBSD$"); -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif - #include #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" struct Struct_Obj_Entry; struct ps_strings; #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); extern int eprol; extern int etext; #endif void __start(char **, void (*)(void), struct Struct_Obj_Entry *, struct ps_strings *); /* The entry function. */ void __start(char **ap, void (*cleanup)(void), /* from shared loader */ struct Struct_Obj_Entry *obj __unused, /* from shared loader */ struct ps_strings *ps_strings __unused) { int argc; char **argv; char **env; argc = * (long *) ap; argv = ap + 1; env = ap + 2 + argc; handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else _init_tls(); #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); } #ifdef GCRT __asm__(".text"); __asm__("eprol:"); __asm__(".previous"); #endif Index: head/lib/csu/powerpc/crt1.c =================================================================== --- head/lib/csu/powerpc/crt1.c (revision 291999) +++ head/lib/csu/powerpc/crt1.c (revision 292000) @@ -1,108 +1,102 @@ /* LINTLIBRARY */ /*- * Copyright 2001 David E. O'Brien. * All rights reserved. * Copyright 1996-1998 John D. Polstra. * All rights reserved. * Copyright (c) 1997 Jason R. Thorpe. * Copyright (c) 1995 Christopher G. Demetriou * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for the * FreeBSD Project. See http://www.freebsd.org/ for * information about FreeBSD. * This product includes software developed for the * NetBSD Project. See http://www.netbsd.org/ for * information about NetBSD. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); -#ifndef lint -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif -#endif /* lint */ - #include #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" struct Struct_Obj_Entry; struct ps_strings; #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); extern int eprol; extern int etext; #endif struct ps_strings *__ps_strings; void _start(int, char **, char **, const struct Struct_Obj_Entry *, void (*)(void), struct ps_strings *); /* The entry function. */ /* * First 5 arguments are specified by the PowerPC SVR4 ABI. * The last argument, ps_strings, is a BSD extension. */ /* ARGSUSED */ void _start(int argc, char **argv, char **env, const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void), struct ps_strings *ps_strings) { handle_argv(argc, argv, env); if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; if (&_DYNAMIC != NULL) atexit(cleanup); else _init_tls(); #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); } #ifdef GCRT __asm__(".text"); __asm__("eprol:"); __asm__(".previous"); #endif Index: head/lib/csu/powerpc64/crt1.c =================================================================== --- head/lib/csu/powerpc64/crt1.c (revision 291999) +++ head/lib/csu/powerpc64/crt1.c (revision 292000) @@ -1,107 +1,101 @@ /* LINTLIBRARY */ /*- * Copyright 2001 David E. O'Brien. * All rights reserved. * Copyright 1996-1998 John D. Polstra. * All rights reserved. * Copyright (c) 1997 Jason R. Thorpe. * Copyright (c) 1995 Christopher G. Demetriou * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for the * FreeBSD Project. See http://www.freebsd.org/ for * information about FreeBSD. * This product includes software developed for the * NetBSD Project. See http://www.netbsd.org/ for * information about NetBSD. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); -#ifndef lint -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif -#endif /* lint */ - #include #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" struct Struct_Obj_Entry; struct ps_strings; extern void _start(int, char **, char **, const struct Struct_Obj_Entry *, void (*)(void), struct ps_strings *); #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); extern int eprol; extern int etext; #endif struct ps_strings *__ps_strings; /* The entry function. */ /* * First 5 arguments are specified by the PowerPC SVR4 ABI. * The last argument, ps_strings, is a BSD extension. */ /* ARGSUSED */ void _start(int argc, char **argv, char **env, const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void), struct ps_strings *ps_strings) { handle_argv(argc, argv, env); if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; if (&_DYNAMIC != NULL) atexit(cleanup); else _init_tls(); #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); } #ifdef GCRT __asm__(".text"); __asm__("eprol:"); __asm__(".previous"); #endif Index: head/lib/csu/sparc64/crt1.c =================================================================== --- head/lib/csu/sparc64/crt1.c (revision 291999) +++ head/lib/csu/sparc64/crt1.c (revision 292000) @@ -1,109 +1,103 @@ /* LINTLIBRARY */ /*- * Copyright 2001 David E. O'Brien. * All rights reserved. * Copyright (c) 1995, 1998 Berkeley Software Design, Inc. * All rights reserved. * Copyright 1996-1998 John D. Polstra. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); -#ifndef lint -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif -#endif /* lint */ - #include #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" struct Struct_Obj_Entry; struct ps_strings; extern void __sparc_utrap_setup(void); #ifdef GCRT extern void _mcleanup(void); extern void monstartup(void *, void *); extern int eprol; extern int etext; #endif void _start(char **, void (*)(void), struct Struct_Obj_Entry *, struct ps_strings *); /* The entry function. */ /* * %o0 holds ps_strings pointer. * * Note: kernel may (is not set in stone yet) pass ELF aux vector in %o1, * but for now we do not use it here. * * The SPARC compliance definitions specifies that the kernel pass the * address of a function to be executed on exit in %g1. We do not make * use of it as it is quite broken, because gcc can use this register * as a temporary, so it is not safe from C code. Its even more broken * for dynamic executables since rtld runs first. */ /* ARGSUSED */ void _start(char **ap, void (*cleanup)(void), struct Struct_Obj_Entry *obj __unused, struct ps_strings *ps_strings __unused) { int argc; char **argv; char **env; argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else { __sparc_utrap_setup(); _init_tls(); } #ifdef GCRT atexit(_mcleanup); monstartup(&eprol, &etext); #endif handle_static_init(argc, argv, env); exit(main(argc, argv, env)); } #ifdef GCRT __asm__(".text"); __asm__("eprol:"); __asm__(".previous"); #endif