summaryrefslogtreecommitdiff
path: root/regress/libexec/ld.so/edgecases
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2005-09-22 22:31:28 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2005-09-22 22:31:28 +0000
commitb031db1e1dcb944cd731a4532fe60db8d5623987 (patch)
treec45bbdc8113daee1ccc739252bafd9fa65972f1a /regress/libexec/ld.so/edgecases
parentb58edf324a1113212322f0ec59dd47d8cf183a23 (diff)
Test if a program exits when some of it's symbols are not found.
Diffstat (limited to 'regress/libexec/ld.so/edgecases')
-rw-r--r--regress/libexec/ld.so/edgecases/Makefile3
-rw-r--r--regress/libexec/ld.so/edgecases/test1/Makefile3
-rw-r--r--regress/libexec/ld.so/edgecases/test1/libaa_b/Makefile4
-rw-r--r--regress/libexec/ld.so/edgecases/test1/libaa_b/aa.c8
-rw-r--r--regress/libexec/ld.so/edgecases/test1/libaa_b/shlib_version2
-rw-r--r--regress/libexec/ld.so/edgecases/test1/libaa_g/Makefile4
-rw-r--r--regress/libexec/ld.so/edgecases/test1/libaa_g/aa.c4
-rw-r--r--regress/libexec/ld.so/edgecases/test1/libaa_g/shlib_version2
-rw-r--r--regress/libexec/ld.so/edgecases/test1/prog1/Makefile36
-rw-r--r--regress/libexec/ld.so/edgecases/test1/prog1/main.c22
10 files changed, 88 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/edgecases/Makefile b/regress/libexec/ld.so/edgecases/Makefile
new file mode 100644
index 00000000000..892dd04dae8
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/Makefile
@@ -0,0 +1,3 @@
+SUBDIR=test1
+
+.include <bsd.subdir.mk>
diff --git a/regress/libexec/ld.so/edgecases/test1/Makefile b/regress/libexec/ld.so/edgecases/test1/Makefile
new file mode 100644
index 00000000000..be8f1c58323
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/test1/Makefile
@@ -0,0 +1,3 @@
+SUBDIR=libaa_g libaa_b prog1
+
+.include <bsd.subdir.mk>
diff --git a/regress/libexec/ld.so/edgecases/test1/libaa_b/Makefile b/regress/libexec/ld.so/edgecases/test1/libaa_b/Makefile
new file mode 100644
index 00000000000..673cabf9d27
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/test1/libaa_b/Makefile
@@ -0,0 +1,4 @@
+LIB=aa
+SRCS= aa.c
+regress: all
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/edgecases/test1/libaa_b/aa.c b/regress/libexec/ld.so/edgecases/test1/libaa_b/aa.c
new file mode 100644
index 00000000000..d21680fcde6
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/test1/libaa_b/aa.c
@@ -0,0 +1,8 @@
+/* the point of this library is to not define function ad() */
+ad_notdefine()
+{
+}
+/*
+ * libglobal is not defined by this library
+ * int libglobal;
+ */
diff --git a/regress/libexec/ld.so/edgecases/test1/libaa_b/shlib_version b/regress/libexec/ld.so/edgecases/test1/libaa_b/shlib_version
new file mode 100644
index 00000000000..97c9f92d6b8
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/test1/libaa_b/shlib_version
@@ -0,0 +1,2 @@
+major=0
+minor=0
diff --git a/regress/libexec/ld.so/edgecases/test1/libaa_g/Makefile b/regress/libexec/ld.so/edgecases/test1/libaa_g/Makefile
new file mode 100644
index 00000000000..673cabf9d27
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/test1/libaa_g/Makefile
@@ -0,0 +1,4 @@
+LIB=aa
+SRCS= aa.c
+regress: all
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/edgecases/test1/libaa_g/aa.c b/regress/libexec/ld.so/edgecases/test1/libaa_g/aa.c
new file mode 100644
index 00000000000..0b7bcbb698a
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/test1/libaa_g/aa.c
@@ -0,0 +1,4 @@
+ad()
+{
+}
+int libglobal;
diff --git a/regress/libexec/ld.so/edgecases/test1/libaa_g/shlib_version b/regress/libexec/ld.so/edgecases/test1/libaa_g/shlib_version
new file mode 100644
index 00000000000..97c9f92d6b8
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/test1/libaa_g/shlib_version
@@ -0,0 +1,2 @@
+major=0
+minor=0
diff --git a/regress/libexec/ld.so/edgecases/test1/prog1/Makefile b/regress/libexec/ld.so/edgecases/test1/prog1/Makefile
new file mode 100644
index 00000000000..89df95e03eb
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/test1/prog1/Makefile
@@ -0,0 +1,36 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2005/09/22 22:31:27 drahn Exp $
+
+.include <bsd.obj.mk>
+
+PROG=prog1
+
+SRCS=main.c
+
+AAG_DIR=${.CURDIR}/../libaa_g
+AAG_OBJDIR!= if [ -d $(AAG_DIR)/${__objdir} ]; then \
+ echo "$(AAG_DIR)/${__objdir}"; \
+ else \
+ echo "$(AAG_DIR)"; \
+ fi
+
+AAB_DIR=${.CURDIR}/../libaa_b
+AAB_OBJDIR!= if [ -d $(AAB_DIR)/${__objdir} ]; then \
+ echo "$(AAB_DIR)/${__objdir}"; \
+ else \
+ echo "$(AAB_DIR)"; \
+ fi
+
+
+
+CFLAGS=-I${.CURDIR}/../libac
+LDADD=
+LDADD+=-laa
+LDFLAGS=-L$(AAG_OBJDIR)
+LDFLAGS+= -Wl,-rpath,$(AAB_OBJDIR)
+NOMAN=
+
+
+run-regress-${PROG}: ${PROG}
+ ./${PROG} 2>&1 | grep "undefined symbol 'libglobal'"
+ -./${PROG} >/dev/null 2>&1 || echo "ld.so killed program, good";
+.include <bsd.regress.mk>
diff --git a/regress/libexec/ld.so/edgecases/test1/prog1/main.c b/regress/libexec/ld.so/edgecases/test1/prog1/main.c
new file mode 100644
index 00000000000..f1cba3a9093
--- /dev/null
+++ b/regress/libexec/ld.so/edgecases/test1/prog1/main.c
@@ -0,0 +1,22 @@
+/*
+ * Public Domain 2003 Dale Rahn
+ *
+ * $OpenBSD: main.c,v 1.1.1.1 2005/09/22 22:31:27 drahn Exp $
+ */
+#include <stdio.h>
+#include <dlfcn.h>
+
+
+void ad(void);
+extern int libglobal;
+
+void (*ad_f)(void) = &ad;
+int *a = &libglobal;
+int
+main()
+{
+
+ ad_f();
+
+ return 1;
+}