1 ## This test checks updating a dependent shared library install name in a MachO binary.
3 # RUN: yaml2obj %s -o %t
5 ## Specifying -change once:
7 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/long/long/dylib/LOAD %t.copy
8 # RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE --implicit-check-not='name /usr'
10 # CHANGE: name /usr/long/long/dylib/LOAD
11 # CHANGE: name /usr/dylib/WEAK
13 ## Specifying -change multiple times:
15 # RUN: llvm-install-name-tool -change /usr/dylib/WEAK /usr/sh/WEAK \
16 # RUN: -change /usr/dylib/LOAD /usr/sh/LOAD %t.copy
17 # RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-MULTIPLE --implicit-check-not='name /usr'
19 # CHANGE-MULTIPLE: name /usr/sh/LOAD
20 # CHANGE-MULTIPLE: name /usr/sh/WEAK
22 ## Changing same dependent library name multiple times:
24 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/LOAD \
25 # RUN: -change /usr/dylib/LOAD /usr/XXXX %t.copy
26 # RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-REPEAT --implicit-check-not='name /usr'
28 # CHANGE-REPEAT: name /usr/LOAD
29 # CHANGE-REPEAT: name /usr/dylib/WEAK
31 ## Specifying dependent library names in a chain:
33 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/XX/LOAD \
34 # RUN: -change /usr/XX/LOAD /usr/YY/LOAD %t.copy
35 # RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-CHAIN --implicit-check-not='name /usr'
37 # CHANGE-CHAIN: name /usr/XX/LOAD
38 # CHANGE-CHAIN: name /usr/dylib/WEAK
40 ## Changing multiple dependent library names where one exists and the other doesn't:
42 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/JOJO/LOAD \
43 # RUN: -change /usr/BIZARRE /usr/KOKO/LOAD %t.copy
44 # RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-SWITCH --implicit-check-not='name /usr'
46 # CHANGE-SWITCH: name /usr/JOJO/LOAD
47 # CHANGE-SWITCH: name /usr/dylib/WEAK
49 ## Changing to a common dependent library name:
51 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/COMMON \
52 # RUN: -change /usr/dylib/WEAK /usr/COMMON %t.copy
53 # RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-COMMON --implicit-check-not='name /usr'
55 # CHANGE-COMMON: name /usr/COMMON
56 # CHANGE-COMMON: name /usr/COMMON
58 ## Change all common dependent library names at once:
59 # RUN: llvm-install-name-tool -change /usr/COMMON /usr/ONCE %t.copy
60 # RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-ONCE --implicit-check-not='name /usr'
62 # CHANGE-ONCE: name /usr/ONCE
63 # CHANGE-ONCE: name /usr/ONCE
65 ## Check that -change option has no effect if the binary doesn't contain old install name:
67 # RUN: llvm-install-name-tool -change /usr/JOJO/LOAD /usr/XX/LOAD \
68 # RUN: -change /usr/KOKO/WEAK /usr/YY/WEAK %t
71 ## Missing a -change argument:
72 # RUN: not llvm-install-name-tool %t -change /usr/ONCE 2>&1 | \
73 # RUN: FileCheck %s --check-prefix=MISSING
75 ## Missing both -change arguments:
76 # RUN: not llvm-install-name-tool %t -change 2>&1 | \
77 # RUN: FileCheck %s --check-prefix=MISSING
79 # MISSING: missing argument to -change option
85 cpusubtype: 0x00000003
97 current_version: 82115073
98 compatibility_version: 65536
99 Content: '/usr/dylib/LOAD'
100 - cmd: LC_LOAD_WEAK_DYLIB
105 current_version: 82115073
106 compatibility_version: 65536
107 Content: '/usr/dylib/WEAK'