diff options
Diffstat (limited to 'regress/libexec/ld.so/initfirst/test2')
20 files changed, 337 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/initfirst/test2/Makefile b/regress/libexec/ld.so/initfirst/test2/Makefile new file mode 100644 index 00000000000..1052e99b6fe --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/Makefile @@ -0,0 +1,3 @@ +SUBDIR=libae libad libac libab libaa prog1 prog2 + +.include <bsd.subdir.mk> diff --git a/regress/libexec/ld.so/initfirst/test2/libaa/Makefile b/regress/libexec/ld.so/initfirst/test2/libaa/Makefile new file mode 100644 index 00000000000..65d3c85fb78 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libaa/Makefile @@ -0,0 +1,5 @@ +LIB=aa +SRCS= aa.C +LDADD=-L../libab +LDADD+=-lab +.include <bsd.lib.mk> diff --git a/regress/libexec/ld.so/initfirst/test2/libaa/aa.C b/regress/libexec/ld.so/initfirst/test2/libaa/aa.C new file mode 100644 index 00000000000..609af5c1ea0 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libaa/aa.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: aa.C,v 1.1 2011/11/29 04:36:15 kurt Exp $ + */ + +#include <iostream> + +class AA +{ + public: + AA(); + ~AA(); +}; + +AA::AA() +{ + std::cout << "A"; +} + +AA::~AA() +{ + std::cout << "a"; +} + +AA a; diff --git a/regress/libexec/ld.so/initfirst/test2/libaa/shlib_version b/regress/libexec/ld.so/initfirst/test2/libaa/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libaa/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/test2/libab/Makefile b/regress/libexec/ld.so/initfirst/test2/libab/Makefile new file mode 100644 index 00000000000..0e9b84d741e --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libab/Makefile @@ -0,0 +1,6 @@ +LIB=ab +SRCS= ab.C +LDADD=-Wl,-z,initfirst +LDADD+=-L../libac +LDADD+=-lac +.include <bsd.lib.mk> diff --git a/regress/libexec/ld.so/initfirst/test2/libab/ab.C b/regress/libexec/ld.so/initfirst/test2/libab/ab.C new file mode 100644 index 00000000000..1812c3ca617 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libab/ab.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: ab.C,v 1.1 2011/11/29 04:36:15 kurt Exp $ + */ + +#include <iostream> + +class AB +{ + public: + AB(); + ~AB(); +}; + +AB::AB() +{ + std::cout << "B"; +} + +AB::~AB() +{ + std::cout << "b"; +} + +AB b; diff --git a/regress/libexec/ld.so/initfirst/test2/libab/shlib_version b/regress/libexec/ld.so/initfirst/test2/libab/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libab/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/test2/libac/Makefile b/regress/libexec/ld.so/initfirst/test2/libac/Makefile new file mode 100644 index 00000000000..299b4649e15 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libac/Makefile @@ -0,0 +1,5 @@ +LIB=ac +SRCS= ac.C +LDADD=-L../libad +LDADD+=-lad +.include <bsd.lib.mk> diff --git a/regress/libexec/ld.so/initfirst/test2/libac/ac.C b/regress/libexec/ld.so/initfirst/test2/libac/ac.C new file mode 100644 index 00000000000..512ef496b40 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libac/ac.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: ac.C,v 1.1 2011/11/29 04:36:15 kurt Exp $ + */ + +#include <iostream> + +class AC +{ + public: + AC(); + ~AC(); +}; + +AC::AC() +{ + std::cout << "C"; +} + +AC::~AC() +{ + std::cout << "c"; +} + +AC c; diff --git a/regress/libexec/ld.so/initfirst/test2/libac/shlib_version b/regress/libexec/ld.so/initfirst/test2/libac/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libac/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/test2/libad/Makefile b/regress/libexec/ld.so/initfirst/test2/libad/Makefile new file mode 100644 index 00000000000..73cf97acd50 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libad/Makefile @@ -0,0 +1,6 @@ +LIB=ad +SRCS= ad.C +LDADD=-Wl,-z,initfirst +LDADD+=-L../libae +LDADD+=-lae +.include <bsd.lib.mk> diff --git a/regress/libexec/ld.so/initfirst/test2/libad/ad.C b/regress/libexec/ld.so/initfirst/test2/libad/ad.C new file mode 100644 index 00000000000..1ec19127898 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libad/ad.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: ad.C,v 1.1 2011/11/29 04:36:15 kurt Exp $ + */ + +#include <iostream> + +class AD +{ + public: + AD(); + ~AD(); +}; + +AD::AD() +{ + std::cout << "D"; +} + +AD::~AD() +{ + std::cout << "d"; +} + +AD d; diff --git a/regress/libexec/ld.so/initfirst/test2/libad/shlib_version b/regress/libexec/ld.so/initfirst/test2/libad/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libad/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/test2/libae/Makefile b/regress/libexec/ld.so/initfirst/test2/libae/Makefile new file mode 100644 index 00000000000..50845bbe774 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libae/Makefile @@ -0,0 +1,3 @@ +LIB=ae +SRCS= ae.C +.include <bsd.lib.mk> diff --git a/regress/libexec/ld.so/initfirst/test2/libae/ae.C b/regress/libexec/ld.so/initfirst/test2/libae/ae.C new file mode 100644 index 00000000000..61f2cdcf472 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libae/ae.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: ae.C,v 1.1 2011/11/29 04:36:15 kurt Exp $ + */ + +#include <iostream> + +class AE +{ + public: + AE(); + ~AE(); +}; + +AE::AE() +{ + std::cout << "E"; +} + +AE::~AE() +{ + std::cout << "e"; +} + +AE e; diff --git a/regress/libexec/ld.so/initfirst/test2/libae/shlib_version b/regress/libexec/ld.so/initfirst/test2/libae/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/libae/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/test2/prog1/Makefile b/regress/libexec/ld.so/initfirst/test2/prog1/Makefile new file mode 100644 index 00000000000..b3d6fcb2b3e --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/prog1/Makefile @@ -0,0 +1,57 @@ +# $OpenBSD: Makefile,v 1.1 2011/11/29 04:36:15 kurt 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 + +AC_DIR=${.CURDIR}/../libac +AC_OBJDIR!= if [ -d $(AC_DIR)/${__objdir} ]; then \ + echo "$(AC_DIR)/${__objdir}"; \ + else \ + echo "$(AC_DIR)"; \ + fi + +AD_DIR=${.CURDIR}/../libad +AD_OBJDIR!= if [ -d $(AD_DIR)/${__objdir} ]; then \ + echo "$(AD_DIR)/${__objdir}"; \ + else \ + echo "$(AD_DIR)"; \ + fi + +AE_DIR=${.CURDIR}/../libae +AE_OBJDIR!= if [ -d $(AE_DIR)/${__objdir} ]; then \ + echo "$(AE_DIR)/${__objdir}"; \ + else \ + echo "$(AE_DIR)"; \ + fi + +LDADD=-laa +LDFLAGS= -L$(AA_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AA_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AB_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AC_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AD_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AE_OBJDIR) +NOMAN= +CC=c++ + +run-regress-${PROG}: ${PROG} + [ "`./${PROG}`" = "DBECAPpacebd" ] + +.include <bsd.regress.mk> diff --git a/regress/libexec/ld.so/initfirst/test2/prog1/prog1.C b/regress/libexec/ld.so/initfirst/test2/prog1/prog1.C new file mode 100644 index 00000000000..7a210ef83c4 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/prog1/prog1.C @@ -0,0 +1,31 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: prog1.C,v 1.1 2011/11/29 04:36:15 kurt Exp $ + */ + +#include <iostream> + +class P +{ + public: + P(); + ~P(); +}; + +P::P() +{ + std::cout << "P"; +} + +P::~P() +{ + std::cout << "p"; +} + +P p; + +main() +{ + return 0; +} diff --git a/regress/libexec/ld.so/initfirst/test2/prog2/Makefile b/regress/libexec/ld.so/initfirst/test2/prog2/Makefile new file mode 100644 index 00000000000..c0c39151d66 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/prog2/Makefile @@ -0,0 +1,57 @@ +# $OpenBSD: Makefile,v 1.1 2011/11/29 04:36:15 kurt 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 + +AC_DIR=${.CURDIR}/../libac +AC_OBJDIR!= if [ -d $(AC_DIR)/${__objdir} ]; then \ + echo "$(AC_DIR)/${__objdir}"; \ + else \ + echo "$(AC_DIR)"; \ + fi + +AD_DIR=${.CURDIR}/../libad +AD_OBJDIR!= if [ -d $(AD_DIR)/${__objdir} ]; then \ + echo "$(AD_DIR)/${__objdir}"; \ + else \ + echo "$(AD_DIR)"; \ + fi + +AE_DIR=${.CURDIR}/../libae +AE_OBJDIR!= if [ -d $(AE_DIR)/${__objdir} ]; then \ + echo "$(AE_DIR)/${__objdir}"; \ + else \ + echo "$(AE_DIR)"; \ + fi + +LDADD=-laa +LDFLAGS= -L$(AA_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AA_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AB_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AC_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AD_OBJDIR) +LDFLAGS+= -Wl,-rpath,$(AE_OBJDIR) +NOMAN= +CC=c++ + +run-regress-${PROG}: ${PROG} + [ "`./${PROG}`" = "DBECAacebd" ] + +.include <bsd.regress.mk> diff --git a/regress/libexec/ld.so/initfirst/test2/prog2/prog2.C b/regress/libexec/ld.so/initfirst/test2/prog2/prog2.C new file mode 100644 index 00000000000..87bcbb2798f --- /dev/null +++ b/regress/libexec/ld.so/initfirst/test2/prog2/prog2.C @@ -0,0 +1,24 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: prog2.C,v 1.1 2011/11/29 04:36:15 kurt Exp $ + */ + +#include <iostream> +#include <dlfcn.h> +#include <string.h> + +int +main() +{ + void *handle1; + + handle1 = dlopen("libaa.so", DL_LAZY); + if (handle1 == NULL) { + std::cout << "handle1 open libaa failed\n"; + return (1); + } + dlclose(handle1); + + return 0; +} |