diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2011-11-29 03:38:27 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2011-11-29 03:38:27 +0000 |
commit | 3bdb0e7e5948fea1cbffd466196abc9263f81b78 (patch) | |
tree | 417dbaba784a631e7af1fb03b388eea74e3f8f71 /regress | |
parent | 4e2c8c00de25f8abff6e0829517a8fa76cf248f1 (diff) |
ld.so initfirst regress test
Diffstat (limited to 'regress')
18 files changed, 277 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/initfirst/libaa/Makefile b/regress/libexec/ld.so/initfirst/libaa/Makefile new file mode 100644 index 00000000000..65d3c85fb78 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/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/libaa/aa.C b/regress/libexec/ld.so/initfirst/libaa/aa.C new file mode 100644 index 00000000000..6c024da662d --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libaa/aa.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: aa.C,v 1.1 2011/11/29 03:38:26 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/libaa/shlib_version b/regress/libexec/ld.so/initfirst/libaa/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libaa/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/libab/Makefile b/regress/libexec/ld.so/initfirst/libab/Makefile new file mode 100644 index 00000000000..0e9b84d741e --- /dev/null +++ b/regress/libexec/ld.so/initfirst/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/libab/ab.C b/regress/libexec/ld.so/initfirst/libab/ab.C new file mode 100644 index 00000000000..f1b18927efb --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libab/ab.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: ab.C,v 1.1 2011/11/29 03:38:26 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/libab/shlib_version b/regress/libexec/ld.so/initfirst/libab/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libab/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/libac/Makefile b/regress/libexec/ld.so/initfirst/libac/Makefile new file mode 100644 index 00000000000..299b4649e15 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/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/libac/ac.C b/regress/libexec/ld.so/initfirst/libac/ac.C new file mode 100644 index 00000000000..15844f9ca18 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libac/ac.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: ac.C,v 1.1 2011/11/29 03:38:26 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/libac/shlib_version b/regress/libexec/ld.so/initfirst/libac/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libac/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/libad/Makefile b/regress/libexec/ld.so/initfirst/libad/Makefile new file mode 100644 index 00000000000..73cf97acd50 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/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/libad/ad.C b/regress/libexec/ld.so/initfirst/libad/ad.C new file mode 100644 index 00000000000..e7f5bf34874 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libad/ad.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: ad.C,v 1.1 2011/11/29 03:38:26 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/libad/shlib_version b/regress/libexec/ld.so/initfirst/libad/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libad/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/libae/Makefile b/regress/libexec/ld.so/initfirst/libae/Makefile new file mode 100644 index 00000000000..50845bbe774 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libae/Makefile @@ -0,0 +1,3 @@ +LIB=ae +SRCS= ae.C +.include <bsd.lib.mk> diff --git a/regress/libexec/ld.so/initfirst/libae/ae.C b/regress/libexec/ld.so/initfirst/libae/ae.C new file mode 100644 index 00000000000..824e4f76a76 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libae/ae.C @@ -0,0 +1,26 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: ae.C,v 1.1 2011/11/29 03:38:26 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/libae/shlib_version b/regress/libexec/ld.so/initfirst/libae/shlib_version new file mode 100644 index 00000000000..97c9f92d6b8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/libae/shlib_version @@ -0,0 +1,2 @@ +major=0 +minor=0 diff --git a/regress/libexec/ld.so/initfirst/prog1/prog1.C b/regress/libexec/ld.so/initfirst/prog1/prog1.C new file mode 100644 index 00000000000..0eb201d98e8 --- /dev/null +++ b/regress/libexec/ld.so/initfirst/prog1/prog1.C @@ -0,0 +1,31 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: prog1.C,v 1.1 2011/11/29 03:38:26 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/prog2/Makefile b/regress/libexec/ld.so/initfirst/prog2/Makefile new file mode 100644 index 00000000000..f18f6e7711d --- /dev/null +++ b/regress/libexec/ld.so/initfirst/prog2/Makefile @@ -0,0 +1,57 @@ +# $OpenBSD: Makefile,v 1.1 2011/11/29 03:38:26 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/prog2/prog2.C b/regress/libexec/ld.so/initfirst/prog2/prog2.C new file mode 100644 index 00000000000..5c85d031c0e --- /dev/null +++ b/regress/libexec/ld.so/initfirst/prog2/prog2.C @@ -0,0 +1,24 @@ +/* + * Public Domain 2011 Kurt Miller + * + * $OpenBSD: prog2.C,v 1.1 2011/11/29 03:38:26 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; +} |