Merge remote-tracking branch 'upstream/master' into staging

This commit is contained in:
John Ericson
2018-09-25 14:20:27 -04:00
164 changed files with 4068 additions and 2882 deletions
@@ -7,21 +7,7 @@ gatherLibraries() {
addEnvHooks "$targetOffset" gatherLibraries
isExecutable() {
[ "$(file -b -N --mime-type "$1")" = application/x-executable ]
}
findElfs() {
find "$1" -type f -exec "$SHELL" -c '
while [ -n "$1" ]; do
mimeType="$(file -b -N --mime-type "$1")"
if [ "$mimeType" = application/x-executable \
-o "$mimeType" = application/x-pie-executable \
-o "$mimeType" = application/x-sharedlib ]; then
echo "$1"
fi
shift
done
' -- {} +
readelf -h "$1" 2> /dev/null | grep -q '^ *Type: *EXEC\>'
}
# We cache dependencies so that we don't need to search through all of them on
@@ -167,9 +153,14 @@ autoPatchelf() {
# findDependency outside of this, the dependency cache needs to be rebuilt
# from scratch, so keep this in mind if you want to run findDependency
# outside of this function.
findElfs "$prefix" | while read -r elffile; do
autoPatchelfFile "$elffile"
done
while IFS= read -r -d $'\0' file; do
isELF "$file" || continue
if isExecutable "$file"; then
# Skip if the executable is statically linked.
readelf -l "$file" | grep -q "^ *INTERP\\>" || continue
fi
autoPatchelfFile "$file"
done < <(find "$prefix" -type f -print0)
}
# XXX: This should ultimately use fixupOutputHooks but we currently don't have