def MakeSelUniversalScriptForLD(ld_flags,
                                llc_outputs,
                                outfile):
  """ Return sel_universal script text for invoking LD.nexe with the
  given ld_flags, and llc_outputs (which are treated specially).
  The output will be written to outfile.  """
  script = []

  # Open the output file.
  script.append('readwrite_file nexefile %s' % outfile)

  modules = len(llc_outputs)
  script.extend(['readonly_file objfile%d %s' % (i, f)
                 for i, f in zip(range(modules), llc_outputs)])
  script.append('rpc RunWithSplit i(%d) ' % modules +
                ' '.join(['h(objfile%s)' % m for m in range(modules)] +
                         ['h(invalid)' for x in range(modules, 16)]) +
                ' h(nexefile) *')
  script.append('echo "ld complete"')
  script.append('')
  return '\n'.join(script)