]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/conflict-debug-variable-file-index.s
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / ELF / conflict-debug-variable-file-index.s
1 # REQUIRES: x86
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 %t 2>&1 | FileCheck %s
4
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. 
10
11 # CHECK:      duplicate symbol: foo
12 # CHECK-NEXT: >>> defined at {{.*}}.o:(foo)
13 # CHECK-NEXT: >>>            {{.*}}.o:(.bss+0x0)
14
15 # Used modified output from the following code and gcc 7.1.0:
16 # Source (1.c):
17 #  int foo = 0;
18 # Invocation: g++ -g -S 1.c
19
20 .bss
21 .globl  foo
22 .type  foo, @object
23 .size  foo, 4
24 foo:
25
26 .text
27 .file 1 "1.c"
28
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
34
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)
41
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)
48   .byte  0x3
49   .quad  foo             # DW_AT_location [DW_FORM_exprloc]  (DW_OP_addr 0x0)
50
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")
55
56 .section  .debug_abbrev,"",@progbits
57   .uleb128 0x1   # Abbreviation code.
58   .uleb128 0x11  # DW_TAG_compile_unit
59
60   .byte  0x1     # ID
61   .uleb128 0x25  # DW_AT_producer, DW_FORM_strp
62   .uleb128 0xe
63   .uleb128 0x13  # DW_AT_language, DW_FORM_data1
64   .uleb128 0xb
65   .uleb128 0x3   # DW_AT_name, DW_FORM_string
66   .uleb128 0x8
67   .uleb128 0x1b  # DW_AT_comp_dir, DW_FORM_strp
68   .uleb128 0xe
69   .uleb128 0x10  # DW_AT_stmt_list, DW_FORM_sec_offset
70   .uleb128 0x17
71   .byte  0
72   .byte  0
73
74   .uleb128 0x2  # ID
75   .uleb128 0x34 # DW_TAG_variable, DW_CHILDREN_no
76   .byte  0
77   .uleb128 0x3  # DW_AT_name, DW_FORM_string
78   .uleb128 0x8
79   .uleb128 0x3a # DW_AT_decl_file, DW_FORM_data1
80   .uleb128 0xb
81   .uleb128 0x3b # DW_AT_decl_line, DW_FORM_data1
82   .uleb128 0xb
83   .uleb128 0x49 # DW_AT_type, DW_FORM_ref4
84   .uleb128 0x13
85   .uleb128 0x3f # DW_AT_external, DW_FORM_flag_present
86   .uleb128 0x19
87   .uleb128 0x2  # DW_AT_location, DW_FORM_exprloc
88   .uleb128 0x18
89   .byte  0
90   .byte  0
91
92   .uleb128 0x3  # ID
93   .uleb128 0x24 # DW_TAG_base_type, DW_CHILDREN_no
94   .byte  0
95   .uleb128 0xb  # DW_AT_byte_size, DW_FORM_data1
96   .uleb128 0xb
97   .uleb128 0x3e # DW_AT_encoding, DW_FORM_data1
98   .uleb128 0xb
99   .uleb128 0x3  # DW_AT_name, DW_FORM_string
100   .uleb128 0x8
101   .byte  0
102   .byte  0
103   .byte  0