91 lines · plain
1## This test checks deleting a LC_RPATH load command from a MachO binary.2 3# RUN: yaml2obj %s -o %t4 5## Deleting a single RPath entry:6# RUN: llvm-install-name-tool -delete_rpath @executable_a/. %t7# RUN: llvm-objdump -p %t | \8# RUN: FileCheck %s --check-prefix=RPATHS --implicit-check-not=@executable9 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/. %t18# RUN: llvm-objdump -p %t | \19# RUN: FileCheck %s --check-prefix=RPATHS-MULTIPLE --implicit-check-not=@executable20 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/. %t27# RUN: llvm-objdump -p %t | \28# RUN: FileCheck %s --check-prefix=DUPLICATE --implicit-check-not=@executable29 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-RPATH35 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=COMBINED42 43# COMBINED: cannot specify both -add_rpath '@executable_b/.' and -delete_rpath '@executable_b/.'44 45## Remove all RPATHS46# RUN: yaml2obj %s -o %t247# RUN: llvm-install-name-tool -delete_all_rpaths %t248# RUN: llvm-objdump -p %t2 | FileCheck %s49 50# CHECK-NOT: LC_RPATH51 52## Remove all RPATHS and add a new one.53# RUN: yaml2obj %s -o %t354# RUN: llvm-install-name-tool --delete_all_rpaths -add_rpath @executable_b/. %t355# RUN: llvm-objdump -p %t3 | \56# RUN: FileCheck %s --check-prefix=DELETE_AND_ADD --implicit-check-not=@executable57 58# DELETE_AND_ADD: @executable_b/.59 60--- !mach-o61FileHeader:62 magic: 0xFEEDFACF63 cputype: 0x0100000764 cpusubtype: 0x0000000365 filetype: 0x0000000166 ncmds: 567 sizeofcmds: 16068 flags: 0x0000200069 reserved: 0x0000000070LoadCommands:71 - cmd: LC_RPATH72 cmdsize: 3273 path: 1274 Content: '@executable_a/.'75 - cmd: LC_RPATH76 cmdsize: 3277 path: 1278 Content: '@executable_b/.'79 - cmd: LC_RPATH80 cmdsize: 3281 path: 1282 Content: '@executable_c/.'83 - cmd: LC_RPATH84 cmdsize: 3285 path: 1286 Content: '@executable_d/.'87 - cmd: LC_RPATH88 cmdsize: 3289 path: 1290 Content: '@executable_e/.'91