blob: 972d0ae8ff8c1cb094fe214b7952f188651de3cf [file] [log] [blame]
James Hendersoncd1424a2019-02-06 10:13:14 +00001# Show that multiple CUs can have a single common .debug_abbrev table. This can
2# occur due to e.g. LTO.
3
4# REQUIRES: x86-registered-target
5
6# RUN: llvm-mc --filetype=obj --triple=x86_64-pc-linux %s -o %t.o
7# RUN: llvm-symbolizer --obj=%t.o 0 16 --functions=short | FileCheck %s
8
9# CHECK: foo
10# CHECK-NEXT: foo.c:1:0
11
12# CHECK: bar
13# CHECK-NEXT: bar.c:2:0
14
15.global foo
16.type foo,@function
17foo:
18.Lfunc_begin0:
19 .file 1 "." "foo.c"
20 .loc 1 1 0
21 ret
22.Lfunc_end0:
23
24.global bar
25.p2align 4, 0x90
26.type bar,@function
27bar:
28.Lfunc_begin1:
29 .file 2 "." "bar.c"
30 .loc 2 2 0
31 ret
32.Lfunc_end1:
33
34 .section .debug_str,"MS",@progbits,1
35.Linfo_string1:
36 .asciz "foo.c"
37.Linfo_string2:
38 .asciz "."
39.Linfo_string3:
40 .asciz "foo"
41.Linfo_string4:
42 .asciz "bar.c"
43.Linfo_string5:
44 .asciz "bar"
45
46 # Regular .debug_abbrev section with CU and subprogram, but duplicated, with second
47 # half reordered slightly, to show that the correct abbrev is being referenced.
48 .section .debug_abbrev,"",@progbits
49 .byte 1 # Abbreviation Code
50 .byte 17 # DW_TAG_compile_unit
51 .byte 1 # DW_CHILDREN_yes
52 .byte 3 # DW_AT_name
53 .byte 14 # DW_FORM_strp
54 .byte 16 # DW_AT_stmt_list
55 .byte 23 # DW_FORM_sec_offset
56 .byte 27 # DW_AT_comp_dir
57 .byte 14 # DW_FORM_strp
58 .byte 17 # DW_AT_low_pc
59 .byte 1 # DW_FORM_addr
60 .byte 18 # DW_AT_high_pc
61 .byte 6 # DW_FORM_data4
62 .byte 0 # EOM(1)
63 .byte 0 # EOM(2)
64 .byte 2 # Abbreviation Code
65 .byte 46 # DW_TAG_subprogram
66 .byte 0 # DW_CHILDREN_no
67 .byte 17 # DW_AT_low_pc
68 .byte 1 # DW_FORM_addr
69 .byte 18 # DW_AT_high_pc
70 .byte 6 # DW_FORM_data4
71 .byte 3 # DW_AT_name
72 .byte 14 # DW_FORM_strp
73 .byte 58 # DW_AT_decl_file
74 .byte 11 # DW_FORM_data1
75 .byte 59 # DW_AT_decl_line
76 .byte 11 # DW_FORM_data1
77 .byte 63 # DW_AT_external
78 .byte 25 # DW_FORM_flag_present
79 .byte 0 # EOM(1)
80 .byte 0 # EOM(2)
81 # Second-half starts here.
82 .byte 3 # Abbreviation Code
83 .byte 17 # DW_TAG_compile_unit
84 .byte 1 # DW_CHILDREN_yes
85 .byte 16 # DW_AT_stmt_list
86 .byte 23 # DW_FORM_sec_offset
87 .byte 27 # DW_AT_comp_dir
88 .byte 14 # DW_FORM_strp
89 .byte 17 # DW_AT_low_pc
90 .byte 1 # DW_FORM_addr
91 .byte 18 # DW_AT_high_pc
92 .byte 6 # DW_FORM_data4
93 .byte 3 # DW_AT_name
94 .byte 14 # DW_FORM_strp
95 .byte 0 # EOM(1)
96 .byte 0 # EOM(2)
97 .byte 4 # Abbreviation Code
98 .byte 46 # DW_TAG_subprogram
99 .byte 0 # DW_CHILDREN_no
100 .byte 17 # DW_AT_low_pc
101 .byte 1 # DW_FORM_addr
102 .byte 18 # DW_AT_high_pc
103 .byte 6 # DW_FORM_data4
104 .byte 58 # DW_AT_decl_file
105 .byte 11 # DW_FORM_data1
106 .byte 59 # DW_AT_decl_line
107 .byte 11 # DW_FORM_data1
108 .byte 63 # DW_AT_external
109 .byte 25 # DW_FORM_flag_present
110 .byte 3 # DW_AT_name
111 .byte 14 # DW_FORM_strp
112 .byte 0 # EOM(1)
113 .byte 0 # EOM(2)
114 .byte 0 # EOM(3)
115
116 .section .debug_info,"",@progbits
117 # First CU table.
118 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
119.Ldebug_info_start0:
120 .short 4 # DWARF version number
121 .long .debug_abbrev # Offset Into Abbrev. Section
122 .byte 8 # Address Size (in bytes)
123 .byte 1 # Abbrev [1] 0xb:0x35 DW_TAG_compile_unit
124 .long .Linfo_string1 # DW_AT_name
125 .long .Lline_table_start0 # DW_AT_stmt_list
126 .long .Linfo_string2 # DW_AT_comp_dir
127 .quad .Lfunc_begin0 # DW_AT_low_pc
128 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
129 .byte 2 # Abbrev [2] 0x2a:0x15 DW_TAG_subprogram
130 .quad .Lfunc_begin0 # DW_AT_low_pc
131 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
132 .long .Linfo_string3 # DW_AT_name
133 .byte 1 # DW_AT_decl_file
134 .byte 1 # DW_AT_decl_line
135 # DW_AT_external
136 .byte 0 # End Of Children Mark
137.Ldebug_info_end0:
138
139 # Second CU table.
140 .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
141.Ldebug_info_start1:
142 .short 4 # DWARF version number
143 .long .debug_abbrev # Offset Into Abbrev. Section
144 .byte 8 # Address Size (in bytes)
145 .byte 3 # Abbrev [1] 0xb:0x35 DW_TAG_compile_unit
146 .long .Lline_table_start0 # DW_AT_stmt_list
147 .long .Linfo_string2 # DW_AT_comp_dir
148 .quad .Lfunc_begin1 # DW_AT_low_pc
149 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
150 .long .Linfo_string4 # DW_AT_name
151 .byte 4 # Abbrev [2] 0x2a:0x15 DW_TAG_subprogram
152 .quad .Lfunc_begin1 # DW_AT_low_pc
153 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
154 .byte 1 # DW_AT_decl_file
155 .byte 1 # DW_AT_decl_line
156 # DW_AT_external
157 .long .Linfo_string5 # DW_AT_name
158 .byte 0 # End Of Children Mark
159.Ldebug_info_end1:
160
161 .section .debug_line,"",@progbits
162.Lline_table_start0: