Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / data-in-code.s
blob49aa7655a84b0c4084cdcbd9d352cb18c6b651b2
1 # REQUIRES: x86
3 # RUN: rm -rf %t; split-file %s %t
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o
6 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/bar.s -o %t/bar.o
7 # RUN: %lld -lSystem %t/foo.o %t/bar.o -o %t/main.exe
8 # RUN: llvm-otool -l %t/main.exe > %t/objdump
9 # RUN: llvm-objdump --macho --data-in-code %t/main.exe >> %t/objdump
10 # RUN: FileCheck %s < %t/objdump
12 # CHECK-LABEL: sectname __text
13 # CHECK-NEXT: segname __TEXT
14 # CHECK-NEXT: addr
15 # CHECK-NEXT: size
16 # CHECK-NEXT: offset [[#%,TEXT:]]
18 # CHECK-LABEL: cmd LC_DATA_IN_CODE
19 # CHECK-NEXT: cmdsize 16
20 # CHECK-NEXT: dataoff
21 # CHECK-NEXT: datasize 16
23 # CHECK-LABEL: Data in code table (2 entries)
24 # CHECK-NEXT: offset length kind
25 # CHECK-NEXT: [[#%x,TEXT + 28]] 24 JUMP_TABLE32
26 # CHECK-NEXT: [[#%x,TEXT + 68]] 12 JUMP_TABLE32
28 # RUN: %lld -lSystem %t/foo.o %t/bar.o -no_data_in_code_info -o %t/main.exe
29 # RUN: llvm-otool -l %t/main.exe | FileCheck --check-prefix=OMIT %s
31 # OMIT-NOT: LC_DATA_IN_CODE
33 # RUN: %lld -lSystem %t/foo.o %t/bar.o -no_data_in_code_info -data_in_code_info -o %t/main.exe
34 # RUN: llvm-otool -l %t/main.exe > %t/objdump
35 # RUN: llvm-objdump --macho --data-in-code %t/main.exe >> %t/objdump
36 # RUN: FileCheck %s < %t/objdump
38 #--- foo.s
39 .text
40 .globl _main
41 .p2align 4, 0x90
42 _main:
43 pushq %rbp
44 movq %rsp, %rbp
45 subq $16, %rsp
46 movl $0, -4(%rbp)
47 movb $0, %al
48 callq _bar
49 addq $16, %rsp
50 popq %rbp
51 retq
52 .p2align 2, 0x90
53 .data_region jt32
54 .long 0
55 .long 0
56 .long 0
57 .long 0
58 .long 0
59 .long 0
60 .end_data_region
62 #--- bar.s
63 .text
64 .globl _bar
65 .p2align 4
66 _bar:
67 retq
68 .p2align 2, 0x90
69 .data_region jt32
70 .long 0
71 .long 0
72 .long 0
73 .end_data_region