summaryrefslogtreecommitdiff
path: root/lib/csu
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csu')
-rw-r--r--lib/csu/hppa/Makefile58
-rw-r--r--lib/csu/hppa/crt0.c23
2 files changed, 59 insertions, 22 deletions
diff --git a/lib/csu/hppa/Makefile b/lib/csu/hppa/Makefile
index 4744524bde7..ad1f0b3b666 100644
--- a/lib/csu/hppa/Makefile
+++ b/lib/csu/hppa/Makefile
@@ -1,27 +1,53 @@
-# $OpenBSD: Makefile,v 1.1 2001/08/19 19:57:54 mickey Exp $
+# $OpenBSD: Makefile,v 1.2 2002/11/10 22:49:54 mickey Exp $
+# from: @(#)Makefile 5.5 (Berkeley) 5/21/91
-CFLAGS+= -DLIBC_SCCS -DELFSIZE=32 -I${.CURDIR}/..
+CFLAGS+= -DLIBC_SCCS -I${.CURDIR}/..
+OBJS= crt0.o scrt0.o gcrt0.o crtbegin.o crtend.o crtbeginS.o crtendS.o
-#OBJS= crt0.o gcrt0.o
-OBJS= crt0.o
-SRCS= crt0.c
-NOPROFILE=noprofile
-NOPIC= nopic
-NOMAN= noman
+.PATH: ${.CURDIR}/../common_elf
+CFLAGS+= -I${.CURDIR}/../common_elf
-CLEANFILES+= core a.out
+#PICFLAG?=-fPIC
-all: ${OBJS}
+all: ${OBJS}
-crt0.o: ${SRCS}
- @echo ${COMPILE.c} -DCRT0 ${.CURDIR}/${SRCS} -o ${.TARGET}
- @${COMPILE.c} -DCRT0 ${.CURDIR}/${SRCS} -o ${.TARGET}.o
+crt0.o: crt0.c
+ ${COMPILE.c} -DCRT0 ${.ALLSRC} -o ${.TARGET}.o
@${LD} -x -r -o ${.TARGET} ${.TARGET}.o
@rm -f ${.TARGET}.o
-install:
+scrt0.o: crt0.c
+ ${COMPILE.c} -DSCRT0 ${.ALLSRC} -o ${.TARGET}.o
+ @${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+ @rm -f ${.TARGET}.o
+
+gcrt0.o: crt0.c
+ ${COMPILE.c} -DMCRT0 ${.ALLSRC} -o ${.TARGET}.o
+ @${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+ @rm -f ${.TARGET}.o
+
+crtbegin.o: crtbegin.c
+ ${COMPILE.c} ${.ALLSRC} -o ${.TARGET}.o
+ @${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+ @rm -f ${.TARGET}.o
+
+crtbeginS.o: crtbeginS.c
+ ${COMPILE.c} ${PICFLAG} ${.ALLSRC} -o ${.TARGET}.o
+ @${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+ @rm -f ${.TARGET}.o
+
+crtend.o: crtend.c
+ ${COMPILE.c} ${.ALLSRC} -o ${.TARGET}.o
+ @${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+ @rm -f ${.TARGET}.o
+
+crtendS.o: crtendS.c
+ ${COMPILE.c} ${PICFLAG} ${.ALLSRC} -o ${.TARGET}.o
+ @${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+ @rm -f ${.TARGET}.o
+
+realinstall:
${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 ${OBJS} \
- ${DESTDIR}/usr/lib
+ ${DESTDIR}/usr/lib
.include <bsd.prog.mk>
-
diff --git a/lib/csu/hppa/crt0.c b/lib/csu/hppa/crt0.c
index e578e3bdd0c..cd2e2c05715 100644
--- a/lib/csu/hppa/crt0.c
+++ b/lib/csu/hppa/crt0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crt0.c,v 1.3 2002/02/16 21:27:20 millert Exp $ */
+/* $OpenBSD: crt0.c,v 1.4 2002/11/10 22:49:54 mickey Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -35,7 +35,7 @@ int global __asm ("$global$") = 0;
int sh_func_adrs __asm ("$$sh_func_adrs") = 0;
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$OpenBSD: crt0.c,v 1.3 2002/02/16 21:27:20 millert Exp $";
+static const char rcsid[] = "$OpenBSD: crt0.c,v 1.4 2002/11/10 22:49:54 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdlib.h>
@@ -61,10 +61,10 @@ extern void __fini(void);
#ifdef MCRT0
extern void monstartup(u_long, u_long);
extern void _mcleanup(void);
-extern u_int etext, eprol;
#endif /* MCRT0 */
void __start(char **, void (*)(void), const Obj_Entry *);
+static char *__strrchr(const char *p, char ch);
void
__start(sp, cleanup, obj)
@@ -93,13 +93,24 @@ __start(sp, cleanup, obj)
monstartup((u_long)&eprol, (u_long)&etext);
#endif
+ __init();
+
exit(main(arginfo->ps_nargvstr, argv, environ));
}
-void __main() {}
+static char *
+__strrchr(const char *p, char ch)
+{
+ char *save;
-#include "common.c"
+ for (save = NULL;; ++p) {
+ if (*p == ch)
+ save = (char *)p;
+ if (!*p)
+ return(save);
+ }
+}
#ifdef MCRT0
-__asm __volatile(".export eprol, entry\neprol");
+__asm (".export eprol, entry\neprol");
#endif