File: 01-fix-pam-otpw-linking

package info (click to toggle)
otpw 1.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 384 kB
  • sloc: ansic: 2,858; makefile: 302
file content (33 lines) | stat: -rw-r--r-- 1,412 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)