64 lines · plain
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.i3864# RUN: llvm-install-name-tool -add_rpath @executable_path/. %t.i3865# RUN: llvm-install-name-tool -prepend_rpath first_rpath %t.i3866# RUN: llvm-objdump -p %t.i386 | FileCheck --check-prefix=NEW-RPATH %s7 8# RUN: yaml2obj %p/Inputs/x86_64.yaml -o %t.x86_649# RUN: llvm-install-name-tool -add_rpath @executable_path/. %t.x86_6410# RUN: llvm-install-name-tool -prepend_rpath first_rpath %t.x86_6411# RUN: llvm-objdump -p %t.x86_64 | FileCheck --check-prefix=NEW-RPATH %s12 13# NEW-RPATH: cmd LC_RPATH14# NEW-RPATH-NEXT: cmdsize15# NEW-RPATH-NEXT: first_rpath16 17# NEW-RPATH: cmd LC_RPATH18# NEW-RPATH-NEXT: cmdsize19# NEW-RPATH-NEXT: @executable_path/.20 21## Prepend with dylib loads:22# RUN: yaml2obj %p/Inputs/strip-all.yaml -o %t.dylib23# RUN: llvm-install-name-tool -prepend_rpath first_rpath %t.dylib24# RUN: llvm-objdump -p %t.dylib | FileCheck --check-prefix=DYLIB %s25 26# DYLIB: cmd LC_RPATH27# DYLIB-NEXT: cmdsize28# DYLIB-NEXT: first_rpath29 30# RUN: not llvm-install-name-tool -prepend_rpath first_rpath %t.i386 2>&1 | \31# RUN: FileCheck --check-prefix=DUPLICATE-RPATH %s32 33# DUPLICATE-RPATH: rpath 'first_rpath' would create a duplicate load command34 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 %s39 40# DOUBLE: rpath '@executable_X' would create a duplicate load command41 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 %s46 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 %s53 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_6458# RUN: llvm-install-name-tool -prepend_rpath abcd %t.x86_6459# RUN: llvm-objdump -p %t.x86_64 | FileCheck %s --check-prefix=RPATH-SIZE60 61# RPATH-SIZE: cmd LC_RPATH62# RPATH-SIZE-NEXT: cmdsize 2463# RPATH-SIZE-NEXT: path abcd64