xref: /aosp_15_r20/external/llvm/test/MC/MachO/relax-recompute-align.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | llvm-readobj -s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker// FIXME: This is a horrible way of checking the output, we need an llvm-mc
4*9880d681SAndroid Build Coastguard Worker// based 'otool'.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker// This is a case where llvm-mc computes a better layout than Darwin 'as'. This
7*9880d681SAndroid Build Coastguard Worker// issue is that after the first jmp slides, the .align size must be
8*9880d681SAndroid Build Coastguard Worker// recomputed -- otherwise the second jump will appear to be out-of-range for a
9*9880d681SAndroid Build Coastguard Worker// 1-byte jump.
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard WorkerL0:
12*9880d681SAndroid Build Coastguard Worker        .space 0x8a, 0x90
13*9880d681SAndroid Build Coastguard Worker	jmp	L0
14*9880d681SAndroid Build Coastguard Worker        .space (0xb3 - 0x8f), 0x90
15*9880d681SAndroid Build Coastguard Worker	jle	L2
16*9880d681SAndroid Build Coastguard Worker        .space (0xcd - 0xb5), 0x90
17*9880d681SAndroid Build Coastguard Worker	.align	4, 0x90
18*9880d681SAndroid Build Coastguard WorkerL1:
19*9880d681SAndroid Build Coastguard Worker        .space (0x130 - 0xd0),0x90
20*9880d681SAndroid Build Coastguard Worker	jl	L1
21*9880d681SAndroid Build Coastguard WorkerL2:
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker.zerofill __DATA,__bss,_sym,4,2
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker// CHECK: Section {
26*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Index: 0
27*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
28*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
29*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Address: 0x0
30*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Size: 0x132
31*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Offset: 340
32*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Alignment: 4
33*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   RelocationOffset: 0x0
34*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   RelocationCount: 0
35*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Type: 0x0
36*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Attributes [ (0x800004)
37*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:     PureInstructions (0x800000)
38*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:     SomeInstructions (0x4)
39*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   ]
40*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Reserved1: 0x0
41*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   Reserved2: 0x0
42*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: }
43