I stole your diff yesterday, when I built a static snapshot for fun.
> The plan is to use lld (the llvm linker) on arm64 to avoid GLPv3
> binutils. Mostly works, but it triggers an issue in building ldapd
> and ldapctl.
>
> The problem here is that the code uses the SHA1 functions in
> libcrypto, but doesn't explicitly link against that library. With our
> ancient binutils we don't notice this, because we link against libtls,
> which as a DT_NEEDED entry for libcrypto. But lld doesn't fall for
> this. And I believe modern binutils don't do this either.
>
> Diff below fixes this (and trims ${LIBSSL} from DPADD since we don't
> link against that).
>
> ok?
>
>
> Index: ldapd/Makefile
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ldapd/Makefile,v
> retrieving revision 1.13
> diff -u -p -r1.13 Makefile
> --- ldapd/Makefile 1 May 2016 00:32:37 -0000 1.13
> +++ ldapd/Makefile 21 Jan 2017 09:50:35 -0000
> @@ -8,8 +8,8 @@ SRCS= ber.c log.c control.c \
> auth.c modify.c index.c evbuffer_tls.c \
> validate.c uuid.c schema.c imsgev.c syntax.c matching.c
>
> -LDADD= -ltls -levent -lz -lutil
> -DPADD= ${LIBEVENT} ${LIBTLS} ${LIBCRYPTO} ${LIBSSL} ${LIBZ}
> ${LIBUTIL}
> +LDADD= -ltls -lcrypto -levent -lz -lutil
> +DPADD= ${LIBTLS} ${LIBCRYPTO} ${LIBEVENT} ${LIBZ} ${LIBUTIL}
> CFLAGS+= -I${.CURDIR} -g
> CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes
> CFLAGS+= -Wmissing-declarations
> Index: ldapctl/Makefile
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ldapctl/Makefile,v
> retrieving revision 1.6
> diff -u -p -r1.6 Makefile
> --- ldapctl/Makefile 1 May 2016 10:40:27 -0000 1.6
> +++ ldapctl/Makefile 21 Jan 2017 09:50:35 -0000
> @@ -7,8 +7,8 @@ MAN= ldapctl.8
> SRCS= ldapctl.c parse.y btree.c log.c ber.c util.c \
> index.c attributes.c schema.c syntax.c matching.c
>
> -LDADD= -ltls -levent -lz -lutil
> -DPADD= ${LIBTLS} ${LIBEVENT} ${LIBZ} ${LIBUTIL}
> +LDADD= -ltls -lcrypto -levent -lz -lutil
> +DPADD= ${LIBTLS} ${LIBCRYPTO} ${LIBEVENT} ${LIBZ} ${LIBUTIL}
> CFLAGS+= -I${.CURDIR}/../ldapd
> CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes
> CFLAGS+= -Wmissing-declarations
>