https://bugs.gentoo.org/show_bug.cgi?id=352265 Make sure LDFLAGS comes first, such that all libraries are considered, and not discarded when --as-needed is in effect. https://bugs.gentoo.org/show_bug.cgi?id=391279 Use LDFLAGS for all targets, not just the exim binary, such that --as-needed works as well. --- OS/Makefile-Base +++ OS/Makefile-Base @@ -327,12 +327,12 @@ $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) version.c rm -f exim @echo "$(LNCC) -o exim" - $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \ + $(FE)$(PURIFY) $(LNCC) -o exim $(LDFLAGS) $(OBJ_EXIM) version.o \ routers/routers.a transports/transports.a lookups/lookups.a \ auths/auths.a pdkim/pdkim.a \ $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \ $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \ - $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LDFLAGS) + $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LFLAGS) @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ echo $(STRIP_COMMAND) exim; \ $(STRIP_COMMAND) exim; \ @@ -340,8 +340,8 @@ exim_dumpdb: $(OBJ_DUMPDB) @echo "$(LNCC) -o exim_dumpdb" - $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \ - $(LIBS) $(EXTRALIBS) $(DBMLIB) + $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LDFLAGS) $(OBJ_DUMPDB) \ + $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS) @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ echo $(STRIP_COMMAND) exim_dumpdb; \ $(STRIP_COMMAND) exim_dumpdb; \ @@ -355,8 +355,8 @@ exim_fixdb: $(OBJ_FIXDB) auths/auths.a @echo "$(LNCC) -o exim_fixdb" - $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \ - auths/auths.a $(LIBS) $(EXTRALIBS) $(DBMLIB) + $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LDFLAGS) $(OBJ_FIXDB) \ + auths/auths.a $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS) @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ echo $(STRIP_COMMAND) exim_fixdb; \ $(STRIP_COMMAND) exim_fixdb; \ @@ -370,8 +370,8 @@ exim_tidydb: $(OBJ_TIDYDB) @echo "$(LNCC) -o exim_tidydb" - $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \ - $(LIBS) $(EXTRALIBS) $(DBMLIB) + $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LDFLAGS) $(OBJ_TIDYDB) \ + $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS) @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ echo $(STRIP_COMMAND) exim_tidydb; \ $(STRIP_COMMAND) exim_tidydb; \ @@ -383,8 +383,8 @@ exim_dbmbuild: exim_dbmbuild.o @echo "$(LNCC) -o exim_dbmbuild" - $(FE)$(LNCC) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \ - $(LIBS) $(EXTRALIBS) $(DBMLIB) + $(FE)$(LNCC) -o exim_dbmbuild $(LDFLAGS) exim_dbmbuild.o \ + $(LIBS) $(EXTRALIBS) $(DBMLIB) $(LFLAGS) @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ echo $(STRIP_COMMAND) exim_dbmbuild; \ $(STRIP_COMMAND) exim_dbmbuild; \ @@ -398,8 +398,8 @@ @echo "$(CC) exim_lock.c" $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c @echo "$(LNCC) -o exim_lock" - $(FE)$(LNCC) -o exim_lock $(LFLAGS) exim_lock.o \ - $(LIBS) $(EXTRALIBS) + $(FE)$(LNCC) -o exim_lock $(LDFLAGS) exim_lock.o \ + $(LIBS) $(EXTRALIBS) $(LFLAGS) @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ echo $(STRIP_COMMAND) exim_lock; \ $(STRIP_COMMAND) exim_lock; \ @@ -429,9 +429,9 @@ $(FE)$(CC) -o em_version.o -c \ $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c @echo "$(LNCC) -o eximon.bin" - $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \ + $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LDFLAGS) $(XLFLAGS) \ $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 $(PCRE_LIBS) \ - $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc + $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc $(LFLAGS) @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ echo $(STRIP_COMMAND) eximon.bin; \ $(STRIP_COMMAND) eximon.bin; \ @@ -706,9 +706,9 @@ test_dbfn: config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \ string.o tod.o version.o $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c - $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \ + $(LNCC) -o test_dbfn $(LDFLAGS) dbfn.o \ dummies.o sa-globals.o sa-os.o store.o string.o \ - tod.o version.o $(LIBS) $(DBMLIB) + tod.o version.o $(LIBS) $(DBMLIB) $(LFLAGS) rm -f dbfn.o test_host: config.h child.c host.c dns.c dummies.c sa-globals.o os.o \ @@ -717,28 +717,28 @@ $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c - $(LNCC) -o test_host $(LFLAGS) \ + $(LNCC) -o test_host $(LDFLAGS) \ host.o child.o dns.o dummies.o sa-globals.o os.o store.o string.o \ - tod.o tree.o $(LIBS) $(LIBRESOLV) + tod.o tree.o $(LIBS) $(LIBRESOLV) $(LFLAGS) rm -f child.o dummies.o host.o dns.o test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c - $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \ - sa-globals.o store.o string.o tod.o $(LIBS) + $(LNCC) -o test_os $(LDFLAGS) os.o dummies.o \ + sa-globals.o store.o string.o tod.o $(LIBS) $(LFLAGS) rm -f os.o test_parse: config.h parse.c dummies.o sa-globals.o \ store.o string.o tod.o version.o $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c - $(LNCC) -o test_parse $(LFLAGS) parse.o \ - dummies.o sa-globals.o store.o string.o tod.o version.o + $(LNCC) -o test_parse $(LDFLAGS) parse.o \ + dummies.o sa-globals.o store.o string.o tod.o version.o $(LFLAGS) rm -f parse.o test_string: config.h string.c dummies.o sa-globals.o store.o tod.o $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c - $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \ - dummies.o sa-globals.o store.o tod.o $(LIBS) + $(LNCC) -o test_string $(LDFLAGS) -DSTAND_ALONE string.o \ + dummies.o sa-globals.o store.o tod.o $(LIBS) $(LFLAGS) rm -f string.o # End