diff options
author | markm <markm@FreeBSD.org> | 2002-07-16 12:28:50 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2002-07-16 12:28:50 +0000 |
commit | bedd05ccecbd002c4865f3dff35af258f0e5dd94 (patch) | |
tree | 4dcd84e724c9495af7116ae6dbbcee1b0420fb84 /lib/csu/ia64 | |
parent | 4de6bef14519eb23505d35e15226e5711028252c (diff) | |
download | FreeBSD-src-bedd05ccecbd002c4865f3dff35af258f0e5dd94.zip FreeBSD-src-bedd05ccecbd002c4865f3dff35af258f0e5dd94.tar.gz |
The main reason for this is to reduce diffs between all the crt1.c's.
Assembler macros are tidied up and made as similar as sanely possible.
The macros are translated into C (__inline static) functions for lint.
Declaration orders are made the same.
Declarations are all ISOfied and tidied up.
Comment contents have gratuitous diffs removed.
The net result is a bunch of crt1.c's that are 90% the same.
It may be possible to now encapsulate the differences in one
MD header, and have only one MI crt1.c file (although the macros
to do this may be ugly).
Helpful comments by: obrien, bde
Alpha tested by: des
i386-elf tested by: markm
Diffstat (limited to 'lib/csu/ia64')
-rw-r--r-- | lib/csu/ia64/crt1.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/lib/csu/ia64/crt1.c b/lib/csu/ia64/crt1.c index 4320b7b..392fd55 100644 --- a/lib/csu/ia64/crt1.c +++ b/lib/csu/ia64/crt1.c @@ -31,11 +31,14 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef lint #ifndef __GNUC__ #error "GCC is needed to compile this file" #endif +#endif /* lint */ #include <stdlib.h> + #include "libc_private.h" #include "crtbrand.c" @@ -45,9 +48,10 @@ struct ps_strings; #pragma weak _DYNAMIC extern int _DYNAMIC; -extern void _init(void); extern void _fini(void); +extern void _init(void); extern int main(int, char **, char **); +extern void _start(char **, struct ps_strings *, void (*)(void)); #ifdef GCRT extern void _mcleanup(void); @@ -59,17 +63,10 @@ extern int etext; char **environ; const char *__progname = ""; -/* The entry function. */ -void -_start(char **ap, - struct ps_strings *ps_strings, - void (*cleanup)(void)) +static __inline void +fix_gp(void) { - int argc; - char **argv; - char **env; - const char *s; - +#ifdef __GNUC__ /* Calculate gp */ __asm __volatile(" \ movl gp=@gprel(1f) ; \ @@ -78,8 +75,21 @@ _start(char **ap, ;; ; \ sub gp=r14,gp ; \ ;; "); +#endif +} + +/* The entry function. */ +/* ARGSUSED */ +void +_start(char **ap, struct ps_strings *ps_strings __unused, void (*cleanup)(void)) +{ + int argc; + char **argv; + char **env; + const char *s; - argc = * (long *) ap; + fix_gp(); + argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; environ = env; |