blob: eb29d26be934595d758615c9b3b711e12491b57e [file] [log] [blame]
Sameer Aroraca518c42020-06-30 11:01:45 -07001## This test checks updating a dynamic shared library ID in a MachO binary.
2
3# RUN: yaml2obj %s --docnum=1 -o %t
4
5## Specifying -id once:
6# RUN: llvm-install-name-tool -id /usr/lib/A_long_long_test %t
Shoaib Meenai5f56da32020-06-30 17:20:00 -07007# RUN: llvm-objdump -p %t | FileCheck %s --check-prefix=ID --implicit-check-not='name /usr'
Sameer Aroraca518c42020-06-30 11:01:45 -07008
Shoaib Meenai5f56da32020-06-30 17:20:00 -07009# ID: name /usr/lib/A_long_long_test
Sameer Aroraca518c42020-06-30 11:01:45 -070010
11## Specifying -id more than once:
12# RUN: llvm-install-name-tool -id /usr/lib/B_long -id /usr/lib/K_long -id /usr/A_short %t
Shoaib Meenai5f56da32020-06-30 17:20:00 -070013# RUN: llvm-objdump -p %t | FileCheck %s --check-prefix=ID-MULTIPLE --implicit-check-not='name /usr'
Sameer Aroraca518c42020-06-30 11:01:45 -070014
Shoaib Meenai5f56da32020-06-30 17:20:00 -070015# ID-MULTIPLE: name /usr/A_short
Sameer Aroraca518c42020-06-30 11:01:45 -070016
17## Specifying -id with empty string:
18# RUN: not llvm-install-name-tool -id '' %t 2>&1 | \
19# RUN: FileCheck %s --check-prefix=EMPTY
20
21# EMPTY: cannot specify an empty id
22
23## Missing id argument:
24# RUN: not llvm-install-name-tool %t -id 2>&1 | \
25# RUN: FileCheck %s --check-prefix=MISSING
26
27# MISSING: missing argument to -id option
28
29## Shared dylib binary
30--- !mach-o
31FileHeader:
32 magic: 0xFEEDFACF
33 cputype: 0x01000007
34 cpusubtype: 0x00000003
35 filetype: 0x00000006
36 ncmds: 1
37 sizeofcmds: 56
38 flags: 0x00002000
39 reserved: 0x00000000
40LoadCommands:
41 - cmd: LC_ID_DYLIB
42 cmdsize: 56
43 dylib:
44 name: 24
45 timestamp: 2
46 current_version: 82115073
47 compatibility_version: 65536
48 PayloadString: '/usr/lib/A'
49
50# RUN: yaml2obj %s --docnum=2 -o %t
51
52## Check that -id option has no effect if binary is not a shared dylib:
53# RUN: cp %t %t1
54# RUN: llvm-install-name-tool -id /usr/lib/J %t
55# RUN: cmp %t %t1
56
57## Executable binary
58--- !mach-o
59FileHeader:
60 magic: 0xFEEDFACF
61 cputype: 0x01000007
62 cpusubtype: 0x00000003
63 filetype: 0x00000001
64 ncmds: 0
65 sizeofcmds: 0
66 flags: 0x00002000
67 reserved: 0x00000000