1## This test checks prepending a new LC_RPATH load command to a MachO binary. 2 3# RUN: yaml2obj %p/Inputs/i386.yaml -o %t.i386 4# RUN: llvm-install-name-tool -add_rpath @executable_path/. %t.i386 5# RUN: llvm-install-name-tool -prepend_rpath first_rpath %t.i386 6# RUN: llvm-objdump -p %t.i386 | FileCheck --check-prefix=NEW-RPATH %s 7 8# RUN: yaml2obj %p/Inputs/x86_64.yaml -o %t.x86_64 9# RUN: llvm-install-name-tool -add_rpath @executable_path/. %t.x86_64 10# RUN: llvm-install-name-tool -prepend_rpath first_rpath %t.x86_64 11# RUN: llvm-objdump -p %t.x86_64 | FileCheck --check-prefix=NEW-RPATH %s 12 13# NEW-RPATH: cmd LC_RPATH 14# NEW-RPATH-NEXT: cmdsize 15# NEW-RPATH-NEXT: first_rpath 16 17# NEW-RPATH: cmd LC_RPATH 18# NEW-RPATH-NEXT: cmdsize 19# NEW-RPATH-NEXT: @executable_path/. 20 21## Prepend with dylib loads: 22# RUN: yaml2obj %p/Inputs/strip-all.yaml -o %t.dylib 23# RUN: llvm-install-name-tool -prepend_rpath first_rpath %t.dylib 24# RUN: llvm-objdump -p %t.dylib | FileCheck --check-prefix=DYLIB %s 25 26# DYLIB: cmd LC_RPATH 27# DYLIB-NEXT: cmdsize 28# DYLIB-NEXT: first_rpath 29 30# RUN: not llvm-install-name-tool -prepend_rpath first_rpath %t.i386 2>&1 | \ 31# RUN: FileCheck --check-prefix=DUPLICATE-RPATH %s 32 33# DUPLICATE-RPATH: rpath 'first_rpath' would create a duplicate load command 34 35## Prepend same RPATH twice: 36# RUN: not llvm-install-name-tool -prepend_rpath @executable_X \ 37# RUN: -prepend_rpath @executable_X %t.i386 2>&1 | \ 38# RUN: FileCheck --check-prefix=DOUBLE %s 39 40# DOUBLE: rpath '@executable_X' would create a duplicate load command 41 42## Prepend and delete RPATH: 43# RUN: not llvm-install-name-tool -prepend_rpath foo \ 44# RUN: -delete_rpath foo %t.i386 2>&1 | \ 45# RUN: FileCheck --check-prefix=DELETE %s 46 47# DELETE: cannot specify both -prepend_rpath 'foo' and -delete_rpath 'foo' 48 49## Prepend and replace RPATH: 50# RUN: not llvm-install-name-tool -prepend_rpath foo \ 51# RUN: -rpath foo bar %t.i386 2>&1 | \ 52# RUN: FileCheck --check-prefix=REPLACE %s 53 54# REPLACE: cannot specify both -prepend_rpath 'foo' and -rpath 'foo' 'bar' 55 56## Check that cmdsize accounts for NULL terminator: 57# RUN: yaml2obj %p/Inputs/x86_64.yaml -o %t.x86_64 58# RUN: llvm-install-name-tool -prepend_rpath abcd %t.x86_64 59# RUN: llvm-objdump -p %t.x86_64 | FileCheck %s --check-prefix=RPATH-SIZE 60 61# RPATH-SIZE: cmd LC_RPATH 62# RPATH-SIZE-NEXT: cmdsize 24 63# RPATH-SIZE-NEXT: path abcd 64