summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/libexec/ld.so/dlopen/Makefile3
-rw-r--r--regress/libexec/ld.so/dlopen/libaa/Makefile5
-rw-r--r--regress/libexec/ld.so/dlopen/libaa/aa.C29
-rw-r--r--regress/libexec/ld.so/dlopen/libaa/aa.h9
-rw-r--r--regress/libexec/ld.so/dlopen/libaa/shlib_version2
-rw-r--r--regress/libexec/ld.so/dlopen/libab/Makefile6
-rw-r--r--regress/libexec/ld.so/dlopen/libab/ab.C30
-rw-r--r--regress/libexec/ld.so/dlopen/libab/ab.h14
-rw-r--r--regress/libexec/ld.so/dlopen/libab/shlib_version2
-rw-r--r--regress/libexec/ld.so/dlopen/prog1/Makefile35
-rw-r--r--regress/libexec/ld.so/dlopen/prog1/prog1.C43
-rw-r--r--regress/libexec/ld.so/dlopen/prog2/Makefile34
-rw-r--r--regress/libexec/ld.so/dlopen/prog2/prog2.C16
13 files changed, 228 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/dlopen/Makefile b/regress/libexec/ld.so/dlopen/Makefile
new file mode 100644
index 00000000000..b3fa0888f04
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/Makefile
@@ -0,0 +1,3 @@
+SUBDIR=libaa libab prog1 prog2
+
+.include <bsd.subdir.mk>
diff --git a/regress/libexec/ld.so/dlopen/libaa/Makefile b/regress/libexec/ld.so/dlopen/libaa/Makefile
new file mode 100644
index 00000000000..fe74b8576f7
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/libaa/Makefile
@@ -0,0 +1,5 @@
+LIB=aa
+SRCS= aa.C
+NOPROFILE=yes
+.include <bsd.lib.mk>
+
diff --git a/regress/libexec/ld.so/dlopen/libaa/aa.C b/regress/libexec/ld.so/dlopen/libaa/aa.C
new file mode 100644
index 00000000000..dedf9025451
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/libaa/aa.C
@@ -0,0 +1,29 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: aa.C,v 1.1 2005/09/13 20:51:39 drahn Exp $
+ */
+
+#include <iostream>
+#include "aa.h"
+int a;
+
+extern "C" char *libname = "libaa";
+
+extern "C" void
+lib_entry()
+{
+ std::cout << "called into aa " << libname << " libname " << "\n";
+}
+
+AA::AA(char *arg)
+{
+ a = 1;
+ _name = arg;
+}
+AA::~AA()
+{
+ std::cout << "dtors AA " << libname << " " << _name << "\n";
+}
+
+AA foo("A");
diff --git a/regress/libexec/ld.so/dlopen/libaa/aa.h b/regress/libexec/ld.so/dlopen/libaa/aa.h
new file mode 100644
index 00000000000..f4cc1f0e9a3
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/libaa/aa.h
@@ -0,0 +1,9 @@
+class AA {
+public:
+ AA(char *);
+ ~AA();
+private:
+ char *_name;
+};
+
+
diff --git a/regress/libexec/ld.so/dlopen/libaa/shlib_version b/regress/libexec/ld.so/dlopen/libaa/shlib_version
new file mode 100644
index 00000000000..97c9f92d6b8
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/libaa/shlib_version
@@ -0,0 +1,2 @@
+major=0
+minor=0
diff --git a/regress/libexec/ld.so/dlopen/libab/Makefile b/regress/libexec/ld.so/dlopen/libab/Makefile
new file mode 100644
index 00000000000..4353687e5b2
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/libab/Makefile
@@ -0,0 +1,6 @@
+LIB=ab
+SRCS= ab.C
+#CFLAGS=-I${.CURDIR}/../libaa
+#LDADD=-L../libaa
+#LDADD+=-laa
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/dlopen/libab/ab.C b/regress/libexec/ld.so/dlopen/libab/ab.C
new file mode 100644
index 00000000000..0eb72feac74
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/libab/ab.C
@@ -0,0 +1,30 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: ab.C,v 1.1 2005/09/13 20:51:39 drahn Exp $
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include "ab.h"
+
+extern int a;
+
+extern "C" char *libname = "libab";
+
+extern "C" void
+lib_entry()
+{
+ std::cout << "called into ab " << libname << " libname " << "\n";
+}
+
+BB::BB(char *str)
+{
+ _name = str;
+}
+
+BB::~BB()
+{
+ std::cout << "dtors BB " << _name << "\n";
+}
+BB ab("local");
diff --git a/regress/libexec/ld.so/dlopen/libab/ab.h b/regress/libexec/ld.so/dlopen/libab/ab.h
new file mode 100644
index 00000000000..cebb460fef3
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/libab/ab.h
@@ -0,0 +1,14 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: ab.h,v 1.1 2005/09/13 20:51:39 drahn Exp $
+ */
+
+class BB {
+public:
+ BB(char *);
+ ~BB();
+private:
+ char *_name;
+};
+
diff --git a/regress/libexec/ld.so/dlopen/libab/shlib_version b/regress/libexec/ld.so/dlopen/libab/shlib_version
new file mode 100644
index 00000000000..97c9f92d6b8
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/libab/shlib_version
@@ -0,0 +1,2 @@
+major=0
+minor=0
diff --git a/regress/libexec/ld.so/dlopen/prog1/Makefile b/regress/libexec/ld.so/dlopen/prog1/Makefile
new file mode 100644
index 00000000000..abc72d08365
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/prog1/Makefile
@@ -0,0 +1,35 @@
+# $OpenBSD: Makefile,v 1.1 2005/09/13 20:51:39 drahn Exp $
+
+.include <bsd.obj.mk>
+
+PROG=prog1
+
+SRCS=prog1.C
+
+AA_DIR=${.CURDIR}/../libaa
+AA_OBJDIR!= if [ -d $(AA_DIR)/${__objdir} ]; then \
+ echo "$(AA_DIR)/${__objdir}"; \
+ else \
+ echo "$(AA_DIR)"; \
+ fi
+
+AB_DIR=${.CURDIR}/../libab
+AB_OBJDIR!= if [ -d $(AB_DIR)/${__objdir} ]; then \
+ echo "$(AB_DIR)/${__objdir}"; \
+ else \
+ echo "$(AB_DIR)"; \
+ fi
+
+
+
+CFLAGS=-I${.CURDIR}/../libab
+LDADD=
+#LDADD+=-lab
+#LDADD+=-laa
+LDFLAGS=-L$(AA_OBJDIR) -L$(AB_OBJDIR)
+LDFLAGS+= -Wl,-rpath,$(AA_OBJDIR) -Wl,-rpath,$(AB_OBJDIR)
+NOMAN=
+CC=c++
+LD_LIBRARY_PATH=$(AA_OBJDIR):$(AB_OBJDIR)
+
+.include <bsd.regress.mk>
diff --git a/regress/libexec/ld.so/dlopen/prog1/prog1.C b/regress/libexec/ld.so/dlopen/prog1/prog1.C
new file mode 100644
index 00000000000..cad1faf98fb
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/prog1/prog1.C
@@ -0,0 +1,43 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: prog1.C,v 1.1 2005/09/13 20:51:39 drahn Exp $
+ */
+#include <iostream>
+#include <dlfcn.h>
+typedef void (v_func)(void);
+int a;
+int
+main()
+{
+ void *handle1;
+ void *handle2;
+ char **libname;
+ v_func *func;
+
+ std::cout << "main\n";
+ handle1 = dlopen("libaa.so.0.0", DL_LAZY);
+ if (handle1 == NULL) {
+ std::cout << "handle1 failed\n";
+ }
+ handle2 = dlopen("libab.so.0.0", DL_LAZY);
+ if (handle2 == NULL) {
+ std::cout << "handle1 failed\n";
+ }
+ std::cout << "loaded \n";
+ libname = (char **)dlsym(handle1, "libname");
+ std::cout << "handle1 is " << *libname << "\n";
+ libname = (char **)dlsym(handle2, "libname");
+ std::cout << "handle2 is " << *libname << "\n";
+ func = (v_func*)dlsym(handle1, "lib_entry");
+ (*func)();
+ func = (v_func*)dlsym(handle2, "lib_entry");
+ (*func)();
+
+ std::cout << "closing \n";
+ dlclose(handle1);
+ dlclose(handle2);
+ std::cout << "all done \n";
+
+ return 0;
+}
diff --git a/regress/libexec/ld.so/dlopen/prog2/Makefile b/regress/libexec/ld.so/dlopen/prog2/Makefile
new file mode 100644
index 00000000000..85f89a337a0
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/prog2/Makefile
@@ -0,0 +1,34 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2005/09/13 20:51:39 drahn Exp $
+
+.include <bsd.obj.mk>
+
+PROG=prog2
+
+SRCS=prog2.C
+
+AA_DIR=${.CURDIR}/../libaa
+AA_OBJDIR!= if [ -d $(AA_DIR)/${__objdir} ]; then \
+ echo "$(AA_DIR)/${__objdir}"; \
+ else \
+ echo "$(AA_DIR)"; \
+ fi
+
+AB_DIR=${.CURDIR}/../libab
+AB_OBJDIR!= if [ -d $(AB_DIR)/${__objdir} ]; then \
+ echo "$(AB_DIR)/${__objdir}"; \
+ else \
+ echo "$(AB_DIR)"; \
+ fi
+
+
+
+CFLAGS=-I${.CURDIR}/../libab
+LDADD=
+LDADD+=-laa
+LDADD+=-lab
+LDFLAGS=-L$(AA_OBJDIR) -L$(AB_OBJDIR)
+LDFLAGS+= -Wl,-rpath,$(AA_OBJDIR) -Wl,-rpath,$(AB_OBJDIR)
+NOMAN=
+CC=c++
+
+.include <bsd.regress.mk>
diff --git a/regress/libexec/ld.so/dlopen/prog2/prog2.C b/regress/libexec/ld.so/dlopen/prog2/prog2.C
new file mode 100644
index 00000000000..3ff3926db0e
--- /dev/null
+++ b/regress/libexec/ld.so/dlopen/prog2/prog2.C
@@ -0,0 +1,16 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: prog2.C,v 1.1.1.1 2005/09/13 20:51:39 drahn Exp $
+ */
+#include <iostream>
+#include "ab.h"
+BB BBmain("main");
+
+int a;
+int
+main()
+{
+ std::cout << "main\n";
+ return 0;
+}