Uploaded image for project: 'Swift'
  1. Swift
  2. SR-6271

Unable to emit assembly from swift compiler to multiple files



    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:


      When compiling multiple Swift files (because they have inter-relationships between them, for example) it's not possible to get the assembly written out to a file. The only output possibility is to stdout.

      This command will print out the assembly of the file to stdout:

      swiftc -module-name example -emit-assembly main.swift dependency.swift

      However, if you try and get it to write to separate files, it doesn't because multiple -o files are not permitted:

      swiftc -module-name example -emit-assembly main.swift -o main.s dependency.swift -o dependency.s
      error: cannot specify -o when generating multiple output files

      Normally with clang this would be taken care of simply by passing -S (which is also the same for the swift compiler) and the output would be written to <filename>.s for each individual file. However, for -S in swiftc, it assumes that you want to write to stdout:


      What I'd like to do is be able to generate individual files, or be allowed to have a means of disabling the automatic-stdout option for the -emit phases (probably the same for ll as well). This would require either an additional option that disables this option, or have a means to allow a per-file output when multiple source files are used.


          Issue Links



              • Assignee:
                alblue Alex Blewitt
              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created: