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=INVALIDCONTRIB %s
3#
4# Test object to verify that llvm-dwarfdump handles an invalid string offsets
5# table.
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# A rudimentary compile unit to convince dwarfdump that we are dealing with a
47# DWARF v5 string offsets table.
48        .section .debug_info,"",@progbits
49
50# DWARF v5 CU header.
51        .long  CU1_5_end-CU1_5_version  # Length of Unit
52CU1_5_version:
53        .short 5               # DWARF version number
54        .byte 1                # DWARF Unit Type
55        .byte 8                # Address Size (in bytes)
56        .long .debug_abbrev    # Offset Into Abbrev. Section
57# A compile-unit DIE, which has no attributes.
58        .byte 1                # Abbreviation code
59        .long .debug_str_offsets_base0
60CU1_5_end:
61
62        .section .debug_str_offsets,"",@progbits
63# CU1's contribution
64# Invalid length
65        .long 0xfffffffe
66        .short 5    # DWARF version
67        .short 0    # Padding
68.debug_str_offsets_base0:
69        .long str_producer
70        .long str_CU1
71        .long str_CU1_dir
72.debug_str_offsets_segment0_end:
73# CU2's contribution
74        .long .debug_str_offsets_segment1_end-.debug_str_offsets_base1+4
75        .short 5    # DWARF version
76        .short 0    # Padding
77.debug_str_offsets_base1:
78        .long str_producer
79        .long str_CU2
80        .long str_CU2_dir
81.debug_str_offsets_segment1_end:
82# The TU's contribution
83        .long .debug_str_offsets_segment2_end-.debug_str_offsets_base2+4
84        .short 5    # DWARF version
85        .short 0    # Padding
86.debug_str_offsets_base2:
87        .long str_TU
88        .long str_TU_type
89.debug_str_offsets_segment2_end:
90
91# INVALIDCONTRIB:            .debug_str_offsets contents:
92# INVALIDCONTRIB-NOT:        contents:
93# INVALIDCONTRIB:            error: invalid contribution to string offsets table in section .debug_str_offsets.
94