From 91ec9eccab7ab2ba5112a38634b4e7f92d055016 Mon Sep 17 00:00:00 2001 From: guenther Date: Tue, 31 Dec 2013 04:07:34 +0000 Subject: [PATCH] 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@ --- libexec/ld.so/Makefile | 15 ++++++++++++--- 1 file 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 \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 -- 2.20.1