Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / load-command-sequence.s
blob9de5288ef4be09934adfbf66f256238bcf1f4f65
1 # REQUIRES: x86
3 # RUN: rm -rf %t && mkdir -p %t
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o
5 # RUN: %lld -execute -o %t/exec %t/test.o -lSystem
6 # RUN: %lld -dylib -o %t/dylib %t/test.o -lSystem
7 # RUN: %lld -bundle -o %t/bundle %t/test.o -lSystem
9 # RUN: llvm-objdump --macho --all-headers %t/exec | \
10 # RUN: FileCheck %s --check-prefixes=EXEC,COMMON
11 # RUN: llvm-objdump --macho --all-headers %t/dylib | \
12 # RUN: FileCheck %s --check-prefixes=DYLIB,COMMON
13 # RUN: llvm-objdump --macho --all-headers %t/bundle | \
14 # RUN: FileCheck %s --check-prefix=COMMON
16 ## Check that load commands and sections within segments occur in the proper
17 ## sequence. On ARM64 kernel is especially picky about layout, and will
18 ## barf with errno=EBADMACHO when the sequence is wrong.
20 # EXEC: cmd LC_SEGMENT_64
21 # EXEC: segname __PAGEZERO
23 # COMMON: cmd LC_SEGMENT_64
24 # COMMON: segname __TEXT
25 # COMMON: sectname __text
26 # COMMON: segname __TEXT
27 # COMMON: sectname __cstring
28 # COMMON: segname __TEXT
29 # COMMON: cmd LC_SEGMENT_64
30 # COMMON: segname __DATA_CONST
31 # COMMON: sectname __got
32 # COMMON: segname __DATA_CONST
33 # COMMON: sectname __const
34 # COMMON: segname __DATA_CONST
35 # COMMON: cmd LC_SEGMENT_64
36 # COMMON: segname __DATA
37 # COMMON: sectname __data
38 # COMMON: segname __DATA
39 # COMMON: cmd LC_SEGMENT_64
40 # COMMON: segname __LINKEDIT
41 # COMMON: cmd LC_DYLD_INFO_ONLY
42 # COMMON: cmd LC_SYMTAB
43 # COMMON: cmd LC_DYSYMTAB
45 # EXEC: cmd LC_LOAD_DYLINKER
46 # DYLIB: cmd LC_ID_DYLIB
48 # COMMON: cmd LC_UUID
49 # COMMON: cmd LC_BUILD_VERSION
51 # EXEC: cmd LC_MAIN
53 # COMMON: cmd LC_LOAD_DYLIB
55 .section __TEXT,__cstring
56 _str:
57 .asciz "Help me! I'm trapped in a test!\n"
59 .globl _mutable
60 .section __DATA,__data
61 mutable:
62 .long 0x1234
64 .globl _constant
65 .section __DATA,__const
66 constant:
67 .long 0x4567
69 .text
70 .global _main
71 _main:
72 mov ___nan@GOTPCREL(%rip), %rax
73 ret