-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add target libraries/executables to executable's RPATH
- Loading branch information
Showing
6 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
crt/link.stub | ||
crt/prelink.stub | ||
nvcc.profile | ||
patchelf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
[[ ${target_platform} == "linux-64" ]] && targetsDir="targets/x86_64-linux" | ||
[[ ${target_platform} == "linux-ppc64le" ]] && targetsDir="targets/ppc64le-linux" | ||
[[ ${target_platform} == "linux-aarch64" ]] && targetsDir="targets/sbsa-linux" | ||
|
||
errors="" | ||
|
||
for item in `find ${PREFIX}/bin -type f`; do | ||
filename=$(basename "${item}") | ||
echo "Artifact to test: ${filename}" | ||
|
||
if grep -qx "${filename}" patchelf_exclude.txt; then | ||
echo Skipping ${filename} as it is not subject to testing | ||
continue | ||
fi | ||
|
||
pkg_info=$(conda package -w "${item}") | ||
echo "\$PKG_NAME: ${PKG_NAME}" | ||
echo "\$pkg_info: ${pkg_info}" | ||
|
||
if [[ ! "$pkg_info" == *"$PKG_NAME"* ]]; then | ||
echo "Not a match, skipping ${item}" | ||
continue | ||
fi | ||
|
||
echo "Match found, testing ${item}" | ||
|
||
rpath=$(patchelf --print-rpath "${item}") | ||
echo "${item} rpath: ${rpath}" | ||
|
||
if [[ ${item} =~ /bin/ && $rpath != "\$ORIGIN/../lib:\$ORIGIN/../${targetsDir}/lib" ]]; then | ||
errors+="${item}\n" | ||
elif [[ $(objdump -x ${item} | grep "PATH") == *"RUNPATH"* ]]; then | ||
errors+="${item}\n" | ||
fi | ||
done | ||
|
||
if [[ $errors ]]; then | ||
echo "The following items were found with an unexpected RPATH:" | ||
echo -e "${errors}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
[[ ${target_platform} == "linux-64" ]] && targetsDir="targets/x86_64-linux" | ||
[[ ${target_platform} == "linux-ppc64le" ]] && targetsDir="targets/ppc64le-linux" | ||
[[ ${target_platform} == "linux-aarch64" ]] && targetsDir="targets/sbsa-linux" | ||
|
||
errors="" | ||
|
||
for item in `find ${PREFIX}/nvvm/bin -type f`; do | ||
filename=$(basename "${item}") | ||
echo "Artifact to test: ${filename}" | ||
|
||
pkg_info=$(conda package -w "${item}") | ||
echo "\$PKG_NAME: ${PKG_NAME}" | ||
echo "\$pkg_info: ${pkg_info}" | ||
|
||
if [[ ! "$pkg_info" == *"$PKG_NAME"* ]]; then | ||
echo "Not a match, skipping ${item}" | ||
continue | ||
fi | ||
|
||
echo "Match found, testing ${item}" | ||
|
||
rpath=$(patchelf --print-rpath "${item}") | ||
echo "${item} rpath: ${rpath}" | ||
|
||
if [[ ${item} =~ /nvvm/bin/ && $rpath != "\$ORIGIN/../lib64:\$ORIGIN/../../lib:\$ORIGIN/../../${targetsDir}/lib" ]]; then | ||
errors+="${item}\n" | ||
# lib64/libnvvm.so patching is being skipped so let's not test it | ||
#elif [[ ${item} =~ nvvm/lib64/ && $rpath != "\$ORIGIN" ]]; then | ||
# errors+="${item}\n" | ||
elif [[ $(objdump -x ${item} | grep "PATH") == *"RUNPATH"* ]]; then | ||
errors+="${item}\n" | ||
fi | ||
done | ||
|
||
if [[ $errors ]]; then | ||
echo "The following items were found with an unexpected RPATH:" | ||
echo -e "${errors}" | ||
exit 1 | ||
fi |