nodejs / gyp-next

A fork of the GYP build system for use in the Node.js projects
BSD 3-Clause "New" or "Revised" License
130 stars 73 forks source link

feat(msvs): add SpectreMitigation attribute #190

Closed rzhao271 closed 1 year ago

rzhao271 commented 1 year ago

Backport of https://chromium-review.googlesource.com/c/external/gyp/+/4265144

Description from upstream:

Add SpectreMitigation attribute for msvs

This CL allows gyp to recognize the SpectreMitigation msvs_attribute
and add it to the generated vcxproj file for MSBuild.
Possible values for the attribute are Spectre, SpectreLoad,
SpectreLoadCF, and false.

The /Qspectre compiler option is not enough to add
full Spectre mitigation, because even though it causes MSBuild
to add additional instructions to the generated object files,
it does not cause MSBuild to link against Spectre-mitigated
libraries provided by Visual Studio.
rzhao271 commented 1 year ago

Hi @cclauss, is this PR ready to be merged?

cclauss commented 1 year ago

I am not a Windows user so a maintainer with that knowledge will need to approve. @nodejs/platform-windows

rzhao271 commented 1 year ago

Could a reviewer from platform-windows take a look? This PR is blocking node-gyp, and in turn, native node modules, from adopting Spectre Mitigation in accordance with microsoft/binskim policies.

targos commented 1 year ago

/cc @joaocgreis @StefanStojanovic