File: 88_35-Build-linker-invocation-ordering.patch

package info (click to toggle)
exim4 4.99.1-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 26,208 kB
  • sloc: ansic: 119,253; sh: 4,083; xml: 2,112; perl: 918; makefile: 550
file content (140 lines) | stat: -rw-r--r-- 5,080 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
From acdc767008460bf5e86a1bf39b43e8da7bd6e90d Mon Sep 17 00:00:00 2001
From: Andreas Metzler <ametzler@bebt.de>
Date: Sat, 13 Dec 2025 14:52:14 +0000
Subject: [PATCH] Build: linker invocation ordering

Apparently some linkers are sensitive to positioning
of library args in the commandline
---
 scripts/Configure-Makefile |  8 +++++++-
 src/auths/Makefile         |  4 ++--
 src/lookups/Makefile       |  4 +++-
 src/miscmods/Makefile      | 27 +++++++++++++--------------
 src/routers/Makefile       |  3 ++-
 5 files changed, 27 insertions(+), 19 deletions(-)

--- a/scripts/Configure-Makefile
+++ b/scripts/Configure-Makefile
@@ -306,11 +306,17 @@ fi
 # the auxiliary script generates $look_mf_post from $look_mf_pre
 
 cp ../src/lookups/Makefile $look_mf_pre
 EGREP="$egrep" ../scripts/lookups-Makefile
 
-# make the Makefiles for routers, transports, auths and miscmods
+# Make the Makefiles for routers, transports, auths and miscmods
+#
+# Columns in the here-file:
+#  1		"class"		the subdir name to work in
+#  2		"classdef"	is a prefix on the driver name, used for pulling
+#  				construction data from Local/Makefile
+#  (remainder)	"names"		a list of driver names, in caps
 # An _ prefix on a name means the control in Local/Makefile is DISABLED_<name>
 #
 while read class classdef names
 do
   cp ../src/$class/Makefile $class/Makefile.predynamic
--- a/src/auths/Makefile
+++ b/src/auths/Makefile
@@ -28,12 +28,12 @@ auths.a:	$(OBJ)
 .c.o:;		@echo "$(CC) $*.c"
 		$(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $*.c
 
 SO_FLAGS = -DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) $(INCLUDE) $(DLFLAGS)
 .c.so:;		@echo "$(CC) -shared $*.c"
-		$(FE)$(CC) $(SO_FLAGS) $(AUTH_$*_INCLUDE) $(AUTH_$*_LIBS) \
-			$*.c -o $@
+		$(FE)$(CC) $(SO_FLAGS) $(AUTH_$*_INCLUDE) $*.c $(AUTH_$*_LIBS) \
+			-o $@
 
 
 $(OBJ) $(MOD): $(HDRS)
 
 cram_md5.o:         cram_md5.c cram_md5.h
--- a/src/lookups/Makefile
+++ b/src/lookups/Makefile
@@ -24,11 +24,13 @@ lookups.a:       $(OBJ)
 .SUFFIXES:       .o .c .so
 .c.o:;           @echo "$(CC) $*.c"
 		 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $*.c
 
 .c.so:;          @echo "$(CC) -shared $*.c"
-		 $(FE)$(CC) $(LOOKUP_$*_INCLUDE) $(LOOKUP_$*_LIBS) -DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) $(INCLUDE) $(DLFLAGS) $*.c -o $@
+		 $(FE)$(CC) -DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) \
+		 	$(LOOKUP_$*_INCLUDE) $(INCLUDE) $(DLFLAGS) $*.c \
+		 	$(LOOKUP_$*_LIBS) -o $@
 
 cdb.o cdb.so:           $(HDRS) cdb.c
 dbmdb.o dbmdb.so:       $(HDRS) dbmdb.c
 dnsdb.o dnsdb.so:       $(HDRS) dnsdb.c
 dsearch.o dsearch.so:   $(HDRS) dsearch.c
--- a/src/miscmods/Makefile
+++ b/src/miscmods/Makefile
@@ -24,13 +24,13 @@ miscmods.a:	$(OBJ)
 .SUFFIXES:      .o .c .so
 .c.o:;          @echo "$(CC) $*.c"
 		$(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $*.c
 
 .c.so:;         @echo "$(CC) -shared $*.c"
-		$(FE)$(CC) $(SUPPORT_$*_INCLUDE) $(SUPPORT_$*_LIBS) \
-			-DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) $(INCLUDE) \
-			$(DLFLAGS) $*.c -o $@
+		$(FE)$(CC) -DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) \
+			$(SUPPORT_$*_INCLUDE) $(INCLUDE) $(DLFLAGS) $*.c \
+			$(SUPPORT_$*_LIBS) -o $@
 
 # Note that the sources from pdkim/ are linked into the build.../miscmods/ dir
 # by scripts/Makelinks.
 arc.o	arc.so:			$(HDRS) pdkim.h arc.c
 dkim.o  dkim.so:		$(HDRS) dkim.h dkim.c dkim_transport.c \
@@ -66,26 +66,29 @@ dkim.o:
 		dkim_tmp.o dkim_transport.o pdkim.o signing.o
 
 # Similarly, we want a single .so for the dynamic-load module
 dkim.so:
 	@echo "$(CC) -shared dkim.c dkim_transport.c pdkim.c signing.c"
-	$(FE)$(CC) -DDYNLOOKUP $(CFLAGS_DYNAMIC) -o $@ \
-		$(SUPPORT_$*_INCLUDE) $(SUPPORT_$*_LIBS) \
+	$(FE)$(CC) -DDYNLOOKUP $(CFLAGS_DYNAMIC) \
+		$(SUPPORT_$*_INCLUDE) \
 		$(CFLAGS) $(INCLUDE) $(TLS_INCLUDE) $(DLFLAGS) \
-		dkim.c dkim_transport.c pdkim.c signing.c
+		dkim.c dkim_transport.c pdkim.c signing.c \
+		$(SUPPORT_$*_LIBS) \
+		-o $@
 
 # spf_perl is special; Configure-Makefile asks for it but we actually
 # build resulting in a file named spf.so because the module-loading
 # in Exim needs the file named to match the module-name string its
 # clients search for.
 # This is sub-optimal; spf_perl.c gets recompiled every build.
 
 spf_perl.so:
 	@echo "$(CC) -shared $*.c"
-	$(FE)$(CC) $(SUPPORT_SPF_PERL_INCLUDE) $(SUPPORT_SPF_PERL_LIBS) \
+	$(FE)$(CC) $(SUPPORT_SPF_PERL_INCLUDE) \
 			-DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) $(INCLUDE) \
-			$(DLFLAGS) spf_perl.c -o spf.so
+			$(DLFLAGS) spf_perl.c $(SUPPORT_SPF_PERL_LIBS) \
+			-o spf.so
 
 # Compile instructions for static perl.o for when EXIM_PERL is set
 # Dynamic is managed all via scripts/Configure-Makefile
 
 perl.o:
--- a/src/routers/Makefile
+++ b/src/routers/Makefile
@@ -23,11 +23,12 @@ routers.a:       $(OBJ)
 .SUFFIXES:       .o .c .so
 .c.o:;           @echo "$(CC) $*.c"
 		 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $*.c
 
 .c.so:;          @echo "$(CC) -shared $*.c"
-		 $(FE)$(CC) -DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) $(INCLUDE) $(DLFLAGS) $*.c -o $@
+		 $(FE)$(CC) -DDYNLOOKUP $(CFLAGS_DYNAMIC) $(CFLAGS) $(INCLUDE) \
+			$(DLFLAGS) $*.c -o $@
 
 
 
 $(OBJ) $(MOD): $(HDRS) rf_functions.h