build_packages, build_image_util.sh: fix up liblto symlink

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
This commit is contained in:
Thilo Fromm 2020-11-13 13:37:20 +01:00
parent 5201aee4a3
commit 22b08b0ae4
3 changed files with 24 additions and 0 deletions

View File

@ -153,6 +153,8 @@ emerge_to_image() {
# Make sure profile.env has been generated
sudo -E ROOT="${root_fs_dir}" env-update --no-ldconfig
fixup_liblto_softlinks "$root_fs_dir"
# TODO(marineam): just call ${BUILD_LIBRARY_DIR}/check_root directly once
# all tests are fatal, for now let the old function skip soname errors.
ROOT="${root_fs_dir}" PORTAGE_CONFIGROOT="${BUILD_DIR}"/configroot \

View File

@ -252,6 +252,8 @@ fi
eclean-$BOARD -d packages
fixup_liblto_softlinks "${BOARD_ROOT}"
info "Checking build root"
test_image_content "${BOARD_ROOT}"

View File

@ -966,3 +966,23 @@ clean_qemu_static() {
*) die "Unsupported arch" ;;
esac
}
# Fix up liblto softlink created by gcc-config
fixup_liblto_softlinks() {
local root="$1"
info "fixup_liblto_softlinks: Looking for broken softlinks in '${root}'"
local link
local target
# check both native (/usr/CHOST/) as well as cross compile (/usr/CHOST/CTARGET) paths
{ ls -l "${root}/"usr/*/binutils-bin/lib/bfd-plugins/liblto_plugin.so 2>/dev/null;
ls -l "${root}/"usr/*/*/binutils-bin/lib/bfd-plugins/liblto_plugin.so 2>/dev/null; } \
| sed 's:.* \([^[:space:]]\+\) -> \([^[:space:]]\+\):\1 \2:' \
| while read link target; do
local newtarget=$(echo "$target" | sed "s:${root}:/:")
info " Fixing up broken $link -> $target"
info " sudo ln -sf $newtarget $link"
sudo ln -sf $newtarget $link
done
}