Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / tools / llvm-objdump / MachO / chained-fixups.test
blobed78e2ef4e0a59a93c1990f88ed6096f1acdac7d
1 RUN: llvm-objdump -p %p/Inputs/chained-fixups.macho-x86_64 | FileCheck %s
2 RUN: llvm-otool -l %p/Inputs/chained-fixups.macho-x86_64 | FileCheck %s
4 CHECK: LC_DYLD_CHAINED_FIXUPS
5 CHECK: LC_DYLD_EXPORTS_TRIE
7 RUN: llvm-objdump --macho --chained-fixups %p/Inputs/chained-fixups.macho-x86_64 | \
8 RUN:     FileCheck --check-prefix=DETAILS -DNAME=%p/Inputs/chained-fixups.macho-x86_64 %s
9 RUN: llvm-otool -chained_fixups %p/Inputs/chained-fixups.macho-x86_64 | \
10 RUN:     FileCheck --check-prefix=DETAILS -DNAME=%p/Inputs/chained-fixups.macho-x86_64 %s
12 DETAILS:      [[NAME]]:
13 DETAILS-NEXT: chained fixups header (LC_DYLD_CHAINED_FIXUPS)
14 DETAILS-NEXT:   fixups_version = 0
15 DETAILS-NEXT:   starts_offset  = 32
16 DETAILS-NEXT:   imports_offset = 112
17 DETAILS-NEXT:   symbols_offset = 132
18 DETAILS-NEXT:   imports_count  = 5
19 DETAILS-NEXT:   imports_format = 1 (DYLD_CHAINED_IMPORT)
20 DETAILS-NEXT:   symbols_format = 0
21 DETAILS-NEXT: chained starts in image
22 DETAILS-NEXT:   seg_count = 4
23 DETAILS-NEXT:     seg_offset[0] = 0 (__TEXT)
24 DETAILS-NEXT:     seg_offset[1] = 24 (__DATA_CONST)
25 DETAILS-NEXT:     seg_offset[2] = 48 (__DATA)
26 DETAILS-NEXT:     seg_offset[3] = 0 (__LINKEDIT)
27 DETAILS-NEXT: chained starts in segment 1 (__DATA_CONST)
28 DETAILS-NEXT:   size = 24
29 DETAILS-NEXT:   page_size = 0x1000
30 DETAILS-NEXT:   pointer_format = 6 (DYLD_CHAINED_PTR_64_OFFSET)
31 DETAILS-NEXT:   segment_offset = 0x3e0
32 DETAILS-NEXT:   max_valid_pointer = 0
33 DETAILS-NEXT:   page_count = 1
34 DETAILS-NEXT:     page_start[0] = 0
35 DETAILS-NEXT: chained starts in segment 2 (__DATA)
36 DETAILS-NEXT:   size = 30
37 DETAILS-NEXT:   page_size = 0x1000
38 DETAILS-NEXT:   pointer_format = 6 (DYLD_CHAINED_PTR_64_OFFSET)
39 DETAILS-NEXT:   segment_offset = 0x3f0
40 DETAILS-NEXT:   max_valid_pointer = 0
41 DETAILS-NEXT:   page_count = 4
42 DETAILS-NEXT:     page_start[0] = 0
43 DETAILS-NEXT:     page_start[1] = 32
44 DETAILS-NEXT:     page_start[2] = 65535 (DYLD_CHAINED_PTR_START_NONE)
45 DETAILS-NEXT:     page_start[3] = 32
46 DETAILS-NEXT: dyld chained import[0]
47 DETAILS-NEXT:   lib_ordinal = -2 (flat-namespace)
48 DETAILS-NEXT:   weak_import = 0
49 DETAILS-NEXT:   name_offset = 1 (_dynamicLookup)
50 DETAILS-NEXT: dyld chained import[1]
51 DETAILS-NEXT:   lib_ordinal = 1 (libdylib)
52 DETAILS-NEXT:   weak_import = 1
53 DETAILS-NEXT:   name_offset = 16 (_weakImport)
54 DETAILS-NEXT: dyld chained import[2]
55 DETAILS-NEXT:   lib_ordinal = 1 (libdylib)
56 DETAILS-NEXT:   weak_import = 0
57 DETAILS-NEXT:   name_offset = 28 (_dylib)
58 DETAILS-NEXT: dyld chained import[3]
59 DETAILS-NEXT:   lib_ordinal = -3 (weak)
60 DETAILS-NEXT:   weak_import = 0
61 DETAILS-NEXT:   name_offset = 35 (_weakLocal)
62 DETAILS-NEXT: dyld chained import[4]
63 DETAILS-NEXT:   lib_ordinal = -3 (weak)
64 DETAILS-NEXT:   weak_import = 0
65 DETAILS-NEXT:   name_offset = 46 (_weak)
67 ## This test checks that the output is identical to that of cctools-1001.2 (XCode 14)
68 ## FIXME: Print encoded values of the dyld_chained_import* entries
70 ## The input was generated from the following files:
72 ## --- dylib.s:
73 ##   .data
74 ##   .globl _weak, _dylib, _weakImport
75 ##   .weak_definition _weak
76 ##   _weak:
77 ##   _dylib:
78 ##   _weakImport:
80 ##  $ clang --target=x86_64-apple-macos12 -dynamiclib dylib.s -o libdylib.dylib
82 ## --- chained-fixups.s:
83 ##   .global _local, _weak, _weakLocal, _dylib, _weakImport, _dynamicLookup
84 ##   .weak_definition _weakLocal
85 ##   .weak_reference _weakImport
87 ##   .data
88 ##   .p2align 4
89 ##   _local:
90 ##   _weakLocal:
91 ##   .quad _local
92 ##   .space 8
93 ##   .quad _weak
94 ##   .space 4096
95 ##   .p2align 4
96 ##   .quad _weakLocal
97 ##   .space 8172
98 ##   .p2align 4
99 ##   .quad _dylib
100 ##   .quad _dylib + 42
102 ##   .section __DATA_CONST,__const
103 ##   .p2align 4
104 ##   .quad _weakImport
105 ##   .quad _dynamicLookup
107 ## $ clang --target=x86_64-apple-macos12 -dynamiclib -L. -ldylib chained-fixups.s \
108 ##       -o chained-fixups.macho-x86_64 -Wl,-segalign,0x10 -Wl,-U,_dynamicLookup