<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 --- - Incorrect CIE version 3 in object files for platforms defaulting to DWARF2"
   href="http://llvm.org/bugs/show_bug.cgi?id=22046">22046</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect CIE version 3 in object files for platforms defaulting to DWARF2
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>As discussed on the llvm-commits list [1], for platforms which default to
emitting DWARF2, such as *BSD, Darwin and Solaris, clang can output an
incorrect CIE version field in object files, depending on whether -g is used or
not.

This behavior was introduced by r211272.  A simple demonstration (as already
shown on the mailing list):

  $ cat build-config-test.c
  int f (void) { return 0; }
  $ ~/obj/llvm-r211272/bin/clang -c    build-config-test.c -o
test-r211272-without-g.o
  $ ~/obj/llvm-r211272/bin/clang -c -g build-config-test.c -o
test-r211272-with-g.o
  $ strip test-r211272-without-g.o
  $ strip test-r211272-with-g.o
  $ dwarfdump -v -F test-r211272-without-g.o

  .eh_frame

  fde:
  <    0><0x00000020:0x0000002b><><fde offset 0x00000018 length: 0x0000001c><eh
aug data len 0x0>
          0x00000020: <off cfa=08(r7) > <off r16=-8(cfa) >
          0x00000021: <off cfa=16(r7) > <off r6=-16(cfa) > <off r16=-8(cfa) >
          0x00000024: <off cfa=16(r6) > <off r6=-16(cfa) > <off r16=-8(cfa) >

  cie:
  <    0> version                         3
          cie section offset              0 0x00000000
          augmentation                    zR
          code_alignment_factor           1
          data_alignment_factor           -8
          return_address_register         16
   eh aug data len 0x1 bytes 0x1b
          bytes of initial instructions   7
          cie length                      20
          initial instructions
           0 DW_CFA_def_cfa r7 8
           3 DW_CFA_offset r16 -8  (1 * -8)
           5 DW_CFA_nop
           6 DW_CFA_nop

  $ dwarfdump -v -F test-r211272-with-g.o

  .eh_frame

  fde:
  <    0><0x00000020:0x0000002b><><fde offset 0x00000018 length: 0x0000001c><eh
aug data len 0x0>
          0x00000020: <off cfa=08(r7) > <off r16=-8(cfa) >
          0x00000021: <off cfa=16(r7) > <off r6=-16(cfa) > <off r16=-8(cfa) >
          0x00000024: <off cfa=16(r6) > <off r6=-16(cfa) > <off r16=-8(cfa) >

  cie:
  <    0> version                         1
          cie section offset              0 0x00000000
          augmentation                    zR
          code_alignment_factor           1
          data_alignment_factor           -8
          return_address_register         16
   eh aug data len 0x1 bytes 0x1b
          bytes of initial instructions   7
          cie length                      20
          initial instructions
           0 DW_CFA_def_cfa r7 8
           3 DW_CFA_offset r16 -8  (1 * -8)
           5 DW_CFA_nop
           6 DW_CFA_nop

E.g., without the -g option, the CIE version is incorrectly set to 3, while
with the -g option, the CIE version is correctly set to 1.

This still reproduces on trunk r224901, as of 2014-12-28.

[1]
<a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141222/250134.html">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141222/250134.html</a></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>