parameters: (
          self,
          config,
          gyp_to_build_path,
          expand_special,
          manifest_base_name,
          output_name,
          is_executable,
          build_dir,
      )
return_statement: return ldflags, intermediate_manifest, manifest_files
docstring: Returns the flags that need to be added to link commands, and the
          manifest files.
docstring_summary: Returns the flags that need to be added to link commands, and the
          manifest files.
docstring_tokens: Returns the flags that need to be added to link commands and the manifest files .
function: def GetLdflags(
          self,
          config,
          gyp_to_build_path,
          expand_special,
          manifest_base_name,
          output_name,
          is_executable,
          build_dir,
      ):
          """Returns the flags that need to be added to link commands, and the
          manifest files."""
          config = self._TargetConfig(config)
          ldflags = []
          ld = self._GetWrapper(
              self, self.msvs_settings[config], "VCLinkerTool", append=ldflags
          )
          self._GetDefFileAsLdflags(ldflags, gyp_to_build_path)
          ld("GenerateDebugInformation", map={"true": "/DEBUG"})
          # TODO: These 'map' values come from machineTypeOption enum,
          # and does not have an official value for ARM64 in VS2017 (yet).
          # It needs to verify the ARM64 value when machineTypeOption is updated.
          ld(
              "TargetMachine",
              map={"1": "X86", "17": "X64", "3": "ARM", "18": "ARM64"},
              prefix="/MACHINE:",
          )
          ldflags.extend(
              self._GetAdditionalLibraryDirectories(
                  "VCLinkerTool", config, gyp_to_build_path
              )
          )
          ld("DelayLoadDLLs", prefix="/DELAYLOAD:")
          ld("TreatLinkerWarningAsErrors", prefix="/WX", map={"true": "", "false": ":NO"})
          out = self.GetOutputName(config, expand_special)
          if out:
              ldflags.append("/OUT:" + out)
          pdb = self.GetPDBName(config, expand_special, output_name + ".pdb")
          if pdb:
              ldflags.append("/PDB:" + pdb)
          pgd = self.GetPGDName(config, expand_special)
          if pgd:
              ldflags.append("/PGD:" + pgd)
          map_file = self.GetMapFileName(config, expand_special)
          ld("GenerateMapFile", map={"true": "/MAP:" + map_file if map_file else "/MAP"})
          ld("MapExports", map={"true": "/MAPINFO:EXPORTS"})
          ld("AdditionalOptions", prefix="")
  
          minimum_required_version = self._Setting(
              ("VCLinkerTool", "MinimumRequiredVersion"), config, default=""
          )
          if minimum_required_version:
              minimum_required_version = "," + minimum_required_version
          ld(
              "SubSystem",
              map={
                  "1": "CONSOLE%s" % minimum_required_version,
                  "2": "WINDOWS%s" % minimum_required_version,
              },
              prefix="/SUBSYSTEM:",
          )
  
          stack_reserve_size = self._Setting(
              ("VCLinkerTool", "StackReserveSize"), config, default=""
          )
          if stack_reserve_size:
              stack_commit_size = self._Setting(
                  ("VCLinkerTool", "StackCommitSize"), config, default=""
              )
              if stack_commit_size:
                  stack_commit_size = "," + stack_commit_size
              ldflags.append(f"/STACK:{stack_reserve_size}{stack_commit_size}")
  
          ld("TerminalServerAware", map={"1": ":NO", "2": ""}, prefix="/TSAWARE")
          ld("LinkIncremental", map={"1": ":NO", "2": ""}, prefix="/INCREMENTAL")
          ld("BaseAddress", prefix="/BASE:")
          ld("FixedBaseAddress", map={"1": ":NO", "2": ""}, prefix="/FIXED")
          ld("RandomizedBaseAddress", map={"1": ":NO", "2": ""}, prefix="/DYNAMICBASE")
          ld("DataExecutionPrevention", map={"1": ":NO", "2": ""}, prefix="/NXCOMPAT")
          ld("OptimizeReferences", map={"1": "NOREF", "2": "REF"}, prefix="/OPT:")
          ld("ForceSymbolReferences", prefix="/INCLUDE:")
          ld("EnableCOMDATFolding", map={"1": "NOICF", "2": "ICF"}, prefix="/OPT:")
          ld(
              "LinkTimeCodeGeneration",
              map={"1": "", "2": ":PGINSTRUMENT", "3": ":PGOPTIMIZE", "4": ":PGUPDATE"},
              prefix="/LTCG",
          )
          ld("IgnoreDefaultLibraryNames", prefix="/NODEFAULTLIB:")
          ld("ResourceOnlyDLL", map={"true": "/NOENTRY"})
          ld("EntryPointSymbol", prefix="/ENTRY:")
          ld("Profile", map={"true": "/PROFILE"})
          ld("LargeAddressAware", map={"1": ":NO", "2": ""}, prefix="/LARGEADDRESSAWARE")
          # TODO(scottmg): This should sort of be somewhere else (not really a flag).
          ld("AdditionalDependencies", prefix="")
  
          if self.GetArch(config) == "x86":
              safeseh_default = "true"
          else:
              safeseh_default = None
          ld(
              "ImageHasSafeExceptionHandlers",
              map={"false": ":NO", "true": ""},
              prefix="/SAFESEH",
              default=safeseh_default,
          )
  
          # If the base address is not specifically controlled, DYNAMICBASE should
          # be on by default.
          if not any("DYNAMICBASE" in flag or flag == "/FIXED" for flag in ldflags):
              ldflags.append("/DYNAMICBASE")
  
          # If the NXCOMPAT flag has not been specified, default to on. Despite the
          # documentation that says this only defaults to on when the subsystem is
          # Vista or greater (which applies to the linker), the IDE defaults it on
          # unless it's explicitly off.
          if not any("NXCOMPAT" in flag for flag in ldflags):
              ldflags.append("/NXCOMPAT")
  
          have_def_file = any(flag.startswith("/DEF:") for flag in ldflags)
          (
              manifest_flags,
              intermediate_manifest,
              manifest_files,
          ) = self._GetLdManifestFlags(
              config,
              manifest_base_name,
              gyp_to_build_path,
              is_executable and not have_def_file,
              build_dir,
          )
          ldflags.extend(manifest_flags)
          return ldflags, intermediate_manifest, manifest_files
function_tokens: def GetLdflags ( self , config , gyp_to_build_path , expand_special , manifest_base_name , output_name , is_executable , build_dir , ) : config = self . _TargetConfig ( config ) ldflags = [ ] ld = self . _GetWrapper ( self , self . msvs_settings [ config ] , "VCLinkerTool" , append = ldflags ) self . _GetDefFileAsLdflags ( ldflags , gyp_to_build_path ) ld ( "GenerateDebugInformation" , map = { "true" : "/DEBUG" } ) # TODO: These 'map' values come from machineTypeOption enum, # and does not have an official value for ARM64 in VS2017 (yet). # It needs to verify the ARM64 value when machineTypeOption is updated. ld ( "TargetMachine" , map = { "1" : "X86" , "17" : "X64" , "3" : "ARM" , "18" : "ARM64" } , prefix = "/MACHINE:" , ) ldflags . extend ( self . _GetAdditionalLibraryDirectories ( "VCLinkerTool" , config , gyp_to_build_path ) ) ld ( "DelayLoadDLLs" , prefix = "/DELAYLOAD:" ) ld ( "TreatLinkerWarningAsErrors" , prefix = "/WX" , map = { "true" : "" , "false" : ":NO" } ) out = self . GetOutputName ( config , expand_special ) if out : ldflags . append ( "/OUT:" + out ) pdb = self . GetPDBName ( config , expand_special , output_name + ".pdb" ) if pdb : ldflags . append ( "/PDB:" + pdb ) pgd = self . GetPGDName ( config , expand_special ) if pgd : ldflags . append ( "/PGD:" + pgd ) map_file = self . GetMapFileName ( config , expand_special ) ld ( "GenerateMapFile" , map = { "true" : "/MAP:" + map_file if map_file else "/MAP" } ) ld ( "MapExports" , map = { "true" : "/MAPINFO:EXPORTS" } ) ld ( "AdditionalOptions" , prefix = "" ) minimum_required_version = self . _Setting ( ( "VCLinkerTool" , "MinimumRequiredVersion" ) , config , default = "" ) if minimum_required_version : minimum_required_version = "," + minimum_required_version ld ( "SubSystem" , map = { "1" : "CONSOLE%s" % minimum_required_version , "2" : "WINDOWS%s" % minimum_required_version , } , prefix = "/SUBSYSTEM:" , ) stack_reserve_size = self . _Setting ( ( "VCLinkerTool" , "StackReserveSize" ) , config , default = "" ) if stack_reserve_size : stack_commit_size = self . _Setting ( ( "VCLinkerTool" , "StackCommitSize" ) , config , default = "" ) if stack_commit_size : stack_commit_size = "," + stack_commit_size ldflags . append ( f"/STACK:{stack_reserve_size}{stack_commit_size}" ) ld ( "TerminalServerAware" , map = { "1" : ":NO" , "2" : "" } , prefix = "/TSAWARE" ) ld ( "LinkIncremental" , map = { "1" : ":NO" , "2" : "" } , prefix = "/INCREMENTAL" ) ld ( "BaseAddress" , prefix = "/BASE:" ) ld ( "FixedBaseAddress" , map = { "1" : ":NO" , "2" : "" } , prefix = "/FIXED" ) ld ( "RandomizedBaseAddress" , map = { "1" : ":NO" , "2" : "" } , prefix = "/DYNAMICBASE" ) ld ( "DataExecutionPrevention" , map = { "1" : ":NO" , "2" : "" } , prefix = "/NXCOMPAT" ) ld ( "OptimizeReferences" , map = { "1" : "NOREF" , "2" : "REF" } , prefix = "/OPT:" ) ld ( "ForceSymbolReferences" , prefix = "/INCLUDE:" ) ld ( "EnableCOMDATFolding" , map = { "1" : "NOICF" , "2" : "ICF" } , prefix = "/OPT:" ) ld ( "LinkTimeCodeGeneration" , map = { "1" : "" , "2" : ":PGINSTRUMENT" , "3" : ":PGOPTIMIZE" , "4" : ":PGUPDATE" } , prefix = "/LTCG" , ) ld ( "IgnoreDefaultLibraryNames" , prefix = "/NODEFAULTLIB:" ) ld ( "ResourceOnlyDLL" , map = { "true" : "/NOENTRY" } ) ld ( "EntryPointSymbol" , prefix = "/ENTRY:" ) ld ( "Profile" , map = { "true" : "/PROFILE" } ) ld ( "LargeAddressAware" , map = { "1" : ":NO" , "2" : "" } , prefix = "/LARGEADDRESSAWARE" ) # TODO(scottmg): This should sort of be somewhere else (not really a flag). ld ( "AdditionalDependencies" , prefix = "" ) if self . GetArch ( config ) == "x86" : safeseh_default = "true" else : safeseh_default = None ld ( "ImageHasSafeExceptionHandlers" , map = { "false" : ":NO" , "true" : "" } , prefix = "/SAFESEH" , default = safeseh_default , ) # If the base address is not specifically controlled, DYNAMICBASE should # be on by default. if not any ( "DYNAMICBASE" in flag or flag == "/FIXED" for flag in ldflags ) : ldflags . append ( "/DYNAMICBASE" ) # If the NXCOMPAT flag has not been specified, default to on. Despite the # documentation that says this only defaults to on when the subsystem is # Vista or greater (which applies to the linker), the IDE defaults it on # unless it's explicitly off. if not any ( "NXCOMPAT" in flag for flag in ldflags ) : ldflags . append ( "/NXCOMPAT" ) have_def_file = any ( flag . startswith ( "/DEF:" ) for flag in ldflags ) ( manifest_flags , intermediate_manifest , manifest_files , ) = self . _GetLdManifestFlags ( config , manifest_base_name , gyp_to_build_path , is_executable and not have_def_file , build_dir , ) ldflags . extend ( manifest_flags ) return ldflags , intermediate_manifest , manifest_files