Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jan 2010 23:14:18 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 173990 for review
Message-ID:  <201001302314.o0UNEISw032493@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=173990

Change 173990 by rwatson@rwatson_vimage_client on 2010/01/30 23:14:12

	Report capability-mode C runtime to i386, which was apparently lost
	during integration of a rearrangement of this code.

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/lib/csu/i386-elf/Makefile#3 edit
.. //depot/projects/trustedbsd/capabilities/src/lib/csu/i386-elf/crt1_c.c#2 edit
.. //depot/projects/trustedbsd/capabilities/src/lib/csu/i386-elf/crt1_s.S#2 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/lib/csu/i386-elf/Makefile#3 (text+ko) ====

@@ -20,13 +20,13 @@
 
 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 -localize-symbol _capstart1 crt1.o
 
 Scrt1_c.o:	crt1_c.c
 	${CC} ${CFLAGS} -DGCRT -fPIC -DPIC -c -o Scrt1_c.o ${.CURDIR}/crt1_c.c
 
 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 -localize-symbol _capstart1 Scrt1.o
 
 .include <bsd.prog.mk>

==== //depot/projects/trustedbsd/capabilities/src/lib/csu/i386-elf/crt1_c.c#2 (text+ko) ====

@@ -46,6 +46,7 @@
 extern void _init(void);
 extern int main(int, char **, char **);
 extern void _start(char *, ...);
+extern void _capstart(char *, ...);
 
 #ifdef GCRT
 extern void _mcleanup(void);
@@ -58,6 +59,7 @@
 const char *__progname = "";
 
 void _start1(fptr, int, char *[]) __dead2;
+void _capstart1(fptr, int, char *[]) __dead2;
 
 /* The entry function, C part. */
 void
@@ -93,3 +95,38 @@
 }
 
 __asm(".hidden	_start1");
+
+/* The Capsicum entry function. */
+void
+_capstart1(fptr cleanup, int argc, char *argv[])
+{
+	char **env;
+	const char *s;
+
+	env = argv + argc + 1;
+	environ = env;
+	if (argc > 0 && argv[0] != NULL) {
+		__progname = argv[0];
+		for (s = __progname; *s != '\0'; s++)
+			if (*s == '/')
+				__progname = s + 1;
+	}
+
+	if (&_DYNAMIC != NULL)
+		atexit(cleanup);
+	else
+		_init_tls();
+
+#ifdef GCRT
+	atexit(_mcleanup);
+#endif
+	atexit(_fini);
+#ifdef GCRT
+	monstartup(&eprol, &etext);
+__asm__("eprol:");
+#endif
+	_init();
+	exit( cap_main(argc, argv, env) );
+}
+
+__asm(".hidden	_capstart1");

==== //depot/projects/trustedbsd/capabilities/src/lib/csu/i386-elf/crt1_s.S#2 (text+ko) ====

@@ -41,4 +41,17 @@
 	call	_start1
 	.size	_start, . - _start
 
+	.globl	_capstart
+	.type	_capstart, @function
+_capstart:	xorl	%ebp,%ebp
+	pushl	%ebp
+	movl	%esp,%ebp
+	andl	$0xfffffff0,%esp # align stack
+	leal	8(%ebp),%eax
+	pushl	%eax		# argv
+	pushl	4(%ebp)		# argc
+	pushl	%edx		# rtld cleanup
+	call	_capstart1
+	.size	_capstart, . - _capstart
+
 	.ident	"$FreeBSD: src/lib/csu/i386-elf/crt1_s.S,v 1.1 2009/12/02 16:34:20 kib Exp $"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001302314.o0UNEISw032493>