summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-12-31 04:07:35 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-12-31 04:07:35 +0000
commit75653a67c27786a99d35218c8ed1c9a67ae1041f (patch)
treeb42f1ce2caf55b634f476b7ef601aea6caef31b0
parent98590856f0040dfc1f6dec213e1fc6250c2e2de3 (diff)
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>