1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3
4# RUN: not %lld -o %t/executable %t.o -o /dev/null \
5# RUN:     -compatibility_version 10 -current_version 11 2>&1 | \
6# RUN:     FileCheck --check-prefix=NEEDDYLIB %s
7# RUN: not %lld -execute -o %t/executable %t.o -o /dev/null \
8# RUN:     -compatibility_version 10 -current_version 11 2>&1 | \
9# RUN:     FileCheck --check-prefix=NEEDDYLIB %s
10# RUN: not %lld -bundle -o %t/executable %t.o -o /dev/null \
11# RUN:     -compatibility_version 10 -current_version 11 2>&1 | \
12# RUN:     FileCheck --check-prefix=NEEDDYLIB %s
13
14# NEEDDYLIB: error: -compatibility_version 10: only valid with -dylib
15# NEEDDYLIB: error: -current_version 11: only valid with -dylib
16
17# RUN: not %lld -dylib -o %t/executable %t.o -o /dev/null \
18# RUN:     -compatibility_version 1.2.3.4 -current_version 1.2.3.4.5 2>&1 | \
19# RUN:     FileCheck --check-prefix=MALFORMED %s
20
21# MALFORMED: error: -compatibility_version 1.2.3.4: malformed version
22# MALFORMED: error: -current_version 1.2.3.4.5: malformed version
23
24# RUN: not %lld -dylib -o %t/executable %t.o -o /dev/null \
25# RUN:     -compatibility_version 80000.1 -current_version 1.2.3 2>&1 | \
26# RUN:     FileCheck --check-prefix=BADMAJOR %s
27
28# BADMAJOR: error: -compatibility_version 80000.1: malformed version
29
30# RUN: not %lld -dylib -o %t/executable %t.o -o /dev/null \
31# RUN:     -compatibility_version 8.300 -current_version 1.2.3 2>&1 | \
32# RUN:     FileCheck --check-prefix=BADMINOR %s
33
34# BADMINOR: error: -compatibility_version 8.300: malformed version
35
36# RUN: not %lld -dylib -o %t/executable %t.o -o /dev/null \
37# RUN:     -compatibility_version 8.8.300 -current_version 1.2.3 2>&1 | \
38# RUN:     FileCheck --check-prefix=BADSUBMINOR %s
39
40# BADSUBMINOR: error: -compatibility_version 8.8.300: malformed version
41
42# RUN: %lld -dylib -o %t/executable %t.o -o %t.dylib \
43# RUN:     -compatibility_version 1.2.3 -current_version 2.5.6
44# RUN: llvm-objdump --macho --all-headers %t.dylib | FileCheck %s
45
46# CHECK:      cmd LC_ID_DYLIB
47# CHECK-NEXT: cmdsize
48# CHECK-NEXT: name
49# CHECK-NEXT: time stamp
50# CHECK-NEXT: current version 2.5.6
51# CHECK-NEXT: compatibility version 1.2.3
52
53.text
54.global _foo
55_foo:
56  mov $0, %rax
57  ret
58