Possible MSDN doc err: Link-time code generation and precompiled headers

Can MS employees here confirm whether the modern (CL >= 14) compilers are fine combining “link-time code generation” aka “whole program optimization” (LTCG or /GL) with precompiled headers?

MSDN page says that this combination is not safe in some scenarios, since the PCH file is a must for link phase of LTCG, thus LTCG cannot be used for LIBs shared across machines.

Nevertheless, the practical attempt (linking a LIB with all its source, PCH and OBJ files deleted and full path to the build dir renamed to break the possible embedded full pathnames in the LIB) says it works with WDK 6001.18002, which uses LTCG for x64 builds.

Also, the MS’s person on Answers said that these features should not and do not have interops.

Is the MSDN page obsolete?


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

I don’t understand the question. You can use PCH and LTCG. The fragility of LTCG is that it embeds cl version specific information into the lib, IOW you can’t take an ltcg lib from cl v.Foo and use it with v.Foo+1, you need to strip out the ltcg’ness first (link /cvtcil)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Thursday, May 29, 2014 7:37 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Possible MSDN doc err: Link-time code generation and precompiled headers

Can MS employees here confirm whether the modern (CL >= 14) compilers are fine combining “link-time code generation” aka “whole program optimization” (LTCG or /GL) with precompiled headers?

MSDN page says that this combination is not safe in some scenarios, since the PCH file is a must for link phase of LTCG, thus LTCG cannot be used for LIBs shared across machines.

Nevertheless, the practical attempt (linking a LIB with all its source, PCH and OBJ files deleted and full path to the build dir renamed to break the possible embedded full pathnames in the LIB) says it works with WDK 6001.18002, which uses LTCG for x64 builds.

Also, the MS’s person on Answers said that these features should not and do not have interops.

Is the MSDN page obsolete?


Maxim S. Shatskih
Microsoft MVP on File System And Storage xxxxx@storagecraft.com http://www.storagecraft.com


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thank Doron!

MSDN page on /GL option says:

“.obj files produced with /GL and precompiled header files should not be used to build a .lib file unless the .lib file will be linked on the same machine that produced the /GL .obj file. Information from the .obj file’s precompiled header file will be needed at link time.”

Is it still true for modern compilers?

“Doron Holan” wrote in message news:xxxxx@ntdev…
>I don’t understand the question. You can use PCH and LTCG. The fragility of LTCG is that it embeds cl version specific information into the lib, IOW you can’t take an ltcg lib from cl v.Foo and use it with v.Foo+1, you need to strip out the ltcg’ness first (link /cvtcil)
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
> Sent: Thursday, May 29, 2014 7:37 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Possible MSDN doc err: Link-time code generation and precompiled headers
>
> Can MS employees here confirm whether the modern (CL >= 14) compilers are fine combining “link-time code generation” aka “whole program optimization” (LTCG or /GL) with precompiled headers?
>
> MSDN page says that this combination is not safe in some scenarios, since the PCH file is a must for link phase of LTCG, thus LTCG cannot be used for LIBs shared across machines.
>
> Nevertheless, the practical attempt (linking a LIB with all its source, PCH and OBJ files deleted and full path to the build dir renamed to break the possible embedded full pathnames in the LIB) says it works with WDK 6001.18002, which uses LTCG for x64 builds.
>
> Also, the MS’s person on Answers said that these features should not and do not have interops.
>
> Is the MSDN page obsolete?
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage xxxxx@storagecraft.com http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>