<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [debug info] Need to find a way to represent multiple CUs in a .s file when using .loc"
   href="http://llvm.org/bugs/show_bug.cgi?id=18716">18716</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[debug info] Need to find a way to represent multiple CUs in a .s file when using .loc
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>MC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rafael.espindola@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>echristo@gmail.com, llvmbugs@cs.uiuc.edu, mren@apple.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using .file and .loc produces assembly files that a quiet a bit more readable.
Unfortunately, using those we are currently not able to represent multiple
compile units in one .s file. This means that the output we produce during LTO
is different if emitting assembly or object files.

There are two problems

1) The .file directive can only be of the forms
  .file NUM PATH
or
  .file NUM DIR PATH

2) The .debug_info section is still printed manually, and it needs an offset
into the .debug_line section for DW_AT_stmt_list. With .loc we only know the
offset of the first compilation unit (it is always 0).

A first idea on how to fix this

* Extend .file to take a compilation unit. It would now also accept

.file NUM DIR CU_NUM

not sure if there is value in accepting ".file NUM CU_NUM".

the meaning of having

.file 42 "bar" "foo" 2
.file 43 "bar foo" 3

is that entry number 42 is for compile unit 2 and entry 43 is for compile unit
3. Omitting the compile unit just means compile unit 0. The numbers passed to
.file are still unique. That allows .loc to remain unchanged.

* For the second problem we probably need a new directive. Something like
.offset_of_cu_in_debug_lines. We would then print

.offset_of_cu_in_debug_lines 0

instead of 

.long   .Lsection_line          # DW_AT_stmt_list

and it would also work for the other compile units.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>