summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Miller <kurt@cvs.openbsd.org>2005-09-19 03:34:19 +0000
committerKurt Miller <kurt@cvs.openbsd.org>2005-09-19 03:34:19 +0000
commit66352d229f35b90b47865957fd9a11c392742009 (patch)
tree8cd32980e655bf6e1553a9e05cddf055040a3f7a
parent4c4a6294f58f2318c3b2c5cb71200a24f26d44c3 (diff)
addtional tests involving two dlopened load groups
-rw-r--r--regress/libexec/ld.so/dlsym/test3/Makefile5
-rw-r--r--regress/libexec/ld.so/dlsym/test3/Makefile.inc43
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libaa/Makefile8
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libaa/aa.c19
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libaa/shlib_version2
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libbb/Makefile11
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libbb/bb.c114
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libbb/shlib_version2
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libcc/Makefile8
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libcc/cc.c19
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libcc/shlib_version2
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libdd/Makefile11
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libdd/dd.c19
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libdd/shlib_version2
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libee/Makefile8
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libee/ee.c19
-rw-r--r--regress/libexec/ld.so/dlsym/test3/libee/shlib_version2
-rw-r--r--regress/libexec/ld.so/dlsym/test3/prog1/Makefile12
-rw-r--r--regress/libexec/ld.so/dlsym/test3/prog1/main.c52
-rw-r--r--regress/libexec/ld.so/dlsym/test3/prog2/Makefile13
-rw-r--r--regress/libexec/ld.so/dlsym/test3/prog2/main.c52
21 files changed, 423 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/dlsym/test3/Makefile b/regress/libexec/ld.so/dlsym/test3/Makefile
new file mode 100644
index 00000000000..af3b21c4e9c
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2005/09/19 03:34:18 kurt Exp $
+
+SUBDIR+= libee libdd libcc libbb libaa prog1 prog2
+
+.include <bsd.subdir.mk>
diff --git a/regress/libexec/ld.so/dlsym/test3/Makefile.inc b/regress/libexec/ld.so/dlsym/test3/Makefile.inc
new file mode 100644
index 00000000000..b4bb9406b76
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/Makefile.inc
@@ -0,0 +1,43 @@
+# $OpenBSD: Makefile.inc,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $
+
+.include <bsd.obj.mk>
+
+AA_DIR=${.CURDIR}/../libaa
+
+AA_OBJDIR!= if [ -d $(AA_DIR)/${__objdir} ]; then \
+ echo "$(AA_DIR)/${__objdir}"; \
+ else \
+ echo "$(AA_DIR)"; \
+ fi
+
+BB_DIR=${.CURDIR}/../libbb
+
+BB_OBJDIR!= if [ -d $(BB_DIR)/${__objdir} ]; then \
+ echo "$(BB_DIR)/${__objdir}"; \
+ else \
+ echo "$(BB_DIR)"; \
+ fi
+
+CC_DIR=${.CURDIR}/../libcc
+
+CC_OBJDIR!= if [ -d $(CC_DIR)/${__objdir} ]; then \
+ echo "$(CC_DIR)/${__objdir}"; \
+ else \
+ echo "$(CC_DIR)"; \
+ fi
+
+DD_DIR=${.CURDIR}/../libdd
+
+DD_OBJDIR!= if [ -d $(DD_DIR)/${__objdir} ]; then \
+ echo "$(DD_DIR)/${__objdir}"; \
+ else \
+ echo "$(DD_DIR)"; \
+ fi
+
+EE_DIR=${.CURDIR}/../libee
+
+EE_OBJDIR!= if [ -d $(EE_DIR)/${__objdir} ]; then \
+ echo "$(EE_DIR)/${__objdir}"; \
+ else \
+ echo "$(EE_DIR)"; \
+ fi
diff --git a/regress/libexec/ld.so/dlsym/test3/libaa/Makefile b/regress/libexec/ld.so/dlsym/test3/libaa/Makefile
new file mode 100644
index 00000000000..aa5c50d08a8
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libaa/Makefile
@@ -0,0 +1,8 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $
+
+LIB= aa
+SRCS= aa.c
+
+regress: all
+
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/dlsym/test3/libaa/aa.c b/regress/libexec/ld.so/dlsym/test3/libaa/aa.c
new file mode 100644
index 00000000000..41585c4c1cf
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libaa/aa.c
@@ -0,0 +1,19 @@
+/* $OpenBSD: aa.c,v 1.1 2005/09/19 03:34:18 kurt Exp $ */
+
+/*
+ * Copyright (c) 2005 Kurt Miller <kurt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+int aaSymbol;
diff --git a/regress/libexec/ld.so/dlsym/test3/libaa/shlib_version b/regress/libexec/ld.so/dlsym/test3/libaa/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libaa/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/dlsym/test3/libbb/Makefile b/regress/libexec/ld.so/dlsym/test3/libbb/Makefile
new file mode 100644
index 00000000000..ab918bbe23a
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libbb/Makefile
@@ -0,0 +1,11 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $
+
+LIB= bb
+SRCS= bb.c
+LDADD+= -Wl,-E
+LDADD+= -Wl,-rpath,$(CC_OBJDIR)
+LDADD+= -L$(CC_OBJDIR) -lcc
+
+regress: all
+
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/dlsym/test3/libbb/bb.c b/regress/libexec/ld.so/dlsym/test3/libbb/bb.c
new file mode 100644
index 00000000000..187d7197f0e
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libbb/bb.c
@@ -0,0 +1,114 @@
+/* $OpenBSD: bb.c,v 1.1 2005/09/19 03:34:18 kurt Exp $ */
+
+/*
+ * Copyright (c) 2005 Kurt Miller <kurt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <dlfcn.h>
+#include <stdio.h>
+
+int bbSymbol;
+
+/*
+ * this test is setup where the main program group dlopen's libbb and libdd
+ * without RTLD_GLOBAL. libcc is part of libbb load group. libee is part of
+ * libdd load group.
+ */
+int
+bbTest1(void *libbb, void *libdd)
+{
+ int ret = 0;
+
+ /* check RTLD_DEFAULT can *not* see symbols in libdd object group */
+ if (dlsym(RTLD_DEFAULT, "ddSymbol") != NULL) {
+ printf("dlsym(RTLD_DEFAULT, \"ddSymbol\") != NULL\n");
+ ret = 1;
+ }
+
+ /* check RTLD_SELF can *not* see symbols in libdd object group */
+ if (dlsym(RTLD_SELF, "ddSymbol") != NULL) {
+ printf("dlsym(RTLD_SELF, \"ddSymbol\") != NULL\n");
+ ret = 1;
+ }
+
+ /* check RTLD_NEXT can *not* see symbols in libdd object group */
+ if (dlsym(RTLD_NEXT, "ddSymbol") != NULL) {
+ printf("dlsym(RTLD_NEXT, \"ddSymbol\") != NULL\n");
+ ret = 1;
+ }
+
+ /* check NULL can *not* see symbols in libdd object group */
+ if (dlsym(NULL, "ddSymbol") != NULL) {
+ printf("dlsym(NULL, \"ddSymbol\") != NULL\n");
+ ret = 1;
+ }
+
+ /* libbb should *not* see symbols in libdd or libee */
+ if (dlsym(libbb, "ddSymbol") != NULL) {
+ printf("dlsym(libbb, \"ddSymbol\") != NULL\n");
+ ret = 1;
+ }
+
+ /* libdd should *not* see symbols in libbb or libcc */
+ if (dlsym(libdd, "bbSymbol") != NULL) {
+ printf("dlsym(libdd, \"bbSymbol\") != NULL\n");
+ ret = 1;
+ }
+
+ /* libbb should see symbols in libbb and libcc */
+ if (dlsym(libbb, "ccSymbol") == NULL) {
+ printf("dlsym(libbb, \"ccSymbol\") == NULL\n");
+ ret = 1;
+ }
+
+ /* libdd should see symbols in libbb and libee */
+ if (dlsym(libdd, "eeSymbol") == NULL) {
+ printf("dlsym(libdd, \"eeSymbol\") == NULL\n");
+ ret = 1;
+ }
+
+ return (ret);
+}
+
+/*
+ * this test is setup where the main program group dlopen's libbb and libdd.
+ * libdd is opened with RTLD_GLOBAL. libcc is part of libbb load group. libee
+ * is part of libdd load group.
+ */
+int
+bbTest2()
+{
+ int ret = 0;
+
+ /* check RTLD_DEFAULT can see symbols in libdd object group */
+ if (dlsym(RTLD_DEFAULT, "eeSymbol") != NULL) {
+ printf("dlsym(RTLD_DEFAULT, \"ddSymbol\") != NULL\n");
+ ret = 1;
+ }
+
+ /* check RTLD_SELF can see symbols in libdd object group */
+ if (dlsym(RTLD_SELF, "eeSymbol") != NULL) {
+ printf("dlsym(RTLD_SELF, \"ddSymbol\") != NULL\n");
+ ret = 1;
+ }
+
+ /* check RTLD_NEXT can see symbols in libdd object group */
+ if (dlsym(RTLD_NEXT, "eeSymbol") != NULL) {
+ printf("dlsym(RTLD_NEXT, \"ddSymbol\") != NULL\n");
+ ret = 1;
+ }
+
+ return (ret);
+}
diff --git a/regress/libexec/ld.so/dlsym/test3/libbb/shlib_version b/regress/libexec/ld.so/dlsym/test3/libbb/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libbb/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/dlsym/test3/libcc/Makefile b/regress/libexec/ld.so/dlsym/test3/libcc/Makefile
new file mode 100644
index 00000000000..74935f35037
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libcc/Makefile
@@ -0,0 +1,8 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $
+
+LIB= cc
+SRCS= cc.c
+
+regress: all
+
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/dlsym/test3/libcc/cc.c b/regress/libexec/ld.so/dlsym/test3/libcc/cc.c
new file mode 100644
index 00000000000..eaaaf7aefaa
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libcc/cc.c
@@ -0,0 +1,19 @@
+/* $OpenBSD: cc.c,v 1.1 2005/09/19 03:34:18 kurt Exp $ */
+
+/*
+ * Copyright (c) 2005 Kurt Miller <kurt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+int ccSymbol;
diff --git a/regress/libexec/ld.so/dlsym/test3/libcc/shlib_version b/regress/libexec/ld.so/dlsym/test3/libcc/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libcc/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/dlsym/test3/libdd/Makefile b/regress/libexec/ld.so/dlsym/test3/libdd/Makefile
new file mode 100644
index 00000000000..cff1729a511
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libdd/Makefile
@@ -0,0 +1,11 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $
+
+LIB= dd
+SRCS= dd.c
+LDADD+= -Wl,-E
+LDADD+= -Wl,-rpath,$(EE_OBJDIR)
+LDADD+= -L$(EE_OBJDIR) -lee
+
+regress: all
+
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/dlsym/test3/libdd/dd.c b/regress/libexec/ld.so/dlsym/test3/libdd/dd.c
new file mode 100644
index 00000000000..d12166503e4
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libdd/dd.c
@@ -0,0 +1,19 @@
+/* $OpenBSD: dd.c,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $ */
+
+/*
+ * Copyright (c) 2005 Kurt Miller <kurt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+int ddSymbol;
diff --git a/regress/libexec/ld.so/dlsym/test3/libdd/shlib_version b/regress/libexec/ld.so/dlsym/test3/libdd/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libdd/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/dlsym/test3/libee/Makefile b/regress/libexec/ld.so/dlsym/test3/libee/Makefile
new file mode 100644
index 00000000000..9bd9325b9fa
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libee/Makefile
@@ -0,0 +1,8 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $
+
+LIB= ee
+SRCS= ee.c
+
+regress: all
+
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/dlsym/test3/libee/ee.c b/regress/libexec/ld.so/dlsym/test3/libee/ee.c
new file mode 100644
index 00000000000..4a262c9f32b
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libee/ee.c
@@ -0,0 +1,19 @@
+/* $OpenBSD: ee.c,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $ */
+
+/*
+ * Copyright (c) 2005 Kurt Miller <kurt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+int eeSymbol;
diff --git a/regress/libexec/ld.so/dlsym/test3/libee/shlib_version b/regress/libexec/ld.so/dlsym/test3/libee/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/libee/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/dlsym/test3/prog1/Makefile b/regress/libexec/ld.so/dlsym/test3/prog1/Makefile
new file mode 100644
index 00000000000..3bbb58f81c2
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/prog1/Makefile
@@ -0,0 +1,12 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $
+
+PROG= prog1
+SRCS= main.c
+LDADD+= -laa
+LDFLAGS+= -Wl,-E
+LDFLAGS+= -Wl,-rpath,$(AA_OBJDIR)
+LDFLAGS+= -Wl,-rpath,$(BB_OBJDIR)
+LDFLAGS+= -Wl,-rpath,$(DD_OBJDIR)
+LDFLAGS+= -L$(AA_OBJDIR)
+
+.include <bsd.regress.mk>
diff --git a/regress/libexec/ld.so/dlsym/test3/prog1/main.c b/regress/libexec/ld.so/dlsym/test3/prog1/main.c
new file mode 100644
index 00000000000..f0bc8143353
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/prog1/main.c
@@ -0,0 +1,52 @@
+/* $OpenBSD: main.c,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $ */
+
+/*
+ * Copyright (c) 2005 Kurt Miller <kurt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <dlfcn.h>
+#include <stdio.h>
+
+int mainSymbol;
+
+int
+main()
+{
+ int ret = 0;
+ void *libbb;
+ void *libdd;
+ int (*bbTest1)(void *, void *);
+
+ libbb = dlopen("libbb.so", RTLD_LAZY);
+ if (libbb == NULL) {
+ printf("dlopen(\"libbb.so\", RTLD_LAZY) FAILED\n");
+ return (1);
+ }
+
+ libdd = dlopen("libdd.so", RTLD_LAZY);
+ if (libdd == NULL) {
+ printf("dlopen(\"libdd.so\", RTLD_LAZY) FAILED\n");
+ return (1);
+ }
+
+ bbTest1 = dlsym(libbb, "bbTest1");
+
+ ret = (*bbTest1)(libbb, libdd);
+
+ dlclose(libbb);
+ dlclose(libdd);
+
+ return (ret);
+}
diff --git a/regress/libexec/ld.so/dlsym/test3/prog2/Makefile b/regress/libexec/ld.so/dlsym/test3/prog2/Makefile
new file mode 100644
index 00000000000..8bf313dd2b3
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/prog2/Makefile
@@ -0,0 +1,13 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $
+
+PROG= prog2
+SRCS= main.c
+CPPFLAGS+= -I$(AA_DIR)
+LDADD+= -laa
+LDFLAGS+= -Wl,-E
+LDFLAGS+= -Wl,-rpath,$(AA_OBJDIR)
+LDFLAGS+= -Wl,-rpath,$(BB_OBJDIR)
+LDFLAGS+= -Wl,-rpath,$(DD_OBJDIR)
+LDFLAGS+= -L$(AA_OBJDIR)
+
+.include <bsd.regress.mk>
diff --git a/regress/libexec/ld.so/dlsym/test3/prog2/main.c b/regress/libexec/ld.so/dlsym/test3/prog2/main.c
new file mode 100644
index 00000000000..11b1be25a02
--- /dev/null
+++ b/regress/libexec/ld.so/dlsym/test3/prog2/main.c
@@ -0,0 +1,52 @@
+/* $OpenBSD: main.c,v 1.1.1.1 2005/09/19 03:34:18 kurt Exp $ */
+
+/*
+ * Copyright (c) 2005 Kurt Miller <kurt@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <dlfcn.h>
+#include <stdio.h>
+
+int mainSymbol;
+
+int
+main()
+{
+ int ret = 0;
+ void *libbb;
+ void *libdd;
+ int (*bbTest2)(void *);
+
+ libbb = dlopen("libbb.so", RTLD_LAZY);
+ if (libbb == NULL) {
+ printf("dlopen(\"libbb.so\", RTLD_LAZY) FAILED\n");
+ return (1);
+ }
+
+ libdd = dlopen("libdd.so", RTLD_LAZY);
+ if (libdd == NULL) {
+ printf("dlopen(\"libdd.so\", RTLD_LAZY) FAILED\n");
+ return (1);
+ }
+
+ bbTest2 = dlsym(libbb, "bbTest2");
+
+ ret = (*bbTest2)(libbb);
+
+ dlclose(libbb);
+ dlclose(libdd);
+
+ return (ret);
+}