diff --git a/regress/usr.bin/rtld/testlib/Makefile b/regress/usr.bin/rtld/testlib/Makefile new file mode 100644 index 000000000000..6a73838b136c --- /dev/null +++ b/regress/usr.bin/rtld/testlib/Makefile @@ -0,0 +1,29 @@ +# $NetBSD: Makefile,v 1.1 2000/12/08 19:21:28 drochner Exp $ + +SRCS= ccexc.cc construct.cc virt.cc + +LIB= testlib.so + +OBJS= ${SRCS:.cc=.o} + +CPICFLAGS= -fpic -DPIC + +.cc.o: + ${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET} + +.if (${MACHINE_ARCH} == "i386") +all realall: ${LIB} +.else +all realall: +.endif + +${LIB}: ${OBJS} + ${CXX} -shared -o ${LIB} ${OBJS} + +clean cleandir: + rm -f *.o *.so + +regress: + +.include +.include diff --git a/regress/usr.bin/rtld/testlib/ccexc.cc b/regress/usr.bin/rtld/testlib/ccexc.cc new file mode 100644 index 000000000000..48303608ddfa --- /dev/null +++ b/regress/usr.bin/rtld/testlib/ccexc.cc @@ -0,0 +1,14 @@ +// $NetBSD: ccexc.cc,v 1.1 2000/12/08 19:21:28 drochner Exp $ + +// generate references to exception handling runtime code + +extern "C" void ccexc(void); + +void +ccexc(void) +{ + try { + throw "mist"; + } catch (char *e) { + } +} diff --git a/regress/usr.bin/rtld/testlib/construct.cc b/regress/usr.bin/rtld/testlib/construct.cc new file mode 100644 index 000000000000..b5a67601aebd --- /dev/null +++ b/regress/usr.bin/rtld/testlib/construct.cc @@ -0,0 +1,23 @@ +// $NetBSD: construct.cc,v 1.1 2000/12/08 19:21:28 drochner Exp $ + +// check constructor / destructor calls + +#include + +class mist { +public: + mist(void); + ~mist(); +}; + +mist::mist(void) +{ + cout << "constructor" << endl; +} + +mist::~mist() +{ + cout << "destructor" << endl; +} + +static mist construct; diff --git a/regress/usr.bin/rtld/testlib/virt.cc b/regress/usr.bin/rtld/testlib/virt.cc new file mode 100644 index 000000000000..c2655ba5d088 --- /dev/null +++ b/regress/usr.bin/rtld/testlib/virt.cc @@ -0,0 +1,15 @@ +// $NetBSD: virt.cc,v 1.1 2000/12/08 19:21:28 drochner Exp $ + +// g++ generates a reference to "__pure_virtual" with this code + +class mist { +public: + virtual void vv(void) = 0; +}; + +class mast: public mist { +public: + void vv(void) {}; +}; + +static mast virt;