test cases for dynamically loaded objects: constructor/destructor call for
static objects, C++ runtime support
This commit is contained in:
parent
aa2b1723f5
commit
08a3f0ae6e
29
regress/usr.bin/rtld/testlib/Makefile
Normal file
29
regress/usr.bin/rtld/testlib/Makefile
Normal file
@ -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 <bsd.obj.mk>
|
||||
.include <bsd.depall.mk>
|
14
regress/usr.bin/rtld/testlib/ccexc.cc
Normal file
14
regress/usr.bin/rtld/testlib/ccexc.cc
Normal file
@ -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) {
|
||||
}
|
||||
}
|
23
regress/usr.bin/rtld/testlib/construct.cc
Normal file
23
regress/usr.bin/rtld/testlib/construct.cc
Normal file
@ -0,0 +1,23 @@
|
||||
// $NetBSD: construct.cc,v 1.1 2000/12/08 19:21:28 drochner Exp $
|
||||
|
||||
// check constructor / destructor calls
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class mist {
|
||||
public:
|
||||
mist(void);
|
||||
~mist();
|
||||
};
|
||||
|
||||
mist::mist(void)
|
||||
{
|
||||
cout << "constructor" << endl;
|
||||
}
|
||||
|
||||
mist::~mist()
|
||||
{
|
||||
cout << "destructor" << endl;
|
||||
}
|
||||
|
||||
static mist construct;
|
15
regress/usr.bin/rtld/testlib/virt.cc
Normal file
15
regress/usr.bin/rtld/testlib/virt.cc
Normal file
@ -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;
|
Loading…
Reference in New Issue
Block a user