How to pass argument to VC8 linker from .mozconfig

Discussion of third-party/unofficial Firefox/Thunderbird/SeaMonkey builds.
RyanVM
Posts: 1264
Joined: June 16th, 2004, 6:00 am
Location: Exton, PA

How to pass argument to VC8 linker from .mozconfig

Post by RyanVM »

Does anybody know how to pass a flag to the VC8 linker during a compile? On my compiles, I use the /GL flag. Using /GL causes the VC8 linker to assume the /LTCG flag as well, but first it has to restart the linking process on every module. To speed the process up, the /LTCG flag can be sent to the linker in the first place so it doesn't have to start over after realizing that /GL was used with the compiler.

However, --enable-optimize only passes arguments to the compiler and not the linker, meaning the /LTCG flag is completely ignored. I've also tried mk_add_options LDFLAGS="/LTCG", but that apparently only works for unix-based linkers and not VC8.

So, that's where I'm at. Does anybody in here know how to pass the /LTCG argument to the VC8 linker via .mozconfig?

Thanks!
User avatar
auenf
Posts: 709
Joined: August 28th, 2004, 2:25 am
Contact:

Post by auenf »

RyanVM
Posts: 1264
Joined: June 16th, 2004, 6:00 am
Location: Exton, PA

Post by RyanVM »

Thanks!
RyanVM
Posts: 1264
Joined: June 16th, 2004, 6:00 am
Location: Exton, PA

Post by RyanVM »

Doesn't seem to work. If I add "/link /LTCG" to --enable-optimize, make complains about invalid optimizations. If I try creating a LINK environment variable set to /LTCG, that also doesn't work.

I'm beginning to think this is impossible :(
User avatar
mahowi
Posts: 569
Joined: September 16th, 2005, 12:37 pm
Location: Germany
Contact:

Post by mahowi »

Same problem here. It's because /LTCG should be passed to LIB.exe, not LINK.exe. And I couldn't find anything about passing options to LIB.
Firefox: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9pre) Gecko/2008052316 Firefox/3.0pre (mahowi) ID:2008052316
Thunderbird: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9pre) Gecko/2008052904 Thunderbird/3.0a2pre ID:2008052904
User avatar
mahowi
Posts: 569
Joined: September 16th, 2005, 12:37 pm
Location: Germany
Contact:

Post by mahowi »

You could change line 5449 in configure (line 1275 in configure.in) from

Code: Select all

HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
to

Code: Select all

HOST_AR_FLAGS='-NOLOGO -LTCG -OUT:"$@"'
Firefox: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9pre) Gecko/2008052316 Firefox/3.0pre (mahowi) ID:2008052316
Thunderbird: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9pre) Gecko/2008052904 Thunderbird/3.0a2pre ID:2008052904
RyanVM
Posts: 1264
Joined: June 16th, 2004, 6:00 am
Location: Exton, PA

Post by RyanVM »

Modifying configure and configure.in didn't seem to work either. For the record, I completely removed my objdir prior to starting the build.
User avatar
Sephirot
Posts: 247
Joined: June 15th, 2004, 7:56 am

Post by Sephirot »

mahowi wrote:You could change line 5449 in configure (line 1275 in configure.in) from

Code: Select all

HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
to

Code: Select all

HOST_AR_FLAGS='-NOLOGO -LTCG -OUT:"$@"'

don't forget line 1692 of configure.in (line 6164 in configure)


p.s.
LIB does not use an environment variable.

Running LIB
Author of Bookmarks Menu Button, Autoclose Bookmark&History Folders and more

Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.19pre) Gecko/20110701 Firefox/3.6.19pre <-- build with MS VC++ 2010 SP1 and PGO on Win 7 x64
RyanVM
Posts: 1264
Joined: June 16th, 2004, 6:00 am
Location: Exton, PA

Post by RyanVM »

SUCCESS!!!

Here's a diff (off the trunk) for anybody else who may want to enable LTCG by default.
http://www.ryanvm.net/files/ltcg.diff
RyanVM
Posts: 1264
Joined: June 16th, 2004, 6:00 am
Location: Exton, PA

Post by RyanVM »

One more note, you'll still want to set the LINK environment variable to -LTCG (I do it in my mozset.cmd), as there are a few instances (such as when the actual browser app is being built) when link.exe is still being called. But I have now confirmed that the diff posted above along with the environment variable completely takes care of it :)
User avatar
bangbang023
Posts: 1726
Joined: July 7th, 2003, 12:23 am
Location: Brooklyn, NY
Contact:

Post by bangbang023 »

How much time does this shave off the build process for you?
User avatar
auenf
Posts: 709
Joined: August 28th, 2004, 2:25 am
Contact:

Post by auenf »

hmm, didnt seem to shave any time of for me at all, and i do see some of the /ltcg messages too, just going to try a couple of things...

Enf...
User avatar
BlueFyre
Posts: 1985
Joined: February 11th, 2004, 4:33 pm

Post by BlueFyre »

Comparing my build logs and what not, it does not seem to shave any time on average...
It does how ever reduce the build log by 60KB almost... not sure if thats really just /LTCG though

Also I am seeing some of these warnings about /LTCG
Here's a list of files where I am seeing it

Code: Select all

host_cppsetup.obj now.obj w95dllmain.obj prvrsion.obj plvrsion.obj plarena.obj plgetopt.obj plvrsion.obj host_jskwgen.obj jsapi.obj xpt_dump.obj xpt_link.obj xpidl.obj pldhash.obj nsXPComStub.obj host_mar.obj nsZipArchive.obj jsdebug.obj AccessibleMarshal.obj updater.obj CertReader.obj InstallCleanup.obj nsStubNotifier.obj nsinstall.obj nsztool.obj ren8dot3.obj ds32.obj GetShortPathName.obj regxpcom.obj xpcshell.obj maindll.obj StdAfx.obj nsBrowserApp.obj
If you notice this notice you may notice that this notice is not worth noticing.
gorth
Posts: 1
Joined: October 15th, 2004, 3:17 pm

Post by gorth »

Hello Ryan

Can you post a link to the mozset.cmd file? Thanks.
User avatar
Sephirot
Posts: 247
Joined: June 15th, 2004, 7:56 am

Post by Sephirot »

BlueFyre wrote:Comparing my build logs and what not, it does not seem to shave any time on average...
It does how ever reduce the build log by 60KB almost... not sure if thats really just /LTCG though

Also I am seeing some of these warnings about /LTCG
Here's a list of files where I am seeing it

Code: Select all

host_cppsetup.obj now.obj w95dllmain.obj prvrsion.obj plvrsion.obj plarena.obj plgetopt.obj plvrsion.obj host_jskwgen.obj jsapi.obj xpt_dump.obj xpt_link.obj xpidl.obj pldhash.obj nsXPComStub.obj host_mar.obj nsZipArchive.obj jsdebug.obj AccessibleMarshal.obj updater.obj CertReader.obj InstallCleanup.obj nsStubNotifier.obj nsinstall.obj nsztool.obj ren8dot3.obj ds32.obj GetShortPathName.obj regxpcom.obj xpcshell.obj maindll.obj StdAfx.obj nsBrowserApp.obj

same here ...
for /mozilla/nsprpub/ configure/configure.in need to be modified too.

http://lxr.mozilla.org/mozilla1.8/sourc ... re.in#1469
http://lxr.mozilla.org/mozilla1.8/sourc ... igure#3945
Author of Bookmarks Menu Button, Autoclose Bookmark&History Folders and more

Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.19pre) Gecko/20110701 Firefox/3.6.19pre <-- build with MS VC++ 2010 SP1 and PGO on Win 7 x64
Post Reply