[Midnightbsd-cvs] src [10428] trunk/lib/csu/amd64: moderniize

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Jun 5 18:47:55 EDT 2018


Revision: 10428
          http://svnweb.midnightbsd.org/src/?rev=10428
Author:   laffer1
Date:     2018-06-05 18:47:54 -0400 (Tue, 05 Jun 2018)
Log Message:
-----------
moderniize

Modified Paths:
--------------
    trunk/lib/csu/amd64/Makefile
    trunk/lib/csu/amd64/crt1.c

Modified: trunk/lib/csu/amd64/Makefile
===================================================================
--- trunk/lib/csu/amd64/Makefile	2018-06-05 22:46:12 UTC (rev 10427)
+++ trunk/lib/csu/amd64/Makefile	2018-06-05 22:47:54 UTC (rev 10428)
@@ -1,13 +1,13 @@
-# $MidnightBSD: src/lib/csu/amd64/Makefile,v 1.3 2011/12/18 02:23:42 laffer1 Exp $
-# $FreeBSD: src/lib/csu/amd64/Makefile,v 1.18.20.2 2010/01/19 20:19:52 kib Exp $
+# $MidnightBSD$
+# $FreeBSD: stable/10/lib/csu/amd64/Makefile 313582 2017-02-11 05:47:56Z ngie $
 
-.PATH: ${.CURDIR}/../common
+.PATH: ${.CURDIR:H}/common
 
 SRCS=		crt1.c crti.S crtn.S
 OBJS=		${SRCS:N*.h:R:S/$/.o/g}
 OBJS+=		Scrt1.o gcrt1.o
-CFLAGS+=	-I${.CURDIR}/../common \
-		-I${.CURDIR}/../../libc/include
+CFLAGS+=	-I${.CURDIR:H}/common \
+		-I${SRCTOP}/lib/libc/include
 CFLAGS+=	-fno-omit-frame-pointer
 
 all: ${OBJS}
@@ -20,7 +20,7 @@
 
 crt1.s: crt1.c
 	${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
-	sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+	sed ${SED_FIX_NOTE} ${.TARGET}
 
 crt1.o: crt1.s
 	${CC} ${ACFLAGS} -c -o ${.TARGET} crt1.s
@@ -27,7 +27,7 @@
 
 gcrt1.s: crt1.c
 	${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c
-	sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+	sed ${SED_FIX_NOTE} ${.TARGET}
 
 gcrt1.o: gcrt1.s
 	${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s
@@ -34,7 +34,7 @@
 
 Scrt1.s: crt1.c
 	${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c
-	sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+	sed ${SED_FIX_NOTE} ${.TARGET}
 
 Scrt1.o: Scrt1.s
 	${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s

Modified: trunk/lib/csu/amd64/crt1.c
===================================================================
--- trunk/lib/csu/amd64/crt1.c	2018-06-05 22:46:12 UTC (rev 10427)
+++ trunk/lib/csu/amd64/crt1.c	2018-06-05 22:47:54 UTC (rev 10428)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* LINTLIBRARY */
 /*-
  * Copyright 1996-1998 John D. Polstra.
@@ -24,26 +25,16 @@
  * 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 <sys/cdefs.h>
 
 #include <stdlib.h>
 
 #include "libc_private.h"
 #include "crtbrand.c"
+#include "ignore_init.c"
 
-extern int _DYNAMIC;
-#pragma weak _DYNAMIC
-
 typedef void (*fptr)(void);
 
-extern void _fini(void);
-extern void _init(void);
-extern int main(int, char **, char **);
-
 #ifdef GCRT
 extern void _mcleanup(void);
 extern void monstartup(void *, void *);
@@ -51,9 +42,6 @@
 extern int etext;
 #endif
 
-char **environ;
-const char *__progname = "";
-
 void _start(char **, void (*)(void));
 
 /* The entry function. */
@@ -63,19 +51,11 @@
 	int argc;
 	char **argv;
 	char **env;
-	const char *s;
 
 	argc = *(long *)(void *)ap;
 	argv = ap + 1;
 	env = ap + 2 + argc;
-	if (environ == NULL)
-		environ = env;
-	if (argc > 0 && argv[0] != NULL) {
-		__progname = argv[0];
-		for (s = __progname; *s != '\0'; s++)
-			if (*s == '/')
-				__progname = s + 1;
-	}
+	handle_argv(argc, argv, env);
 
 	if (&_DYNAMIC != NULL)
 		atexit(cleanup);
@@ -84,14 +64,13 @@
 
 #ifdef GCRT
 	atexit(_mcleanup);
-#endif
-	atexit(_fini);
-#ifdef GCRT
 	monstartup(&eprol, &etext);
 __asm__("eprol:");
 #endif
-	_init();
-	exit( main(argc, argv, env) );
+
+	handle_static_init(argc, argv, env);
+	exit(main(argc, argv, env));
 }
 
 __asm__(".ident\t\"$MidnightBSD$\"");
+



More information about the Midnightbsd-cvs mailing list