Regression test for .init/.fini.

This commit is contained in:
thorpej 2001-07-17 03:41:03 +00:00
parent c6128d5e3d
commit d31cce0350
4 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,27 @@
# $NetBSD: Makefile,v 1.1 2001/07/17 03:41:03 thorpej Exp $
MKMAN=no
.if exists(arch/${MACHINE_ARCH}/initfini_asm.S)
PROG= initfini
SRCS= initfini.c initfini_asm.S
WARNS?= 1
CLEANFILES+= output
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}
regress:
@./initfini > output
@if ! cmp -s ${.CURDIR}/expected output; then \
echo "FAILED"; \
else \
echo "PASSED"; \
fi
.else
regress:
@echo "FAILED -- asm stub not written for ${MACHINE_ARCH}"
.endif
.include <bsd.prog.mk>

View File

@ -0,0 +1,22 @@
/* $NetBSD: initfini_asm.S,v 1.1 2001/07/17 03:41:04 thorpej Exp $ */
/*
* This file placed in the public domain.
* Jason R. Thorpe, July 16, 2001.
*/
#include <machine/asm.h>
.section .init, "ax", @progbits
br ra, 1f
1: LDGP(ra)
jsr ra, i_am_init
.align 5
.previous
.section .fini, "ax", @progbits
br ra, 1f
1: LDGP(ra)
jsr ra, i_am_fini
.align 5
.previous

View File

@ -0,0 +1,3 @@
I am init.
I am main.
I am fini.

View File

@ -0,0 +1,39 @@
/* $NetBSD: initfini.c,v 1.1 2001/07/17 03:41:03 thorpej Exp $ */
/*
* This file placed in the public domain.
* Jason R. Thorpe, July 16, 2001.
*/
#include <sys/types.h>
#include <unistd.h>
void i_am_init(void);
void i_am_fini(void);
int main(int, char *[]);
#define WRITE(str) \
write(STDOUT_FILENO, str, sizeof(str) - 1)
int
main(int argc, char *argv[])
{
WRITE("I am main.\n");
exit(0);
}
void
i_am_init(void)
{
WRITE("I am init.\n");
}
void
i_am_fini(void)
{
WRITE("I am fini.\n");
}