1# REQUIRES: x86-registered-target
2
3## Show that llvm-objcopy copies the indirect symbol table properly.
4# RUN: llvm-mc -assemble -triple x86_64-apple-darwin9 -filetype=obj %s -o %t
5# RUN: llvm-objcopy %t %t.copy
6# RUN: llvm-readobj --symbols --macho-indirect-symbols %t.copy \
7# RUN:   | FileCheck %s
8
9# __DATA,__nl_symbol_ptr
10.non_lazy_symbol_pointer
11bar:
12        .long 0
13baz:
14        .long 0
15
16.indirect_symbol bar
17
18# __DATA,__la_symbol_ptr
19.lazy_symbol_pointer
20foo:
21        .long 0
22
23.indirect_symbol foo
24
25# CHECK:      Symbols [
26# CHECK-NEXT:   Symbol {
27# CHECK-NEXT:     Name: bar (5)
28# CHECK-NEXT:     Type: Section (0xE)
29# CHECK-NEXT:     Section: __nl_symbol_ptr (0x2)
30# CHECK-NEXT:     RefType: UndefinedNonLazy (0x0)
31# CHECK-NEXT:     Flags [ (0x0)
32# CHECK-NEXT:     ]
33# CHECK-NEXT:     Value: 0x0
34# CHECK-NEXT:   }
35# CHECK-NEXT:   Symbol {
36# CHECK-NEXT:     Name: baz (1)
37# CHECK-NEXT:     Type: Section (0xE)
38# CHECK-NEXT:     Section: __nl_symbol_ptr (0x2)
39# CHECK-NEXT:     RefType: UndefinedNonLazy (0x0)
40# CHECK-NEXT:     Flags [ (0x0)
41# CHECK-NEXT:     ]
42# CHECK-NEXT:     Value: 0x4
43# CHECK-NEXT:   }
44# CHECK-NEXT:   Symbol {
45# CHECK-NEXT:     Name: foo (9)
46# CHECK-NEXT:     Type: Section (0xE)
47# CHECK-NEXT:     Section: __la_symbol_ptr (0x3)
48# CHECK-NEXT:     RefType: UndefinedNonLazy (0x0)
49# CHECK-NEXT:     Flags [ (0x0)
50# CHECK-NEXT:     ]
51# CHECK-NEXT:     Value: 0x8
52# CHECK-NEXT:   }
53# CHECK-NEXT: ]
54# CHECK-NEXT: Indirect Symbols {
55# CHECK-NEXT:   Number: 2
56# CHECK-NEXT:   Symbols [
57# CHECK-NEXT:     Entry {
58# CHECK-NEXT:       Entry Index: 0
59# CHECK-NEXT:       Symbol Index: 0x80000000
60# CHECK-NEXT:     }
61# CHECK-NEXT:     Entry {
62# CHECK-NEXT:       Entry Index: 1
63# CHECK-NEXT:       Symbol Index: 0x2
64# CHECK-NEXT:     }
65# CHECK-NEXT:   ]
66# CHECK-NEXT: }
67