diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2002-02-10 22:51:42 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2002-02-10 22:51:42 +0000 |
commit | a6524401a41db61ae7519fcd842ce182a1a98505 (patch) | |
tree | 54350b4c98c3d71f4a3880c05df2fece1d377611 /regress/libexec/ld.so/weak/prog | |
parent | d0cf1a3683c12d4728861387529f1e41117938bd (diff) |
basic weak reference test.
Diffstat (limited to 'regress/libexec/ld.so/weak/prog')
-rw-r--r-- | regress/libexec/ld.so/weak/prog/Makefile | 23 | ||||
-rw-r--r-- | regress/libexec/ld.so/weak/prog/defs.h | 11 | ||||
-rw-r--r-- | regress/libexec/ld.so/weak/prog/main.c | 20 |
3 files changed, 54 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/weak/prog/Makefile b/regress/libexec/ld.so/weak/prog/Makefile new file mode 100644 index 00000000000..09d58077c2e --- /dev/null +++ b/regress/libexec/ld.so/weak/prog/Makefile @@ -0,0 +1,23 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2002/02/10 22:51:41 fgsch Exp $ + +.include <bsd.obj.mk> + +PROG= prog +SRCS= main.c + +LIBWEAK!= if test -d ${.CURDIR}/../libweak/${__objdir} ; then \ + echo "${.CURDIR}/../libweak/${__objdir}" ; \ + else \ + echo "${.CURDIR}/../libweak" ; \ + fi + +LIBSTRONG!= if test -d ${.CURDIR}/../libstrong/${__objdir} ; then \ + echo "${.CURDIR}/../libstrong/${__objdir}" ; \ + else \ + echo "${.CURDIR}/../libstrong" ; \ + fi + +LDADD+= -Wl,-rpath,${LIBWEAK} -L${LIBWEAK} -lweak +LDADD+= -Wl,-rpath,${LIBSTRONG} -L${LIBSTRONG} -lstrong + +.include <bsd.regress.mk> diff --git a/regress/libexec/ld.so/weak/prog/defs.h b/regress/libexec/ld.so/weak/prog/defs.h new file mode 100644 index 00000000000..1e0b2928a1c --- /dev/null +++ b/regress/libexec/ld.so/weak/prog/defs.h @@ -0,0 +1,11 @@ +/* $OpenBSD: defs.h,v 1.1 2002/02/10 22:51:41 fgsch Exp $ */ + +/* + * Public domain. 2002, Federico Schwindt <fgsch@openbsd.org>. + */ + +#define WEAK_REF 0 +#define STRONG_REF 1 + +int weak_func(void); +int func(void); diff --git a/regress/libexec/ld.so/weak/prog/main.c b/regress/libexec/ld.so/weak/prog/main.c new file mode 100644 index 00000000000..6964eb3ffdb --- /dev/null +++ b/regress/libexec/ld.so/weak/prog/main.c @@ -0,0 +1,20 @@ +/* $OpenBSD: main.c,v 1.1 2002/02/10 22:51:41 fgsch Exp $ */ + +/* + * Public domain. 2002, Federico Schwindt <fgsch@openbsd.org>. + */ + +#include <err.h> +#include "defs.h" + +int +main(int argc, char **argv) +{ + if (weak_func() != WEAK_REF) + err(1, "error calling weak reference"); + + if (func() != STRONG_REF) + err(1, "error calling strong reference"); + + return (0); +} |