1# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
2# RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=OVERLAP %s
3#
4# Test object to verify that llvm-dwarfdump handles an invalid string offsets
5# table with overlapping contributions.
6
7        .section .debug_str,"MS",@progbits,1
8str_producer:
9        .asciz "Handmade DWARF producer"
10str_CU1:
11        .asciz "Compile_Unit_1"
12str_CU1_dir:
13        .asciz "/home/test/CU1"
14str_CU2:
15        .asciz "Compile_Unit_2"
16str_CU2_dir:
17        .asciz "/home/test/CU2"
18str_TU:
19        .asciz "Type_Unit"
20str_TU_type:
21        .asciz "MyStruct"
22
23        .section .debug_str.dwo,"MS",@progbits,1
24dwo_str_CU_5_producer:
25        .asciz "Handmade split DWARF producer"
26dwo_str_CU_5_name:
27        .asciz "V5_split_compile_unit"
28dwo_str_CU_5_comp_dir:
29        .asciz "/home/test/splitCU"
30dwo_str_TU_5:
31        .asciz "V5_split_type_unit"
32dwo_str_TU_5_type:
33        .asciz "V5_split_Mystruct"
34
35# A rudimentary abbrev section.
36        .section .debug_abbrev,"",@progbits
37        .byte 0x01  # Abbrev code
38        .byte 0x11  # DW_TAG_compile_unit
39        .byte 0x00  # DW_CHILDREN_no
40        .byte 0x72  # DW_AT_str_offsets_base
41        .byte 0x17  # DW_FORM_sec_offset
42        .byte 0x00  # EOM(1)
43        .byte 0x00  # EOM(2)
44        .byte 0x00  # EOM(3)
45
46        .section .debug_info,"",@progbits
47# DWARF v5 CU header.
48        .long  CU1_5_end-CU1_5_version  # Length of Unit
49CU1_5_version:
50        .short 5               # DWARF version number
51        .byte 1                # DWARF Unit Type
52        .byte 8                # Address Size (in bytes)
53        .long .debug_abbrev    # Offset Into Abbrev. Section
54# A compile-unit DIE, which has no attributes.
55        .byte 1                # Abbreviation code
56        .long .debug_str_offsets_base0
57CU1_5_end:
58
59# DWARF v5 CU header.
60        .long  CU2_5_end-CU2_5_version  # Length of Unit
61CU2_5_version:
62        .short 5               # DWARF version number
63        .byte 1                # DWARF Unit Type
64        .byte 8                # Address Size (in bytes)
65        .long .debug_abbrev    # Offset Into Abbrev. Section
66# A compile-unit DIE, which has no attributes.
67        .byte 1                # Abbreviation code
68        .long .debug_str_offsets_base1
69CU2_5_end:
70
71        .section .debug_str_offsets,"",@progbits
72# CU1's contribution
73        .long .debug_str_offsets_segment1_end-.debug_str_offsets_base0+4
74        .short 5    # DWARF version
75        .short 0    # Padding
76.debug_str_offsets_base0:
77        .long str_producer
78        .long str_CU1
79        .long str_CU1_dir
80.debug_str_offsets_segment0_end:
81# CU2's contribution
82# Overlapping with CU1's contribution
83        .long .debug_str_offsets_segment1_end-.debug_str_offsets_base1+4
84        .short 5    # DWARF version
85        .short 0    # Padding
86.debug_str_offsets_base1:
87        .long str_producer
88        .long str_CU2
89        .long str_CU2_dir
90.debug_str_offsets_segment1_end:
91
92# OVERLAP:            .debug_str_offsets contents:
93# OVERLAP-NOT:        contents:
94# OVERLAP:            error: overlapping contributions to string offsets table in section .debug_str_offsets.
95