[LLVMbugs] [Bug 13581] New: integrated assembler gets .debug_frame wrong
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Aug 11 20:24:44 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13581
Bug #: 13581
Summary: integrated assembler gets .debug_frame wrong
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
AssignedTo: unassignedbugs at nondot.org
ReportedBy: nicholas at mxc.ca
CC: llvmbugs at cs.uiuc.edu, rafael.espindola at gmail.com
Classification: Unclassified
The integrated assembler produces a .debug_frame that doesn't work with gdb,
and is different from what GNU as produces. However, we produce the correct
.eh_frame, when we choose to do so.
$ cat 3.cc
int rs();
static int i = rs();
$ clang 3.cc -c -o 3.good.o -fPIC -g
$ clang 3.cc -c -o 3.bad.o -fPIC -g -fno-exceptions
$ clang 3.cc -c -o 3.gnuas.o -fPIC -g -fno-exceptions -no-integrated-as
If you check the assembly instead of going straight to .o files, the only
difference between -fno-exceptions and not is whether we emit a ".cfi_sections
.debug_frame" directive (we do in -fno-exceptions builds). Let's take a look at
what we just did:
$ objdump -Wf 3.good.o
3.good.o: file format elf64-x86-64
Contents of the .eh_frame section:
00000000 00000014 00000000 CIE
Version: 1
Augmentation: "zR"
Code alignment factor: 1
Data alignment factor: -8
Return address column: 16
Augmentation data: 1b
DW_CFA_def_cfa: r7 (rsp) ofs 8
DW_CFA_offset: r16 (rip) at cfa-8
DW_CFA_nop
DW_CFA_nop
00000018 00000018 0000001c FDE cie=00000000 pc=00000000..00000011
DW_CFA_advance_loc: 1 to 00000001
DW_CFA_def_cfa_offset: 16
DW_CFA_offset: r6 (rbp) at cfa-16
DW_CFA_advance_loc: 3 to 00000004
DW_CFA_def_cfa_register: r6 (rbp)
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
00000034 00000018 00000038 FDE cie=00000000 pc=00000020..0000002b
DW_CFA_advance_loc: 1 to 00000021
DW_CFA_def_cfa_offset: 16
DW_CFA_offset: r6 (rbp) at cfa-16
DW_CFA_advance_loc: 3 to 00000024
DW_CFA_def_cfa_register: r6 (rbp)
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
$ objdump -Wf 3.bad.o
3.bad.o: file format elf64-x86-64
Contents of the .debug_frame section:
00000000 00000014 ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -8
Return address column: 16
DW_CFA_def_cfa: r7 (rsp) ofs 8
DW_CFA_offset: r16 (rip) at cfa-8
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
00000018 0000001c 00000000 FDE cie=00000000 pc=00000000..86100e4100000011
DW_CFA_advance_loc1: 67 to 00000043
DW_CFA_def_cfa_register: r6 (rbp)
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
00000038 0000001c 00000000 FDE cie=00000000 pc=00000020..86100e410000002b
DW_CFA_advance_loc1: 67 to 00000063
DW_CFA_def_cfa_register: r6 (rbp)
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
$ objdump -Wf 3.gnuas.o
3.gnuas.o: file format elf64-x86-64
Contents of the .debug_frame section:
00000000 00000014 ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -8
Return address column: 16
DW_CFA_def_cfa: r7 (rsp) ofs 8
DW_CFA_offset: r16 (rip) at cfa-8
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
00000018 0000001c 00000000 FDE cie=00000000 pc=00000000..00000011
DW_CFA_advance_loc: 1 to 00000001
DW_CFA_def_cfa_offset: 16
DW_CFA_offset: r6 (rbp) at cfa-16
DW_CFA_advance_loc: 3 to 00000004
DW_CFA_def_cfa_register: r6 (rbp)
00000038 0000001c 00000000 FDE cie=00000000 pc=00000020..0000002b
DW_CFA_advance_loc: 1 to 00000021
DW_CFA_def_cfa_offset: 16
DW_CFA_offset: r6 (rbp) at cfa-16
DW_CFA_advance_loc: 3 to 00000024
DW_CFA_def_cfa_register: r6 (rbp)
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list