[Midnightbsd-cvs] src [10427] trunk/lib/csu/i386-elf: modernize
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Tue Jun 5 18:46:13 EDT 2018
Revision: 10427
http://svnweb.midnightbsd.org/src/?rev=10427
Author: laffer1
Date: 2018-06-05 18:46:12 -0400 (Tue, 05 Jun 2018)
Log Message:
-----------
modernize
Modified Paths:
--------------
trunk/lib/csu/i386-elf/Makefile
trunk/lib/csu/i386-elf/crt1_c.c
Modified: trunk/lib/csu/i386-elf/Makefile
===================================================================
--- trunk/lib/csu/i386-elf/Makefile 2018-06-05 22:44:47 UTC (rev 10426)
+++ trunk/lib/csu/i386-elf/Makefile 2018-06-05 22:46:12 UTC (rev 10427)
@@ -1,6 +1,7 @@
-# $FreeBSD: src/lib/csu/i386-elf/Makefile,v 1.20.18.2 2010/05/02 20:12:20 jilles Exp $
+# $MidnightBSD$
+# $FreeBSD: stable/10/lib/csu/i386-elf/Makefile 313658 2017-02-11 20:46:49Z ngie $
-.PATH: ${.CURDIR}/../common
+.PATH: ${.CURDIR:H}/common
SRCS= crti.S crtn.S
FILES= ${SRCS:N*.h:R:S/$/.o/g} gcrt1.o crt1.o Scrt1.o
@@ -8,8 +9,8 @@
FILESGRP= ${LIBGRP}
FILESMODE= ${LIBMODE}
FILESDIR= ${LIBDIR}
-CFLAGS+= -I${.CURDIR}/../common \
- -I${.CURDIR}/../../libc/include
+CFLAGS+= -I${.CURDIR:H}/common \
+ -I${SRCTOP}/lib/libc/include
CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s
@@ -18,7 +19,7 @@
gcrt1_c.s: crt1_c.c
${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
- sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+ sed ${SED_FIX_NOTE} ${.TARGET}
gcrt1_c.o: gcrt1_c.s
${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1_c.s
@@ -28,7 +29,7 @@
crt1_c.s: crt1_c.c
${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
- sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+ sed ${SED_FIX_NOTE} ${.TARGET}
crt1_c.o: crt1_c.s
${CC} ${ACFLAGS} -c -o ${.TARGET} crt1_c.s
@@ -35,11 +36,11 @@
crt1.o: crt1_c.o crt1_s.o
${LD} ${LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o
- objcopy --localize-symbol _start1 crt1.o
+ ${OBJCOPY} --localize-symbol _start1 crt1.o
Scrt1_c.s: crt1_c.c
${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1_c.c
- sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+ sed ${SED_FIX_NOTE} ${.TARGET}
Scrt1_c.o: Scrt1_c.s
${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1_c.s
@@ -46,6 +47,6 @@
Scrt1.o: Scrt1_c.o crt1_s.o
${LD} ${LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o
- objcopy --localize-symbol _start1 Scrt1.o
+ ${OBJCOPY} --localize-symbol _start1 Scrt1.o
.include <bsd.prog.mk>
Modified: trunk/lib/csu/i386-elf/crt1_c.c
===================================================================
--- trunk/lib/csu/i386-elf/crt1_c.c 2018-06-05 22:44:47 UTC (rev 10426)
+++ trunk/lib/csu/i386-elf/crt1_c.c 2018-06-05 22:46:12 UTC (rev 10427)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* LINTLIBRARY */
/*-
* Copyright 1996-1998 John D. Polstra.
@@ -23,29 +24,19 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
- * $FreeBSD: src/lib/csu/i386-elf/crt1_c.c,v 1.1.4.2 2010/01/19 20:19:52 kib Exp $
+ * $FreeBSD: stable/10/lib/csu/i386-elf/crt1_c.c 300323 2016-05-20 19:14:15Z emaste $
*/
-#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 **);
extern void _start(char *, ...);
#ifdef GCRT
@@ -55,9 +46,6 @@
extern int etext;
#endif
-char **environ;
-const char *__progname = "";
-
void _start1(fptr, int, char *[]) __dead2;
/* The entry function, C part. */
@@ -65,18 +53,9 @@
_start1(fptr cleanup, int argc, char *argv[])
{
char **env;
- const char *s;
env = argv + argc + 1;
- 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);
else
@@ -84,14 +63,12 @@
#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(".hidden _start1");
More information about the Midnightbsd-cvs
mailing list