Page 1 of 1

How to enable Control Flow Guard compiler flag "/guard:cf"

PostPosted: Mon Sep 28, 2020 10:13 am
by Kyraath
Greetings,

How do I enable the Control Flow Guard flag "/guard:cf" when compiling CEF using the automate-git.py compiler steps described here?

I have been unable to find instructions on how to add or change the compiler flags being used in the CEF documentation, but have found the file cef_variables.cmake.in by exploring through the repository as the only file that mentions compiler flags, but modifying this file to add "/guard:cf" does not result in the option being enabled. I see that Clang does support the Control Flow Guard option, so there should be some way to enable it. Also, when I search these forums for "guard:cf", there are some console captures that mention the flag, but I cannot find a way to enable it.

Thank you for the help!

Re: How to enable Control Flow Guard compiler flag "/guard:c

PostPosted: Mon Sep 28, 2020 12:25 pm
by magreenblatt
There appears to be a win_enable_cfg_guards GN argument for Windows. I do not know if it will compile/run successfully with CEF.

Re: How to enable Control Flow Guard compiler flag "/guard:c

PostPosted: Mon Sep 28, 2020 1:35 pm
by Kyraath
Interesting... I don't have that file in my local branch, probably because I'm trying to build 84.0.4147.105 (which also doesn't have this file) to align with CefSharp's latest release.

Re: How to enable Control Flow Guard compiler flag "/guard:c

PostPosted: Mon Sep 28, 2020 1:41 pm
by magreenblatt
Yes, it appears to only be available in M86 and newer.

Re: How to enable Control Flow Guard compiler flag "/guard:c

PostPosted: Mon Sep 28, 2020 2:02 pm
by Kyraath
Ok, just to verify, because this file is not there in 84, the compiler flag is only available in 86 or newer?

Thank you very much for helping track this down!

Re: How to enable Control Flow Guard compiler flag "/guard:c

PostPosted: Mon Sep 28, 2020 2:31 pm
by magreenblatt
Kyraath wrote:Ok, just to verify, because this file is not there in 84, the compiler flag is only available in 86 or newer?

Correct.