commit f084457ebcb657afba47c76f5d3e5880493cf7b8
Author: Ludovic Stordeur <ludovic@funolang.net>
Date:   Thu Feb 9 23:02:00 2017 +0100

    Use `gcc' to link pam_otpw.so instead of `ld'.
    
    Using `gcc' as a linking driver is the natural way to perform the
    linking step as it will take care to add the necessary additional
    libraries.
    
    This solves the following issues:
    - pam_otpw.so was not linked against the libc; while this is generally
      not an issue, pam_otpw.so uses features of the libc and as a result it
      should record it as a runtime dependency;
    - pam_otpw.so did not work on some embedded architectures (ex: armv7l)
      which do not implement in hardware some operations like modulo. In
      such situation, pam_otpw.so must statically link against libgcc.a which
      brings software emulation of these operations. Such implicit linking is
      correctly performed when using gcc as a linking driver.

diff --git a/Makefile b/Makefile
index 9c82d86..e1c35aa 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ rmd160.o: rmd160.c rmd160.h
 otpw-l.o: otpw-l.c otpw.c otpw.h md.h
 pam_otpw.o: pam_otpw.c otpw.h md.h
 pam_otpw.so: pam_otpw.o otpw-l.o rmd160.o md.o
-	ld --shared -o $@ $+ -lcrypt -lpam -lpam_misc
+	$(CC) --shared -o $@ $+ -lcrypt -lpam -lpam_misc
 
 distribution:
 	git archive --prefix otpw-$(VERSION)/ -o otpw-$(VERSION).tar.gz v$(VERSION)
