diff options
author | markm <markm@FreeBSD.org> | 2003-01-26 23:01:36 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2003-01-26 23:01:36 +0000 |
commit | 26450b90d3f662bae088bbaa836ca7baa2fe1e52 (patch) | |
tree | f251144bf007c8319fbd7d1ceb841c6c146dabbf /lib/csu/sparc64 | |
parent | 9cbc412d18e8e4c9c960d8b04668bcc971e58efd (diff) | |
download | FreeBSD-src-26450b90d3f662bae088bbaa836ca7baa2fe1e52.zip FreeBSD-src-26450b90d3f662bae088bbaa836ca7baa2fe1e52.tar.gz |
Remove the get_term() function. It pretty much can't work for
FreeBSD, and makes ugly diffs with the other crt1.c's. Leave
behind a comment (words supplied by Thomas Moestl) that explain
the issue.
OK'ed by: tmm
Diffstat (limited to 'lib/csu/sparc64')
-rw-r--r-- | lib/csu/sparc64/crt1.c | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/lib/csu/sparc64/crt1.c b/lib/csu/sparc64/crt1.c index 3796965..bdafbe5 100644 --- a/lib/csu/sparc64/crt1.c +++ b/lib/csu/sparc64/crt1.c @@ -65,51 +65,29 @@ extern int etext; char **environ; const char *__progname = ""; -/* - * Grab %g1 before it gets used for anything by the compiler. - * Sparc ELF psABI specifies a termination routine (if any) will be in - * %g1 - */ -static __inline fptr -get_term(void) -{ - fptr retval; - -#if 0 -#ifdef __GNUC__ - __asm__ volatile("mov %%g1,%0" : "=r"(retval)); -#else - retval = (fptr)0; /* XXXX Fix this for other compilers */ -#endif -#else - retval = (fptr)0; /* XXXX temporary */ -#endif - return(retval); -} - /* The entry function. */ /* - * %o0 holds ps_strings pointer. For Solaris compat and/or shared - * libraries, if %g1 is not 0, it is a routine to pass to atexit(). - * (By passing the pointer in the usual argument register, we avoid - * having to do any inline assembly, except to recover %g1.) + * %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) { - void (*term)(void); int argc; char **argv; char **env; const char *s; - term = get_term(); - argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; @@ -123,13 +101,6 @@ _start(char **ap, void (*cleanup)(void), struct Struct_Obj_Entry *obj __unused, __sparc_utrap_setup(); - /* - * If the kernel or a shared library wants us to call - * a termination function, arrange to do so. - */ - if (term) - atexit(term); - if (&_DYNAMIC != NULL) atexit(cleanup); |