diff options
Diffstat (limited to 'regress')
-rw-r--r-- | regress/libexec/ld.so/link-order/Makefile | 7 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/lib10/10.c | 13 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/lib10/Makefile | 8 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/lib10/shlib_version | 2 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/lib11/11.c | 13 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/lib11/Makefile | 8 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/lib11/shlib_version | 2 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/lib20/20.c | 13 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/lib20/Makefile | 8 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/lib20/shlib_version | 2 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/libnover/Makefile | 16 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/libnover/nover.c | 13 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/prog/Makefile | 7 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/prog/prog.c | 25 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/test/Makefile | 79 | ||||
-rw-r--r-- | regress/libexec/ld.so/link-order/test/test.sh | 10 |
16 files changed, 226 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/link-order/Makefile b/regress/libexec/ld.so/link-order/Makefile new file mode 100644 index 00000000000..7ba418df8be --- /dev/null +++ b/regress/libexec/ld.so/link-order/Makefile @@ -0,0 +1,7 @@ +# $OpenBSD: Makefile,v 1.1 2003/07/01 05:51:30 niklas Exp $ + +SUBDIR+= libnover lib10 lib11 lib20 prog test + +install: + +.include <bsd.subdir.mk> diff --git a/regress/libexec/ld.so/link-order/lib10/10.c b/regress/libexec/ld.so/link-order/lib10/10.c new file mode 100644 index 00000000000..acc0e36c4f9 --- /dev/null +++ b/regress/libexec/ld.so/link-order/lib10/10.c @@ -0,0 +1,13 @@ +/* + * Public domain. 2003. Niklas Hallqvist. + * + * $OpenBSD: 10.c,v 1.1 2003/07/01 05:51:30 niklas Exp $ + */ + +#include <stdio.h> + +void +version(void) +{ + printf("1.0\n"); +} diff --git a/regress/libexec/ld.so/link-order/lib10/Makefile b/regress/libexec/ld.so/link-order/lib10/Makefile new file mode 100644 index 00000000000..8faed706162 --- /dev/null +++ b/regress/libexec/ld.so/link-order/lib10/Makefile @@ -0,0 +1,8 @@ +# $OpenBSD: Makefile,v 1.1 2003/07/01 05:51:30 niklas Exp $ + +LIB= test +SRCS= 10.c + +regress: all + +.include <bsd.lib.mk> diff --git a/regress/libexec/ld.so/link-order/lib10/shlib_version b/regress/libexec/ld.so/link-order/lib10/shlib_version new file mode 100644 index 00000000000..1edea46de91 --- /dev/null +++ b/regress/libexec/ld.so/link-order/lib10/shlib_version @@ -0,0 +1,2 @@ +major=1 +minor=0 diff --git a/regress/libexec/ld.so/link-order/lib11/11.c b/regress/libexec/ld.so/link-order/lib11/11.c new file mode 100644 index 00000000000..cd7fb80684f --- /dev/null +++ b/regress/libexec/ld.so/link-order/lib11/11.c @@ -0,0 +1,13 @@ +/* + * Public domain. 2003. Niklas Hallqvist. + * + * $OpenBSD: 11.c,v 1.1 2003/07/01 05:51:30 niklas Exp $ + */ + +#include <stdio.h> + +void +version(void) +{ + printf("1.1\n"); +} diff --git a/regress/libexec/ld.so/link-order/lib11/Makefile b/regress/libexec/ld.so/link-order/lib11/Makefile new file mode 100644 index 00000000000..3cc3ab37134 --- /dev/null +++ b/regress/libexec/ld.so/link-order/lib11/Makefile @@ -0,0 +1,8 @@ +# $OpenBSD: Makefile,v 1.1 2003/07/01 05:51:30 niklas Exp $ + +LIB= test +SRCS= 11.c + +regress: all + +.include <bsd.lib.mk> diff --git a/regress/libexec/ld.so/link-order/lib11/shlib_version b/regress/libexec/ld.so/link-order/lib11/shlib_version new file mode 100644 index 00000000000..893819d18ff --- /dev/null +++ b/regress/libexec/ld.so/link-order/lib11/shlib_version @@ -0,0 +1,2 @@ +major=1 +minor=1 diff --git a/regress/libexec/ld.so/link-order/lib20/20.c b/regress/libexec/ld.so/link-order/lib20/20.c new file mode 100644 index 00000000000..9638a816742 --- /dev/null +++ b/regress/libexec/ld.so/link-order/lib20/20.c @@ -0,0 +1,13 @@ +/* + * Public domain. 2003. Niklas Hallqvist. + * + * $OpenBSD: 20.c,v 1.1 2003/07/01 05:51:30 niklas Exp $ + */ + +#include <stdio.h> + +void +version(void) +{ + printf("2.0\n"); +} diff --git a/regress/libexec/ld.so/link-order/lib20/Makefile b/regress/libexec/ld.so/link-order/lib20/Makefile new file mode 100644 index 00000000000..09a07c6c72b --- /dev/null +++ b/regress/libexec/ld.so/link-order/lib20/Makefile @@ -0,0 +1,8 @@ +# $OpenBSD: Makefile,v 1.1 2003/07/01 05:51:30 niklas Exp $ + +LIB= test +SRCS= 20.c + +regress: all + +.include <bsd.lib.mk> diff --git a/regress/libexec/ld.so/link-order/lib20/shlib_version b/regress/libexec/ld.so/link-order/lib20/shlib_version new file mode 100644 index 00000000000..b52599a164f --- /dev/null +++ b/regress/libexec/ld.so/link-order/lib20/shlib_version @@ -0,0 +1,2 @@ +major=2 +minor=0 diff --git a/regress/libexec/ld.so/link-order/libnover/Makefile b/regress/libexec/ld.so/link-order/libnover/Makefile new file mode 100644 index 00000000000..bab047f76bf --- /dev/null +++ b/regress/libexec/ld.so/link-order/libnover/Makefile @@ -0,0 +1,16 @@ +# $OpenBSD: Makefile,v 1.1 2003/07/01 05:51:30 niklas Exp $ + +LIB= test +SRCS= nover.c + +regress: all + +.include <bsd.lib.mk> + +all: lib${LIB}.so + +lib${LIB}.so: ${SOBJS} ${DPADD} + @echo building shared ${LIB} library + @rm -f lib${LIB}.so + ${CC} -shared ${PICFLAG} \ + -o lib${LIB}.so `${LORDER} ${SOBJS}|tsort -q` ${LDADD} diff --git a/regress/libexec/ld.so/link-order/libnover/nover.c b/regress/libexec/ld.so/link-order/libnover/nover.c new file mode 100644 index 00000000000..ba3d2b50c2d --- /dev/null +++ b/regress/libexec/ld.so/link-order/libnover/nover.c @@ -0,0 +1,13 @@ +/* + * Public domain. 2003. Niklas Hallqvist. + * + * $OpenBSD: nover.c,v 1.1 2003/07/01 05:51:31 niklas Exp $ + */ + +#include <stdio.h> + +void +version(void) +{ + printf("none\n"); +} diff --git a/regress/libexec/ld.so/link-order/prog/Makefile b/regress/libexec/ld.so/link-order/prog/Makefile new file mode 100644 index 00000000000..51556ff62da --- /dev/null +++ b/regress/libexec/ld.so/link-order/prog/Makefile @@ -0,0 +1,7 @@ +# $OpenBSD: Makefile,v 1.1 2003/07/01 05:51:31 niklas Exp $ + +PROG= prog +SRCS= prog.c +NOMAN= true + +.include <bsd.prog.mk> diff --git a/regress/libexec/ld.so/link-order/prog/prog.c b/regress/libexec/ld.so/link-order/prog/prog.c new file mode 100644 index 00000000000..28f9cfb6683 --- /dev/null +++ b/regress/libexec/ld.so/link-order/prog/prog.c @@ -0,0 +1,25 @@ +#include <sys/param.h> +#include <err.h> +#include <dlfcn.h> + +#ifdef __ELF__ +#define C_LABEL(x) x +#else +#define C_LABEL(x) "_" ## x +#endif + +int +main() +{ + void *handle = dlopen("libtest.so", DL_LAZY); + void (*version)(void); + + if (handle == NULL) + errx(1, "could not dynamically link libtest"); + version = dlsym(handle, C_LABEL("version")); + if (version == NULL) + errx(2, "libtest did not define version()"); + version(); + dlclose(handle); + return 0; +} diff --git a/regress/libexec/ld.so/link-order/test/Makefile b/regress/libexec/ld.so/link-order/test/Makefile new file mode 100644 index 00000000000..8a7aacc5c92 --- /dev/null +++ b/regress/libexec/ld.so/link-order/test/Makefile @@ -0,0 +1,79 @@ +# $OpenBSD: Makefile,v 1.1 2003/07/01 05:51:31 niklas Exp $ + +REGRESS_TARGETS= test-none test-nover test-single test-minor \ + test-major test-nover-single + +.include <bsd.obj.mk> + +DIR_NOVER=${.CURDIR}/../libnover + +OBJDIR_NOVER!= if [ -d $(DIR_NOVER)/${__objdir} ]; then \ + echo "$(DIR_NOVER)/${__objdir}"; \ + else \ + echo "$(DIR_NOVER)"; \ + fi + +DIR_10=${.CURDIR}/../lib10 + +OBJDIR_10!= if [ -d $(DIR_10)/${__objdir} ]; then \ + echo "$(DIR_10)/${__objdir}"; \ + else \ + echo "$(DIR_10)"; \ + fi + +DIR_11=${.CURDIR}/../lib11 + +OBJDIR_11!= if [ -d $(DIR_11)/${__objdir} ]; then \ + echo "$(DIR_11)/${__objdir}"; \ + else \ + echo "$(DIR_11)"; \ + fi + +DIR_20=${.CURDIR}/../lib20 + +OBJDIR_20!= if [ -d $(DIR_20)/${__objdir} ]; then \ + echo "$(DIR_20)/${__objdir}"; \ + else \ + echo "$(DIR_20)"; \ + fi + +DIR_PROG=${.CURDIR}/../prog + +OBJDIR_PROG!= if [ -d $(DIR_PROG)/${__objdir} ]; then \ + echo "$(DIR_PROG)/${__objdir}"; \ + else \ + echo "$(DIR_PROG)"; \ + fi + +PROGPATH= ${OBJDIR_PROG}/prog + +make-lib: + @mkdir lib >/dev/null 2>&1 || true + +clean: + @rm lib/* >/dev/null 2>&1 || true + +test-none: make-lib clean + sh ${.CURDIR}/test.sh ${PROGPATH} '%ERROR%' + +test-nover: make-lib clean + cp ${OBJDIR_NOVER}/libtest.so lib/ + sh ${.CURDIR}/test.sh ${PROGPATH} none + +test-single: make-lib clean + cp ${OBJDIR_10}/libtest.so.1.0 lib/ + sh ${.CURDIR}/test.sh ${PROGPATH} 1.0 + +test-minor: make-lib clean + cp ${OBJDIR_10}/libtest.so.1.0 ${OBJDIR_11}/libtest.so.1.1 lib/ + sh ${.CURDIR}/test.sh ${PROGPATH} 1.1 + +test-major: make-lib clean + cp ${OBJDIR_11}/libtest.so.1.1 ${OBJDIR_20}/libtest.so.2.0 lib/ + sh ${.CURDIR}/test.sh ${PROGPATH} 2.0 + +test-nover-single: make-lib clean + cp ${OBJDIR_NOVER}/libtest.so ${OBJDIR_10}/libtest.so.1.0 lib/ + sh ${.CURDIR}/test.sh ${PROGPATH} none + +.include <bsd.regress.mk> diff --git a/regress/libexec/ld.so/link-order/test/test.sh b/regress/libexec/ld.so/link-order/test/test.sh new file mode 100644 index 00000000000..ef3bb4a1920 --- /dev/null +++ b/regress/libexec/ld.so/link-order/test/test.sh @@ -0,0 +1,10 @@ +# $OpenBSD: test.sh,v 1.1 2003/07/01 05:51:31 niklas Exp $ + +msg=`LD_LIBRARY_PATH=lib $1` +case $2 in +%ERROR%) + test $? -ne 0;; +*) + test X"$msg" = X"$2" +esac +exit $? |