Index: share/mk/bsd.libnames.mk =================================================================== --- share/mk/bsd.libnames.mk +++ share/mk/bsd.libnames.mk @@ -159,3 +159,13 @@ LIBZFS?= ${DESTDIR}${LIBDIR}/libzfs.a LIBZFS_CORE?= ${DESTDIR}${LIBDIR}/libzfs_core.a LIBZPOOL?= ${DESTDIR}${LIBDIR}/libzpool.a + +# enforce the 2 -lpthread and -lc to always be the last in that exact order +.if defined(LDADD) +.if ${LDADD:M-lpthread} +LDADD:= ${LDADD:N-lpthread} -lpthread +.endif +.if ${LDADD:M-lc} +LDADD:= ${LDADD:N-lc} -lc +.endif +.endif