Closed Bug 665710 Opened 13 years ago Closed 13 years ago

Invalid compiler directives OPT:REF and OPT:ICF passed to MSVC

Categories

(Core :: js-ctypes, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 586113

People

(Reporter: mark, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: 

I noticed in my build log the following output:

cl -MD -nologo -W3 -DHAVE_CONFIG_H -I. -I/c/mozdev/pm50/mozilla-release/js/src/ctypes/libffi -I. -I/c/mozdev/pm50/mozilla-release/js/src/ctypes/libffi/include -Iinclude -I/c/mozdev/pm50/mozilla-release/js/src/ctypes/libffi/src -Zi -DEBUG -O2 -OPT:REF -OPT:ICF -INCREMENTAL:NO -c /c/mozdev/pm50/mozilla-release/js/src/ctypes/libffi/src/debug.c -Fosrc/debug.obj -Fdsrc/debug -Fpsrc/debug -Fasrc/debug
cl : Command line warning D9002 : ignoring unknown option '-OP'
cl : Command line warning D9002 : ignoring unknown option '-OT'
cl : Command line warning D9002 : ignoring unknown option '-O:'
cl : Command line warning D9002 : ignoring unknown option '-OR'
cl : Command line warning D9002 : ignoring unknown option '-OE'
cl : Command line warning D9002 : ignoring unknown option '-OF'
cl : Command line warning D9002 : ignoring unknown option '-OP'
cl : Command line warning D9002 : ignoring unknown option '-OT'
cl : Command line warning D9002 : ignoring unknown option '-O:'
cl : Command line warning D9002 : ignoring unknown option '-OI'
cl : Command line warning D9002 : ignoring unknown option '-OC'
cl : Command line warning D9002 : ignoring unknown option '-OF'
debug.c

(and repeated for several other modules in the same neighbourhood, as far as I've seen)
the compiler directives -OPT:REF and -OPT:ICF aren't valid for MSVC's CL, and it's actually lucky that none of the characters supplied are valid flags for -O for MSVC (as it takes each character as a possible -O flag), or you might get unwanted results... (they would override earlier -O parameters).

Reproducible: Always

Steps to Reproduce:
1. Set up a windows build environment
2. make -f client.mk profiledbuild
3. Check the output
Yeah, this is libffi being dumb, or a problem with how we're invoking its configure or something.
Status: UNCONFIRMED → NEW
Component: Build Config → js-ctypes
Ever confirmed: true
QA Contact: build-config → js-ctypes
The magic happens in js/src/ctypes/libffi/msvcc.sh or something, IIRC.
Ah, sorry about the misclassification there, I didn't know there was a specific js-ctypes component this should be listed under ;)

Dan, I think you might be right. Probably a script using the wrong set of compiler directives for the specific compiler used.

I also think that -DEBUG and -INCREMENTAL:NO probably don't belong there.
(In reply to comment #3)
> Ah, sorry about the misclassification there, I didn't know there was a
> specific js-ctypes component this should be listed under ;)

No worries.  I only moved it here because libffi's build system is radically different from the rest of the tree.
They do. I forget the exact reason but the flags in that file were carefully crafted and tested. I think those flags were broken out from one of the other options; maybe it was that -DEBUG implies incremental linking but we wanted to override that. Or something.

Is the issue that those opt flags should be passed to the linker instead? You could probably coax msvcc.sh into calling up the linker separately.
Yeah, that seems to be the problem. I meant that those options shouldn't have been passed to CL.
Sometimes, linker flags are passed to the compiler. It might actually be that the compiler is called while the linker should be called instead? That can't be right :P

I did a quick search and found a similar problem in nsprpub config, where CL is erroneously called too:

make[5]: Entering directory `/c/mozdev/pm50/mozilla-release/build-optimized/nsprpub/config'
cl -Fonow.obj -c      -W3 -nologo -GF -Gy -MD -O2 -Zi   -UDEBUG -U_DEBUG -UWINNT  -DMOZILLA_CLIENT=1 -DNDEBUG=1 -DXP_PC=1 -DWIN32=1 -D_CRT_SECURE_NO_DEPRECATE=1 -D_CRT_NONSTDC_NO_DEPRECATE=1 -DWIN95=1 -D_PR_GLOBAL_THREADS_ONLY=1 -D_X86_=1  -DFORCE_PR_LOG   -GL "/c/mozdev/pm50/mozilla-release/nsprpub/config/now.c"
now.c
>>> cl  now.obj -DEBUG -OPT:REF -LTCG:PGINSTRUMENT  -Fenow.exe <<<
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9002 : ignoring unknown option '-OP'
cl : Command line warning D9002 : ignoring unknown option '-OT'
cl : Command line warning D9002 : ignoring unknown option '-O:'
cl : Command line warning D9002 : ignoring unknown option '-OR'
cl : Command line warning D9002 : ignoring unknown option '-OE'
cl : Command line warning D9002 : ignoring unknown option '-OF'
cl : Command line warning D9002 : ignoring unknown option '-LTCG:PGINSTRUMENT'
Yeah. The GNU autotools don't really handle MSVC well, so I don't think they allow for a separate compiler and linker out of the box. (I think cl and link used to be invokable solely from cl?)

You may be able to detect that it wants link mode (by a flag it passes, perhaps?) and call up the linker instead, much like we call up MASM in that script.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.