summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2003-02-01 19:56:18 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2003-02-01 19:56:18 +0000
commit6e89bf37604e6c5d5c4d99062cc3175db9fddd84 (patch)
tree5806797120d8b116f4ba66f316b6dbc69ec46878
parent1569e0785787f5464a24f2b6eb00d496d71e91c1 (diff)
Test programs for dependant shared library constructors.
-rw-r--r--regress/libexec/ld.so/constructor/Makefile3
-rw-r--r--regress/libexec/ld.so/constructor/libaa/Makefile3
-rw-r--r--regress/libexec/ld.so/constructor/libaa/aa.C17
-rw-r--r--regress/libexec/ld.so/constructor/libaa/aa.h6
-rw-r--r--regress/libexec/ld.so/constructor/libaa/shlib_version2
-rw-r--r--regress/libexec/ld.so/constructor/libab/Makefile6
-rw-r--r--regress/libexec/ld.so/constructor/libab/ab.C22
-rw-r--r--regress/libexec/ld.so/constructor/libab/ab.h11
-rw-r--r--regress/libexec/ld.so/constructor/libab/shlib_version2
-rw-r--r--regress/libexec/ld.so/constructor/prog1/Makefile34
-rw-r--r--regress/libexec/ld.so/constructor/prog1/prog1.C16
-rw-r--r--regress/libexec/ld.so/constructor/prog2/Makefile34
-rw-r--r--regress/libexec/ld.so/constructor/prog2/prog2.C16
13 files changed, 172 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/constructor/Makefile b/regress/libexec/ld.so/constructor/Makefile
new file mode 100644
index 00000000000..b3fa0888f04
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/Makefile
@@ -0,0 +1,3 @@
+SUBDIR=libaa libab prog1 prog2
+
+.include <bsd.subdir.mk>
diff --git a/regress/libexec/ld.so/constructor/libaa/Makefile b/regress/libexec/ld.so/constructor/libaa/Makefile
new file mode 100644
index 00000000000..c4432ee7f17
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/libaa/Makefile
@@ -0,0 +1,3 @@
+LIB=aa
+SRCS= aa.C
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/constructor/libaa/aa.C b/regress/libexec/ld.so/constructor/libaa/aa.C
new file mode 100644
index 00000000000..8974fc873f6
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/libaa/aa.C
@@ -0,0 +1,17 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: aa.C,v 1.1 2003/02/01 19:56:17 drahn Exp $
+ */
+
+#include "iostream.h"
+#include "aa.h"
+int a;
+
+
+AA::AA(char *arg)
+{
+ a = 1;
+}
+
+AA foo("A");
diff --git a/regress/libexec/ld.so/constructor/libaa/aa.h b/regress/libexec/ld.so/constructor/libaa/aa.h
new file mode 100644
index 00000000000..1df8304849f
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/libaa/aa.h
@@ -0,0 +1,6 @@
+class AA {
+public:
+ AA(char *);
+};
+
+
diff --git a/regress/libexec/ld.so/constructor/libaa/shlib_version b/regress/libexec/ld.so/constructor/libaa/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/libaa/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/constructor/libab/Makefile b/regress/libexec/ld.so/constructor/libab/Makefile
new file mode 100644
index 00000000000..4053e97fea0
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/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/constructor/libab/ab.C b/regress/libexec/ld.so/constructor/libab/ab.C
new file mode 100644
index 00000000000..574d67fbbee
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/libab/ab.C
@@ -0,0 +1,22 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: ab.C,v 1.1 2003/02/01 19:56:17 drahn Exp $
+ */
+
+#include "iostream.h"
+#include "aa.h"
+#include "ab.h"
+
+extern int a;
+
+BB::BB(char *str)
+{
+ if (a == 0) {
+ cout << "A not intialized in B constructors " << a << "\n";
+ exit(1);
+ }
+}
+
+BB ab("local");
+AA aa("B");
diff --git a/regress/libexec/ld.so/constructor/libab/ab.h b/regress/libexec/ld.so/constructor/libab/ab.h
new file mode 100644
index 00000000000..cdb01ad3884
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/libab/ab.h
@@ -0,0 +1,11 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: ab.h,v 1.1 2003/02/01 19:56:17 drahn Exp $
+ */
+
+class BB {
+public:
+ BB(char *);
+};
+
diff --git a/regress/libexec/ld.so/constructor/libab/shlib_version b/regress/libexec/ld.so/constructor/libab/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/libab/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/constructor/prog1/Makefile b/regress/libexec/ld.so/constructor/prog1/Makefile
new file mode 100644
index 00000000000..70440f5553a
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/prog1/Makefile
@@ -0,0 +1,34 @@
+# $OpenBSD: Makefile,v 1.1 2003/02/01 19:56:17 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++
+
+.include <bsd.regress.mk>
diff --git a/regress/libexec/ld.so/constructor/prog1/prog1.C b/regress/libexec/ld.so/constructor/prog1/prog1.C
new file mode 100644
index 00000000000..07b7dd1d436
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/prog1/prog1.C
@@ -0,0 +1,16 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: prog1.C,v 1.1 2003/02/01 19:56:17 drahn Exp $
+ */
+#include "iostream.h"
+#include "ab.h"
+BB BBmain("main");
+
+int a;
+int
+main()
+{
+ cout << "main\n";
+ return 0;
+}
diff --git a/regress/libexec/ld.so/constructor/prog2/Makefile b/regress/libexec/ld.so/constructor/prog2/Makefile
new file mode 100644
index 00000000000..a80ede7dd6d
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/prog2/Makefile
@@ -0,0 +1,34 @@
+# $OpenBSD: Makefile,v 1.1 2003/02/01 19:56:17 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/constructor/prog2/prog2.C b/regress/libexec/ld.so/constructor/prog2/prog2.C
new file mode 100644
index 00000000000..5d96a63d865
--- /dev/null
+++ b/regress/libexec/ld.so/constructor/prog2/prog2.C
@@ -0,0 +1,16 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: prog2.C,v 1.1 2003/02/01 19:56:17 drahn Exp $
+ */
+#include "iostream.h"
+#include "ab.h"
+BB BBmain("main");
+
+int a;
+int
+main()
+{
+ cout << "main\n";
+ return 0;
+}