Re: [PATCH 4/4] Makefile: Don't pass $(ALL_CFLAGS) to the linker
From: Ramsay Jones <hidden>
Date: 2016-06-15 22:49:02
Jonathan Nieder wrote:
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.
[This is now a bit off-topic, see below, but what version of gcc are
you using that passes -O to the linker (well, collect2 anyway)?
Do you have to pass -flto? For example "gcc -v -g -O2 hello.o -o hello"
seems to show (for both gcc 3.4.4 and gcc 4.4.0) that neither -g or -O2
is passed to collect2.
Hmmm, the output from gcc 4.4.0 adds a line like:
COLLECT_GCC_OPTIONS='-v' '-g' '-O2' '-o' 'hello.exe' '-mtune=i386'
so, does this imply this is a env. var exported to collect2?
dunno ;-P ]
I suspect the problem comes from my unfamiliarity with MSVC.
Heh, I'm not an expert user of msvc either!
Maybe clink.pl should use “cl.exe /link” instead of “link.exe” and this problem would go away.
I tried this *very* quickly and it didn't work. (It's quite possible that I could spend some time and get it to work, but ...) The patch that Peter sent seems like the way to go, since it does not affect the regular (non-msvc) build - and it works! ;-) So we can drop this patch. Thanks for your time. ATB, Ramsay Jones