parameters: (self, argv)
docstring: Runs the linker using the passed clang/gcc style argument list.
  
      Args:
        argv: List of arguments
  
      Returns:
        The return code of the link.
  
      Raises:
        ValueError: if target architecture or compile mode isn't specified
docstring_summary: Runs the linker using the passed clang/gcc style argument list.
docstring_tokens: Runs the linker using the passed clang / gcc style argument list .
function: def Run(self, argv):
      """Runs the linker using the passed clang/gcc style argument list.
  
      Args:
        argv: List of arguments
  
      Returns:
        The return code of the link.
  
      Raises:
        ValueError: if target architecture or compile mode isn't specified
      """
      # For now assume we are building a library.
      tool = 'lib'
      default_args = ['/nologo']
  
      # Build argument list.
      parser = msvc_tools.ArgParser(self, argv, LINKPATTERNS)
  
      # Find the output file name.
      name = ''
      for arg in parser.options:
        if '/OUT:' in arg:
          name = arg[5:]
      if not name:
        raise msvc_tools.Error('No output file name specified!')
      # Check if the library is empty, which is what happens when we create header
      # or intermediate link-only libraries.
      if (len(parser.options) == 2 and parser.options[0].startswith('/OUT') and
          parser.options[1].startswith('/M')):
        # Just "touch" the library to create the file.
        with open(name, 'w'):
          os.utime(name, None)
      else:
        # If the output name ends in .lo, or .a, it is a library, otherwise
        # we need to use link to create an executable.
        if os.path.splitext(name)[1] not in ['.a', '.lo']:
          tool = 'link'
  
          if not parser.target_arch:
            raise ValueError('Must specify target architecture (-m32 or -m64)')
  
          # Append explicit machine type.
          if parser.target_arch == 'x64':
            default_args.append('/MACHINE:X64')
          else:
            default_args.append('/MACHINE:X86')
  
          # Args for buildng a console application. These must appear here since
          # blaze will not properly pass them to the linker.
          # /SUBSYSTEM:CONSOLE: Build a console application.
          default_args += ['/SUBSYSTEM:CONSOLE']
          # If there is no .o on the command line, then we need to add the
          # run-time library for the target. Without this the linker gives a
          # LNK4001 error and cannot find an entry point.
          for arg in parser.options:
            if arg.endswith('.o'):
              break
          else:
            if not parser.compilation_mode:
              raise ValueError('Must specify compilation mode '
                               '(-Xcompilation-mode={dbg,fastbuild,opt})')
  
            if parser.compilation_mode == 'dbg':
              default_args.insert(0, 'libcmtd.lib')
            else:
              default_args.insert(0, 'libcmt.lib')
  
        return self.RunBinary(tool, default_args + parser.options,
                              parser.target_arch, parser)
function_tokens: def Run ( self , argv ) : # For now assume we are building a library. tool = 'lib' default_args = [ '/nologo' ] # Build argument list. parser = msvc_tools . ArgParser ( self , argv , LINKPATTERNS ) # Find the output file name. name = '' for arg in parser . options : if '/OUT:' in arg : name = arg [ 5 : ] if not name : raise msvc_tools . Error ( 'No output file name specified!' ) # Check if the library is empty, which is what happens when we create header # or intermediate link-only libraries. if ( len ( parser . options ) == 2 and parser . options [ 0 ] . startswith ( '/OUT' ) and parser . options [ 1 ] . startswith ( '/M' ) ) : # Just "touch" the library to create the file. with open ( name , 'w' ) : os . utime ( name , None ) else : # If the output name ends in .lo, or .a, it is a library, otherwise # we need to use link to create an executable. if os . path . splitext ( name ) [ 1 ] not in [ '.a' , '.lo' ] : tool = 'link' if not parser . target_arch : raise ValueError ( 'Must specify target architecture (-m32 or -m64)' ) # Append explicit machine type. if parser . target_arch == 'x64' : default_args . append ( '/MACHINE:X64' ) else : default_args . append ( '/MACHINE:X86' ) # Args for buildng a console application. These must appear here since # blaze will not properly pass them to the linker. # /SUBSYSTEM:CONSOLE: Build a console application. default_args += [ '/SUBSYSTEM:CONSOLE' ] # If there is no .o on the command line, then we need to add the # run-time library for the target. Without this the linker gives a # LNK4001 error and cannot find an entry point. for arg in parser . options : if arg . endswith ( '.o' ) : break else : if not parser . compilation_mode : raise ValueError ( 'Must specify compilation mode ' '(-Xcompilation-mode={dbg,fastbuild,opt})' ) if parser . compilation_mode == 'dbg' : default_args . insert ( 0 , 'libcmtd.lib' ) else : default_args . insert ( 0 , 'libcmt.lib' ) return self . RunBinary ( tool , default_args + parser . options , parser . target_arch , parser )