3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
4 # RUN: %lld -dylib %t.o -o %t.dylib
5 # RUN: obj2yaml %t.dylib | FileCheck %s
12 # CHECK: RebaseOpcodes:
13 # CHECK-NEXT: Opcode: REBASE_OPCODE_SET_TYPE_IMM
15 # CHECK-NEXT: Opcode: REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
17 # CHECK-NEXT: ExtraData: [ 0x0 ]
19 ## 1/ Single rebases with a gap after them are encoded as REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB.
22 # CHECK-NEXT: Opcode: REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB
24 # CHECK-NEXT: ExtraData: [ 0x10 ]
26 ## 2/ Consecutive rebases are encoded as REBASE_OPCODE_DO_REBASE_IMM_TIMES.
30 # CHECK-NEXT: Opcode: REBASE_OPCODE_DO_REBASE_IMM_TIMES
33 ## 3/ Gaps smaller than 16 words are encoded as REBASE_OPCODE_ADD_ADDR_IMM_SCALED.
35 # CHECK-NEXT: Opcode: REBASE_OPCODE_ADD_ADDR_IMM_SCALED
38 ## 4/ Rebases with equal gaps betwen them are encoded as REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB.
43 # CHECK-NEXT: Opcode: REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB
45 # CHECK-NEXT: ExtraData: [ 0x2, 0x10 ]
47 ## 5/ Rebase does not become a part of DO_REBASE_ULEB_TIMES_SKIPPING_ULEB if the next rebase is closer than the gap.
50 # CHECK-NEXT: Opcode: REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB
52 # CHECK-NEXT: ExtraData: [ 0x8 ]
56 # CHECK-NEXT: Opcode: REBASE_OPCODE_DO_REBASE_IMM_TIMES
59 ## 6/ Large gaps are encoded as REBASE_OPCODE_ADD_ADDR_ULEB.
61 # CHECK-NEXT: Opcode: REBASE_OPCODE_ADD_ADDR_ULEB
63 # CHECK-NEXT: ExtraData: [ 0x80 ]
70 # CHECK-NEXT: Opcode: REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB
72 # CHECK-NEXT: ExtraData: [ 0x3, 0x8 ]
75 ## 7/ An add opcode is emitted if the next relocation is farther away than the DO_REBASE_ULEB_TIMES_SKIPPING_ULEB gap.
78 # CHECK-NEXT: Opcode: REBASE_OPCODE_ADD_ADDR_IMM_SCALED
80 # CHECK-NEXT: Opcode: REBASE_OPCODE_DO_REBASE_IMM_TIMES
83 ## 8/ The rebase section is terminated by REBASE_OPCODE_DONE.
84 # CHECK-NEXT: Opcode: REBASE_OPCODE_DONE