2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 # RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s
5 ## Check we are able to report errors even if DW_AT_decl_file
6 ## contains invalid file name index.
7 ## We did not try to support this intentionally but have
8 ## an error handling and reporting logic that can take care
9 ## of that and hence needs a test.
11 # CHECK: duplicate symbol: foo
12 # CHECK-NEXT: >>> defined at {{.*}}.o:(foo)
13 # CHECK-NEXT: >>> {{.*}}.o:(.bss+0x0)
15 # Used modified output from the following code and gcc 7.1.0:
18 # Invocation: g++ -g -S 1.c
29 .section .debug_info,"",@progbits
30 .long 0x35 # Compile Unit: length = 0x0000004b)
31 .value 0x4 # version = 0x0004
32 .long 0 # abbr_offset = 0x0
33 .byte 0x8 # addr_size = 0x08
35 .uleb128 0x1 # DW_TAG_compile_unit [1] *
36 .long 0 # DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = )
37 .byte 0x4 # DW_AT_language [DW_FORM_data1] (DW_LANG_C_plus_plus)
38 .string "1.c" # DW_AT_name [DW_FORM_string] ("1.c")
39 .long 0 # DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000000] = )
40 .long 0 # DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
42 .uleb128 0x2 # DW_TAG_variable [2]
43 .string "foo" # DW_AT_name [DW_FORM_string] ("foo")
44 .byte 0xFE # DW_AT_decl_file [DW_FORM_data1] <broken file>
45 .byte 0x1 # DW_AT_decl_line [DW_FORM_data1] (1)
46 .long 0x32 # DW_AT_type [DW_FORM_ref4] (cu + 0x0032 => {0x00000032})
47 .uleb128 0x9 # DW_AT_external [DW_FORM_flag_present] (true)
49 .quad foo # DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x0)
51 .uleb128 0x3 # DW_TAG_base_type [3]
52 .byte 0x4 # DW_AT_byte_size [DW_FORM_data1] (0x04)
53 .byte 0x5 # DW_AT_encoding [DW_FORM_data1] (DW_ATE_signed)
54 .string "int" # DW_AT_name [DW_FORM_string] ("int")
56 .section .debug_abbrev,"",@progbits
57 .uleb128 0x1 # Abbreviation code.
58 .uleb128 0x11 # DW_TAG_compile_unit
61 .uleb128 0x25 # DW_AT_producer, DW_FORM_strp
63 .uleb128 0x13 # DW_AT_language, DW_FORM_data1
65 .uleb128 0x3 # DW_AT_name, DW_FORM_string
67 .uleb128 0x1b # DW_AT_comp_dir, DW_FORM_strp
69 .uleb128 0x10 # DW_AT_stmt_list, DW_FORM_sec_offset
75 .uleb128 0x34 # DW_TAG_variable, DW_CHILDREN_no
77 .uleb128 0x3 # DW_AT_name, DW_FORM_string
79 .uleb128 0x3a # DW_AT_decl_file, DW_FORM_data1
81 .uleb128 0x3b # DW_AT_decl_line, DW_FORM_data1
83 .uleb128 0x49 # DW_AT_type, DW_FORM_ref4
85 .uleb128 0x3f # DW_AT_external, DW_FORM_flag_present
87 .uleb128 0x2 # DW_AT_location, DW_FORM_exprloc
93 .uleb128 0x24 # DW_TAG_base_type, DW_CHILDREN_no
95 .uleb128 0xb # DW_AT_byte_size, DW_FORM_data1
97 .uleb128 0x3e # DW_AT_encoding, DW_FORM_data1
99 .uleb128 0x3 # DW_AT_name, DW_FORM_string