• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-mc -triple thumbv7m-apple-darwin-eabi %s -filetype=obj -o %t
2// RUN:     llvm-readobj -symbols %t | FileCheck %s
3
4        .data
5        var1 = var2
6        .long var1
7        .long var2
8        .long var2 + 4
9defined_early:
10        .long 0
11
12        alias_to_early = defined_early
13        alias_to_late = defined_late
14
15defined_late:
16        .long 0
17
18        .global extern_test
19        extern_test = var2
20
21        alias_to_local = Ltmp0
22Ltmp0:
23
24// CHECK: Symbols [
25
26        // defined_early was defined. Actually has value 0xc.
27// CHECK: Symbol {
28// CHECK-NEXT:   Name: defined_early
29// CHECK-NEXT:   Type: Section (0xE)
30// CHECK-NEXT:   Section: __data (0x2)
31// CHECK-NEXT:   RefType: UndefinedNonLazy (0x0)
32// CHECK-NEXT:   Flags [ (0x0)
33// CHECK-NEXT:   ]
34// CHECK-NEXT:   Value: 0x[[DEFINED_EARLY:[0-9A-F]+]]
35// CHECK-NEXT: }
36
37        // alias_to_early was an alias to defined_early. But we can resolve it.
38// CHECK: Symbol {
39// CHECK-NEXT:   Name: alias_to_early
40// CHECK-NEXT:   Type: Section (0xE)
41// CHECK-NEXT:   Section: __data (0x2)
42// CHECK-NEXT:   RefType: UndefinedNonLazy (0x0)
43// CHECK-NEXT:   Flags [ (0x0)
44// CHECK-NEXT:   ]
45// CHECK-NEXT:   Value: 0x[[DEFINED_EARLY]]
46// CHECK-NEXT: }
47
48        // alias_to_late was an alias to defined_late. But we can resolve it.
49// CHECK: Symbol {
50// CHECK-NEXT:   Name: alias_to_late
51// CHECK-NEXT:   Type: Section (0xE)
52// CHECK-NEXT:   Section: __data (0x2)
53// CHECK-NEXT:   RefType: UndefinedNonLazy (0x0)
54// CHECK-NEXT:   Flags [ (0x0)
55// CHECK-NEXT:   ]
56// CHECK-NEXT:   Value: 0x[[DEFINED_LATE:[0-9A-F]+]]
57// CHECK-NEXT: }
58
59        // defined_late was defined. Just after defined_early.
60// CHECK: Symbol {
61// CHECK-NEXT:   Name: defined_late
62// CHECK-NEXT:   Type: Section (0xE)
63// CHECK-NEXT:   Section: __data (0x2)
64// CHECK-NEXT:   RefType: UndefinedNonLazy (0x0)
65// CHECK-NEXT:   Flags [ (0x0)
66// CHECK-NEXT:   ]
67// CHECK-NEXT:   Value: 0x[[DEFINED_LATE]]
68// CHECK-NEXT: }
69
70        // alias_to_local is an alias, but what it points to has no
71        // MachO representation. We must resolve it.
72// CHECK: Symbol {
73// CHECK-NEXT:   Name: alias_to_local (42)
74// CHECK-NEXT:   Type: Section (0xE)
75// CHECK-NEXT:   Section: __data (0x2)
76// CHECK-NEXT:   RefType: UndefinedNonLazy (0x0)
77// CHECK-NEXT:   Flags [ (0x0)
78// CHECK-NEXT:   ]
79// CHECK-NEXT:   Value: 0x14
80// CHECK-NEXT: }
81
82        // extern_test was a pure alias to the unknown "var2".
83        // N_INDR and Extern.
84// CHECK:   Name: extern_test
85// CHECK-NEXT:   Extern
86// CHECK-NEXT:   Type: Indirect (0xA)
87// CHECK-NEXT:   Section:  (0x0)
88// CHECK-NEXT:   RefType: UndefinedNonLazy (0x0)
89// CHECK-NEXT:   Flags [ (0x0)
90// CHECK-NEXT:   ]
91// CHECK-NEXT:   Value: 0x[[VAR2_STRINGINDEX:[0-9a-f]+]]
92// CHECK-NEXT: }
93
94        // var1 was another alias to an unknown variable. Not extern this time.
95// CHECK: Symbol {
96// CHECK-NEXT:   Name: var1 (89)
97// CHECK-NEXT:   Type: Indirect (0xA)
98// CHECK-NEXT:   Section:  (0x0)
99// CHECK-NEXT:   RefType: UndefinedNonLazy (0x0)
100// CHECK-NEXT:   Flags [ (0x0)
101// CHECK-NEXT:   ]
102// CHECK-NEXT:   Value: 0x[[VAR2_STRINGINDEX]]
103// CHECK-NEXT: }
104
105        // var2 was a normal undefined (extern) symbol.
106// CHECK: Symbol {
107// CHECK-NEXT:   Name: var2
108// CHECK-NEXT:   Extern
109// CHECK-NEXT:   Type: Undef (0x0)
110// CHECK-NEXT:   Section:  (0x0)
111// CHECK-NEXT:   RefType: UndefinedNonLazy (0x0)
112// CHECK-NEXT:   Flags [ (0x0)
113// CHECK-NEXT:   ]
114// CHECK-NEXT:   Value: 0x0
115// CHECK-NEXT: }
116