{"thread":{"id":"22032","subject":"[PATCH] Don't pass CFLAGS to the linker","startedAt":"2009-12-27T06:55:18Z","lastAt":"2010-01-09T10:32:07Z","messageCount":2,"participants":["Tomas Carnecky","Paolo Bonzini"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"130359","messageId":"1261896918-1953-1-git-send-email-tom@dbservice.com","threadId":"22032","inReplyTo":null,"subject":"[PATCH] Don't pass CFLAGS to the linker","fromName":"Tomas Carnecky","fromEmail":"tom@dbservice.com","sentAt":"2009-12-27T06:55:18Z","receivedAt":"2009-12-27T06:55:18Z","isPatch":true,"sender":{"key":"tom@dbservice.com","avatar":"https://gravatar.com/avatar/900a300bdd1a8bbe086008ad78210bbee2ad2803b7d50a5cba04c1e9404bd6d2?d=mp&s=160"},"body":"Signed-off-by: Tomas Carnecky <tom@dbservice.com>\n---\n\nI don't remember exactly which tool had problems with CFLAGS being passed\nto the linker. Maybe it was the clang static analyzer, or some other\ntool that I let run on git.git. Anyway, I don't think there's any\nreason to pass CFLAGS to the linker.\n\n Makefile |   15 +++++++--------\n 1 files changed, 7 insertions(+), 8 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex c11719c..d9cd189 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1473,8 +1473,7 @@ git.o: git.c common-cmds.h GIT-CFLAGS\n \t\t$(ALL_CFLAGS) -o $@ -c $(filter %.c,$^)\n \n git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)\n-\t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \\\n-\t\t$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)\n+\t$(QUIET_LINK)$(CC) -o $@ git.o $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)\n \n builtin-help.o: builtin-help.c common-cmds.h GIT-CFLAGS\n \t$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \\\n@@ -1660,10 +1659,10 @@ http-walker.o: http-walker.c http.h GIT-CFLAGS\n endif\n \n git-%$X: %.o $(GITLIBS)\n-\t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n+\t$(QUIET_LINK)$(CC) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n \n git-imap-send$X: imap-send.o $(GITLIBS)\n-\t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n+\t$(QUIET_LINK)$(CC) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)\n \n http.o http-walker.o http-push.o: http.h\n@@ -1671,14 +1670,14 @@ http.o http-walker.o http-push.o: http.h\n http.o http-walker.o: $(LIB_H)\n \n git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)\n-\t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n+\t$(QUIET_LINK)$(CC) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(CURL_LIBCURL)\n git-http-push$X: revision.o http.o http-push.o $(GITLIBS)\n-\t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n+\t$(QUIET_LINK)$(CC) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n \n git-remote-curl$X: remote-curl.o http.o http-walker.o $(GITLIBS)\n-\t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n+\t$(QUIET_LINK)$(CC) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n \t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n \n $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)\n@@ -1798,7 +1797,7 @@ test-parse-options.o: parse-options.h\n .PRECIOUS: $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))\n \n test-%$X: test-%.o $(GITLIBS)\n-\t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n+\t$(QUIET_LINK)$(CC) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n \n check-sha1:: test-sha1$X\n \t./test-sha1.sh\n-- \n1.6.6\n"},{"id":"131178","messageId":"4B485B27.2020404@gnu.org","threadId":"22032","inReplyTo":"1261896918-1953-1-git-send-email-tom@dbservice.com","subject":"Re: [PATCH] Don't pass CFLAGS to the linker","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2010-01-09T10:32:07Z","receivedAt":"2010-01-09T10:32:07Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"On 12/27/2009 07:55 AM, Tomas Carnecky wrote:\n> Signed-off-by: Tomas Carnecky<tom@dbservice.com>\n> ---\n>\n> I don't remember exactly which tool had problems with CFLAGS being passed\n> to the linker. Maybe it was the clang static analyzer, or some other\n> tool that I let run on git.git. Anyway, I don't think there's any\n> reason to pass CFLAGS to the linker.\n\nOne reason is if you want to use GCC's upcoming link-time optimization \n(-flto).\n\nPaolo\n"}]}