New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect CIE version 3 in object files for platforms defaulting to DWARF2 #22420
Comments
*** Bug llvm/llvm-bugzilla-archive#23192 has been marked as a duplicate of this bug. *** |
Using the test from my report of... echo "int f (void) { return 0; }" > conftest.c it see the following walk in lldb... % lldb /sw/opt/llvm-3.7.0/bin/llc
whereas for... clang-3.7 -emit-llvm -c conftest.c
|
Any idea how to get lldb to display the value of the returned dwarf::DWARF_VERSION in the case with -g? |
mentioned in issue llvm/llvm-bugzilla-archive#23192 |
Extended Description
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:
0x00000021:
0x00000024:
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:
0x00000021:
0x00000024:
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
The text was updated successfully, but these errors were encountered: