annotate lld/test/MachO/load-commands.s @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 2e18cbf3894f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 # REQUIRES: x86
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
2 # RUN: rm -rf %t && mkdir -p %t
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
4 # RUN: %lld -o %t/executable %t/test.o
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
5 # RUN: %lld -execute -o %t/explicit-executable %t/test.o
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
6 # RUN: %lld -bundle -o %t/bundle %t/test.o
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
7 # RUN: %lld -dylib -o %t/dylib %t/test.o
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
9 ## These load commands should be in every final output binary.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
10 # COMMON-DAG: cmd LC_DYLD_INFO_ONLY
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
11 # COMMON-DAG: cmd LC_SYMTAB
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
12 # COMMON-DAG: cmd LC_DYSYMTAB
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
13 # COMMON-DAG: cmd LC_UUID
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 ## Check for the presence of load commands that are essential for a working
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
16 ## executable. Also check that it has the right filetype.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
17 # RUN: llvm-objdump --macho --all-headers %t/executable | FileCheck %s --check-prefix=COMMON
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
18 # RUN: llvm-objdump --macho --all-headers %t/executable | FileCheck %s --check-prefix=EXEC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
19 # RUN: llvm-objdump --macho --all-headers %t/explicit-executable | FileCheck %s --check-prefix=COMMON
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
20 # RUN: llvm-objdump --macho --all-headers %t/explicit-executable | FileCheck %s --check-prefix=EXEC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
21 # EXEC: magic cputype cpusubtype caps filetype
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
22 # EXEC-NEXT: MH_MAGIC_64 X86_64 ALL {{.*}} EXECUTE
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
23 # EXEC-DAG: cmd LC_MAIN
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
24 # EXEC-DAG: cmd LC_LOAD_DYLINKER
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 ## Check for the absence of load commands that should not be in an executable.
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
27 # RUN: llvm-objdump --macho --all-headers %t/executable | FileCheck %s --check-prefix=NEXEC
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
28 # NEXEC-NOT: cmd: LC_ID_DYLIB
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
29
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
30 ## Check for the presence / absence of load commands for the dylib.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
31 # RUN: llvm-objdump --macho --all-headers %t/dylib | FileCheck %s --check-prefix=COMMON
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
32 # RUN: llvm-objdump --macho --all-headers %t/dylib | FileCheck %s --check-prefix=DYLIB
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
33 # DYLIB: magic cputype cpusubtype caps filetype
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
34 # DYLIB-NEXT: MH_MAGIC_64 X86_64 ALL {{.*}} DYLIB
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
35 # DYLIB: cmd LC_ID_DYLIB
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
36
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
37 # RUN: llvm-objdump --macho --all-headers %t/bundle | FileCheck %s --check-prefix=NDYLIB
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
38 # NDYLIB-NOT: cmd: LC_MAIN
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
39 # NDYLIB-NOT: cmd: LC_LOAD_DYLINKER
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
40
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
41 ## Check for the presence / absence of load commands for the bundle.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
42 # RUN: llvm-objdump --macho --all-headers %t/bundle | FileCheck %s --check-prefix=COMMON
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
43 # RUN: llvm-objdump --macho --all-headers %t/bundle | FileCheck %s --check-prefix=BUNDLE
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
44 # BUNDLE: magic cputype cpusubtype caps filetype
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
45 # BUNDLE-NEXT: MH_MAGIC_64 X86_64 ALL {{.*}} BUNDLE
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
46
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
47 # RUN: llvm-objdump --macho --all-headers %t/bundle | FileCheck %s --check-prefix=NBUNDLE
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
48 # NBUNDLE-NOT: cmd: LC_MAIN
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
49 # NBUNDLE-NOT: cmd: LC_LOAD_DYLINKER
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 .text
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 .global _main
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 _main:
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 mov $0, %rax
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 ret