{"thread":{"id":"38083","subject":"[PATCH] Fix build with LDFLAGS=\"-Wl,--as-needed\"","startedAt":"2014-12-01T09:33:29Z","lastAt":"2014-12-01T15:58:53Z","messageCount":2,"participants":["Lars Wendler","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"252771","messageId":"1417426409-7328-1-git-send-email-polynomial-c@gentoo.org","threadId":"38083","inReplyTo":null,"subject":"[PATCH] Fix build with LDFLAGS=\"-Wl,--as-needed\"","fromName":"Lars Wendler","fromEmail":"polynomial-c@gentoo.org","sentAt":"2014-12-01T09:33:29Z","receivedAt":"2014-12-01T09:33:29Z","isPatch":true,"sender":{"key":"polynomial-c@gentoo.org","avatar":null},"body":"Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>\n---\n contrib/svn-fe/Makefile | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile\nindex e8651aa..b90cf87 100644\n--- a/contrib/svn-fe/Makefile\n+++ b/contrib/svn-fe/Makefile\n@@ -74,7 +74,7 @@ endif\n endif\n \n svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(XDIFF_LIB) $(GIT_LIB)\n-\t$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(EXTLIBS) -o $@ svn-fe.o $(LIBS)\n+\t$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ svn-fe.o $(LIBS) $(EXTLIBS)\n \n svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h\n \t$(QUIET_CC)$(CC) $(CFLAGS) -I../../vcs-svn -o $*.o -c $<\n-- \n2.2.0\n"},{"id":"252783","messageId":"xmqqsigzqs3m.fsf@gitster.dls.corp.google.com","threadId":"38083","inReplyTo":"1417426409-7328-1-git-send-email-polynomial-c@gentoo.org","subject":"Re: [PATCH] Fix build with LDFLAGS=\"-Wl,--as-needed\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-01T15:58:53Z","receivedAt":"2014-12-01T15:58:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lars Wendler <polynomial-c@gentoo.org> writes:\n\n> Subject: Re: [PATCH] Fix build with LDFLAGS=\"-Wl,--as-needed\"\n\nPlease identify what area you are touching, e.g.\n\n\tSubject: contrib/svn-fe: avoid early $(EXTLIBS) on linker invocation\n\nor whatever.\n\n\"Fix build\" does not tell us why this change is needed; it does not\nsay what breaks, how and most importantly why it breaks.  Please\nhave explanation in the commit message body, e.g.\n\n\tWhen attempting to build svn-fe with LDFLAGS=-Wl,--as-needed,\n\tI noticed that ... breaks in such and such way.  This is\n\tbecause you must not have X before Y due to Z.\n\n        Fix this by doing A, B and C, which makes sure X comes after\n        Y.\n\nor somesuch.\n\n> Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>\n> ---\n\n>  contrib/svn-fe/Makefile | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile\n> index e8651aa..b90cf87 100644\n> --- a/contrib/svn-fe/Makefile\n> +++ b/contrib/svn-fe/Makefile\n> @@ -74,7 +74,7 @@ endif\n>  endif\n>  \n>  svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(XDIFF_LIB) $(GIT_LIB)\n> -\t$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(EXTLIBS) -o $@ svn-fe.o $(LIBS)\n> +\t$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ svn-fe.o $(LIBS) $(EXTLIBS)\n\nI do not understand the original, which has\n\n\tEXTLIBS =\n\n\tGIT_LIB = ../../libgit.a\n\tVCSSVN_LIB = ../../vcs-svn/lib.a\n\tLIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)\n\ni.e. it shouldn't be necessary to explicitly list EXTLIBS, as it\nalready has LIBS at the end, which in turn has EXTLIBS at the end.\n\nWhich in turn means I do not understand your updated version,\neither.  If having EXTLIBS before svn-fe.o is bad (and it is---a\nlinker invocation lists *.o files that need to be linked first, and\nthen libraries to find the symbols requested by those *.o files),\nwouldn't a fix be to just drop $(EXTLIBS)?  Why is it necessary to\nlist it twice?\n"}]}