summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2013-12-31 04:07:34 +0000
committerguenther <guenther@openbsd.org>2013-12-31 04:07:34 +0000
commit91ec9eccab7ab2ba5112a38634b4e7f92d055016 (patch)
tree18f0d3f58e36bc4e43615b145e9ac6afda10b127
parentdocument file format (diff)
downloadwireguard-openbsd-91ec9eccab7ab2ba5112a38634b4e7f92d055016.tar.xz
wireguard-openbsd-91ec9eccab7ab2ba5112a38634b4e7f92d055016.zip
Don't consider ld.so to be successfully built unless a test program
using it works, because seeing "make build" fail right after it installs a broken ld.so is *#!&%(@*)# annoying. Presumably needs to be fixed for cross-builds. ok matthew@ deraadt@ miod@
-rw-r--r--libexec/ld.so/Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/libexec/ld.so/Makefile b/libexec/ld.so/Makefile
index ae716f48ac4..e25cefc7616 100644
--- a/libexec/ld.so/Makefile
+++ b/libexec/ld.so/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.45 2013/07/05 21:29:51 miod Exp $
+# $OpenBSD: Makefile,v 1.46 2013/12/31 04:07:34 guenther Exp $
SUBDIR=ldconfig ldd
MAN= ld.so.1
@@ -34,8 +34,17 @@ INSTALL_STRIP=
ELF_LDFLAGS+=--shared -Bsymbolic --no-undefined
-$(PROG):
- $(LD) -x -e _dl_start $(ELF_LDFLAGS) -o $(PROG) $(OBJS) $(LDADD)
+test_prog= test-$(PROG)
+candidate= $(PROG).test
+
+$(test_prog):
+ printf '#include <stdio.h>\nint main(int argc, char **argv){ printf("%%s\\n", argv[1]); }\n' | \
+ $(CC) -x c - -Wl,-dynamic-linker,${.OBJDIR}/$(candidate) -o $@
+
+$(PROG): $(test_prog)
+ $(LD) -x -e _dl_start $(ELF_LDFLAGS) -o $(candidate) $(OBJS) $(LDADD)
+ ulimit -c 0; [ "`${.OBJDIR}/$(test_prog) ok`" = ok ]
+ cp $(candidate) $@
.endif
.include <bsd.prog.mk>