aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-01-12 19:02:26 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2020-01-23 14:55:57 +0530
commitafb5a3e460df2bcf2a89a21d56537314fcef5ad6 (patch)
treee7b9df66e17ca79682402fe598c7ae99de920b08
parent119a5d4771ac424d3bb3dd7230573d315b19d061 (diff)
downloadmeson-afb5a3e460df2bcf2a89a21d56537314fcef5ad6.zip
meson-afb5a3e460df2bcf2a89a21d56537314fcef5ad6.tar.gz
meson-afb5a3e460df2bcf2a89a21d56537314fcef5ad6.tar.bz2
vs: Write checksums in PE binaries (DLLs and EXEs)
This is needed for detecting data corruption, and its absence (or an incorrect value) is also used as a hint by anti-viruses that the binary may be malware. Flag is only supported by MSVC `link.exe`, not `lld-link.exe` https://docs.microsoft.com/en-us/cpp/build/reference/release-set-the-checksum
-rw-r--r--mesonbuild/backend/vs2010backend.py4
-rw-r--r--mesonbuild/linkers.py3
2 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 9a84055..6d83ff9 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -1191,6 +1191,10 @@ class Vs2010Backend(backends.Backend):
targetmachine.text = 'MachineARM'
else:
raise MesonException('Unsupported Visual Studio target machine: ' + targetplatform)
+ # /nologo
+ ET.SubElement(link, 'SuppressStartupBanner').text = 'true'
+ # /release
+ ET.SubElement(link, 'SetChecksum').text = 'true'
meson_file_group = ET.SubElement(root, 'ItemGroup')
ET.SubElement(meson_file_group, 'None', Include=os.path.join(proj_to_src_dir, build_filename))
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index a60248b..0a5c57e 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -845,6 +845,9 @@ class MSVCDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
super().__init__(exelist or ['link.exe'], for_machine, 'link',
prefix, always_args, machine=machine, version=version, direct=direct)
+ def get_always_args(self) -> T.List[str]:
+ return self._apply_prefix(['/nologo', '/release']) + super().get_always_args()
+
class ClangClDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):