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 @@ -346,12 +346,12 @@ buildrouters buildtransports \ $(OBJ_EXIM) version.o @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; \ @@ -367,8 +367,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; \ @@ -382,8 +382,8 @@ exim_fixdb: $(OBJ_FIXDB) buildauths @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; \ @@ -397,8 +397,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; \ @@ -410,8 +410,8 @@ exim_dbmbuild: exim_dbmbuild.o @echo "$(LNCC) -o exim_dbmbuild" - $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \ - $(LIBS) $(EXTRALIBS) $(DBMLIB) + $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -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; \ @@ -425,8 +425,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; \ @@ -462,9 +462,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; \ @@ -780,9 +780,9 @@ string.o tod.o version.o utf8.o $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY store.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 utf8.o $(LIBS) $(DBMLIB) $(LDFLAGS) + tod.o version.o utf8.o $(LIBS) $(DBMLIB) $(LFLAGS) rm -f dbfn.o store.o test_host: config.h child.c host.c dns.c dummies.c sa-globals.o os.o \ @@ -790,29 +790,29 @@ $(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 utf8.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 utf8.o $(LIBS) $(LDFLAGS) + $(LNCC) -o test_os $(LDFLAGS) os.o dummies.o \ + sa-globals.o store.o string.o tod.o utf8.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 utf8.o $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c - $(LNCC) -o test_parse $(LFLAGS) parse.o \ + $(LNCC) -o test_parse $(LDFLAGS) parse.o \ dummies.o sa-globals.o store.o string.o tod.o version.o \ - utf8.o $(LDFLAGS) + utf8.o $(LFLAGS) rm -f parse.o test_string: config.h string.c dummies.o sa-globals.o store.o tod.o utf8.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 utf8.o $(LIBS) $(LDFLAGS) + $(LNCC) -o test_string $(LDFLAGS) -DSTAND_ALONE string.o \ + dummies.o sa-globals.o store.o tod.o utf8.o $(LIBS) $(LFLAGS) rm -f string.o # End