git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/4] Makefile: Don't pass $(ALL_CFLAGS) to the linker

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jun 26, 2010, 18:19 UTC
Message-ID
<20100626181945.GA13070@burratino>
In-Reply-To
<4C264019.6030408@ramsay1.demon.co.uk>
Ramsay Jones wrote:
Show 11 quoted lines
> I thought that the general scheme was something like:
> 
>     - LDFLAGS is for options which only affects the operation of
>       the linker (e.g. -L).
>     - CPPFLAGS is for options which only affects the operation of
>       the C pre-processor (e.g. -I, -D, -U)
>     - CFLAGS is for options which only affects the operation of
>       the compiler proper.
>
> If an option affects multiple phases, then (one option) is to include
> it into each of the above macros to which it applies.

That does make sense. Perhaps “traditionally” was not the right word; I was just looking at common practice. I’ve just never seen -O put into LDFLAGS, for example, and I think most people would expect setting CFLAGS=-O0 to affect the linker, too.

> Jonathan Nieder wrote:
>> I realize that the Makefile does not currently use the terms this way:
>> making it consistent would require
>> 
>>  . s/BASIC_CFLAGS/BASIC_CPPFLAGS/, except that the
[etc]
Show 5 quoted lines
>> 
>> What do you think?
>
> I think I am missing something, since I don't see how this relates to
> my patch!
I suspect the problem comes from my unfamiliarity with MSVC.

By analogy with GCC, I assumed that any parameter is intended for the preprocessor, the linker, or the frontend/both. In other words, I was assuming flags for the compiler proper can be safely passed to the linker, and that /Zi must be for the preprocessor-using stages only. CFLAGS tends to contain front-end arguments used for all stages of translation.

What does /Zi do?  Searching online reveals:
 - it means “enable debugging information”
 - weakly implies /debug for the linker
 - overrides /Z7 and /Zd, and is overridden by them
 - is incompatible with /MP
 - is among the prerequisites for /dlp and for /Gm

Maybe clink.pl should use “cl.exe /link” instead of “link.exe” and this problem would go away.

Previous: Ramsay JonesNext: Ramsay Jones
Message 4 of 12 in “Makefile: Don't pass $(ALL_CFLAGS) to the linker”
  1. 4/4 Makefile: Don't pass $(ALL_CFLAGS) to the linkerRamsay Jones, Jun 23, 2010
  2. Jonathan NiederJun 23, 2010
  3. Ramsay JonesJun 26, 2010
  4. Jonathan NiederJun 26, 2010
  5. Ramsay JonesJun 30, 2010
  6. Andreas SchwabJun 30, 2010
  7. Bernhard R. LinkJun 27, 2010
  8. Peter HarrisJun 24, 2010
  9. Ramsay JonesJun 25, 2010
  10. Peter HarrisJun 27, 2010
  11. Ramsay JonesJun 30, 2010
  12. Peter HarrisJul 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.