mirror of
git://code.qt.io/qt/qt5.git
synced 2026-02-01 19:36:04 +08:00
Android, FFmpeg: Explicitly set page-size for patchelf
Android arm64 and x86_64 builds now require 16KB page size alignment in native binaries, this includes FFmpeg. When running patchelf on the binaries, it will implicitly re-align the affected sections to 4KB page size. This patch solves this by using the --page-size flag for patchelf, only for the builds that require it. Pick-to: 6.11 6.10 6.8 Fixes: QTBUG-142332 Change-Id: Iba88bf702fd075d2b4432d9cde94f779b14de52f Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
@@ -7,6 +7,7 @@ set -euox pipefail
|
||||
lib_dir="$1/lib"
|
||||
additional_suffix="${2:-}"
|
||||
set_rpath="${3:-yes}"
|
||||
page_size="${4:-}"
|
||||
|
||||
# readelf and patchelf are prerequisite tools for this script. Check
|
||||
# that they are available.
|
||||
@@ -81,7 +82,12 @@ for lib_name in "${ffmpeg_libs[@]}"; do
|
||||
stub_name="${stub_name%%.*}${additional_suffix}.${stub_name#*.}" # Add additional_suffix
|
||||
fi
|
||||
|
||||
patchelf --replace-needed "${BASH_REMATCH[1]}" "${stub_name}" "$lib_path"
|
||||
additional_command_args=""
|
||||
if [ -n "$page_size" ]; then
|
||||
additional_command_args+="--page-size ${page_size}"
|
||||
fi
|
||||
|
||||
patchelf ${additional_command_args} --replace-needed "${BASH_REMATCH[1]}" "${stub_name}" "$lib_path"
|
||||
fi
|
||||
done <<< "$(read_needed_deps)"
|
||||
|
||||
|
||||
@@ -116,7 +116,13 @@ build_ffmpeg_android() {
|
||||
|
||||
if [[ "$build_type" == "shared" ]]; then
|
||||
local fix_dependencies="${BASH_SOURCE%/*}/../shared/fix_ffmpeg_dependencies.sh"
|
||||
sudo "${fix_dependencies}" "${target_dir}" "${libs_prefix}" "no"
|
||||
|
||||
local page_size_arg=""
|
||||
if [ $page_size == "use_16kb_page_size" ]; then
|
||||
page_size_arg="16384"
|
||||
fi
|
||||
|
||||
sudo "${fix_dependencies}" "${target_dir}" "${libs_prefix}" "no" "$page_size_arg"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user