1## This test checks deleting a LC_RPATH load command from a MachO binary. 2 3# RUN: yaml2obj %s -o %t 4 5## Deleting a single RPath entry: 6# RUN: llvm-install-name-tool -delete_rpath @executable_a/. %t 7# RUN: llvm-objdump -p %t | \ 8# RUN: FileCheck %s --check-prefix=RPATHS --implicit-check-not=@executable 9 10# RPATHS: @executable_b/. 11# RPATHS: @executable_c/. 12# RPATHS: @executable_d/. 13# RPATHS: @executable_e/. 14 15## Deleting multiple RPath entries: 16# RUN: llvm-install-name-tool -delete_rpath @executable_b/. \ 17# RUN: -delete_rpath @executable_c/. %t 18# RUN: llvm-objdump -p %t | \ 19# RUN: FileCheck %s --check-prefix=RPATHS-MULTIPLE --implicit-check-not=@executable 20 21# RPATHS-MULTIPLE: @executable_d/. 22# RPATHS-MULTIPLE: @executable_e/. 23 24## Duplicate delete_rpath commands: 25# RUN: llvm-install-name-tool -delete_rpath @executable_d/. \ 26# RUN: -delete_rpath @executable_d/. %t 27# RUN: llvm-objdump -p %t | \ 28# RUN: FileCheck %s --check-prefix=DUPLICATE --implicit-check-not=@executable 29 30# DUPLICATE: @executable_e/. 31 32## Deleting a nonexistent RPath: 33# RUN: not llvm-install-name-tool -delete_rpath @executable_a/. %t 2>&1 | \ 34# RUN: FileCheck %s --check-prefix=ABSENT-RPATH 35 36# ABSENT-RPATH: no LC_RPATH load command with path: @executable_a/. 37 38## Adding and deleting RPATH at the same time: 39# RUN: not llvm-install-name-tool -add_rpath @executable_b/. \ 40# RUN: -delete_rpath @executable_b/. %t 2>&1 | \ 41# RUN: FileCheck %s --check-prefix=COMBINED 42 43# COMBINED: cannot specify both -add_rpath '@executable_b/.' and -delete_rpath '@executable_b/.' 44 45## Remove all RPATHS 46# RUN: yaml2obj %s -o %t2 47# RUN: llvm-install-name-tool -delete_all_rpaths %t2 48# RUN: llvm-objdump -p %t2 | FileCheck %s 49 50# CHECK-NOT: LC_RPATH 51 52## Remove all RPATHS and add a new one. 53# RUN: yaml2obj %s -o %t3 54# RUN: llvm-install-name-tool --delete_all_rpaths -add_rpath @executable_b/. %t3 55# RUN: llvm-objdump -p %t3 | \ 56# RUN: FileCheck %s --check-prefix=DELETE_AND_ADD --implicit-check-not=@executable 57 58# DELETE_AND_ADD: @executable_b/. 59 60--- !mach-o 61FileHeader: 62 magic: 0xFEEDFACF 63 cputype: 0x01000007 64 cpusubtype: 0x00000003 65 filetype: 0x00000001 66 ncmds: 5 67 sizeofcmds: 160 68 flags: 0x00002000 69 reserved: 0x00000000 70LoadCommands: 71 - cmd: LC_RPATH 72 cmdsize: 32 73 path: 12 74 Content: '@executable_a/.' 75 - cmd: LC_RPATH 76 cmdsize: 32 77 path: 12 78 Content: '@executable_b/.' 79 - cmd: LC_RPATH 80 cmdsize: 32 81 path: 12 82 Content: '@executable_c/.' 83 - cmd: LC_RPATH 84 cmdsize: 32 85 path: 12 86 Content: '@executable_d/.' 87 - cmd: LC_RPATH 88 cmdsize: 32 89 path: 12 90 Content: '@executable_e/.' 91