[LLVMbugs] [Bug 22046] New: Incorrect CIE version 3 in object files for platforms defaulting to DWARF2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Dec 28 11:46:13 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=22046

            Bug ID: 22046
           Summary: Incorrect CIE version 3 in object files for platforms
                    defaulting to DWARF2
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141228/00310980/attachment.html>


More information about the llvm-bugs mailing list