Hi Johannes,

Thanks for the explanation!

It sounds like /OPT:ICF is safe, even though the debugging experience might
be a bit degraded (but not totally).

Maybe check and see how much the binary sizes change. If it's only 5-10%,
it's not really worth it, but if we gain more than that by COMDAT folding
then it probably is a good thing.

I suggest defaulting to /OPT:ICF & /OPT:REF and adding a CMAKE option to
revert to the old behaviour (OSG_WINDOWS_LINK_OPTIMIZE=false, true by
default)

Incremental linking is nice to have when hacking on OpenSG, so I can see
that as a selling point for wanting it as a CMAKE flag.

Cheers,
/Marcus

2017-01-25 15:12 GMT+01:00 Johannes <jbru...@datasolid.de>:

>
> Hello Marcus and Carsten,
>
> First of, we also do need debugging symbols in release builds.
>
> Microsoft writes on
> https://msdn.microsoft.com/en-us/library/windows/desktop/
> ee416349(v=vs.85).aspx
>
> "You also need to take steps to maintain full compiler optimizations
> while generating symbols."
>
> - set Debug Information Format to Program Database (/Zi).
> - set Generate Debug Info to Yes (/DEBUG).
> - set References to Eliminate Unreferenced Data (/OPT:REF).
> - set Enable COMDAT Folding to Remove Redundant COMDATs (/OPT:ICF).
>
> That reference initiated my initial change of the code generation of all
> of our libraries and executables since we have started to generate
> memory dumps on crash in release code.
>
> The flags are detailed on
> https://msdn.microsoft.com/en-us/library/bxwfs976(v=vs.120).aspx
>
> /OPT:REF eliminates functions and data that are never referenced;
> /OPT:ICF to perform identical COMDAT folding. Redundant COMDATs can be
> removed from the linker output.
>
> Usage of /OPT:REF implicitly sets /OPT:ICF.
> Usage of /Zi /DEBUG implicitly sets /OPT:NOREF
>
> /OPT:ICF is controversial. Microsoft recommends to use OPT:NOICF to
> preserve identical functions in debugging builds.
>
> "If /DEBUG is specified, the default for /OPT is NOREF, and all
> functions are preserved in the image. To override this default and
> optimize a debugging build, specify /OPT:REF. Because /OPT:REF implies
> /OPT:ICF, we recommend that you also specify /OPT:NOICF to preserve
> identical functions in debugging builds. This makes it easier to read
> stack traces and set breakpoints in functions that would otherwise be
> folded together. The /OPT:REF option disables incremental linking."
>
> On 25.01.2017 11:05, Marcus Lindblom Sonestedt wrote:
> > We need debugging symbols in release builds.
> >
> > If OPT:REF / OPT:ICF doesn't conflict with /Zi and pdb-generation, I
> > have no objections.
> >
> I'm not quite sure on that. Probably the /OPT:REF /OPT:NOICF is the
> better combination.
>
> Finally, I think that best we should create some cmake options for that,
> so that nobody is negatively affected. Then we can experiment a little
> with these settings and see what is best.
>
> What do you think,
>
> Best,
> Johannes
>
>
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Opensg-users mailing list
> Opensg-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>



-- 
Med vänliga hälsningar,
Marcus Lindblom Sonestedt
*Systemarkitekt*
*BIT ADDICT *- Passion för utveckling
+46 (0)706 43 63 28
marcus.lindblom.sonest...@bitaddict.se
www.bitaddict.se
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to