Skip to content

Commit

Permalink
Pass original multi_os_dir to iterator.
Browse files Browse the repository at this point in the history
This is needed for callbacks that use that directory to look inside
GCC internal directories, e.g. moving the libraries. This broke
when I made libexpat for target honor ${CT_SHARED_LIBS}.

Signed-off-by: Alexey Neyman <stilor@att.net>
  • Loading branch information
stilor committed Dec 17, 2016
1 parent 53758f3 commit b1ac2e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
5 changes: 3 additions & 2 deletions scripts/build/cc/100-gcc.sh
Expand Up @@ -787,8 +787,9 @@ gcc_movelibs() {
eval "${arg// /\\ }"
done

# Move only files, directories are for other multilibs
gcc_dir="${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_os_dir}"
# Move only files, directories are for other multilibs. We're looking inside
# GCC's directory structure, thus use unmangled multi_os_dir that GCC reports.
gcc_dir="${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_os_dir_gcc}"
if [ ! -d "${gcc_dir}" ]; then
# GCC didn't install anything outside of sysroot
return
Expand Down
21 changes: 13 additions & 8 deletions scripts/functions
Expand Up @@ -1558,21 +1558,22 @@ CT_KconfigDeleteOption() {
# Multilib iterator. The caller should be in a directory where the directories
# will be created, one per multilib, and the specified command will be run in
# each of them. The following arguments will be passed to the invoked command:
# multi_flags CFLAGS for this multilib
# multi_dir GCC internal library location for the multilib
# multi_os_dir OS library location for the multilib
# multi_root Sysroot for this multilib
# multi_target Target tuple, either as reported by GCC or by our guesswork
# multi_count Total number of multilibs
# multi_index Index of the current multilib
# multi_flags CFLAGS for this multilib
# multi_dir GCC internal library location for the multilib
# multi_os_dir OS library location for the multilib
# multi_os_dir_gcc Same as multi_os_dir, preserved from GCC output
# multi_root Sysroot for this multilib
# multi_target Target tuple, either as reported by GCC or by our guesswork
# multi_count Total number of multilibs
# multi_index Index of the current multilib
# Any additional arguments passed to this function will be forwarded to the called
# function as well.
# Usage: CT_IterateMultilibs <function> <prefix> <additional-args...>
CT_IterateMultilibs() {
local func="${1}"
local prefix="${2}"
local -a multilibs
local multi_dir multi_os_dir multi_root multi_flags multi_index multi_target
local multi_dir multi_os_dir multi_os_dir_gcc multi_root multi_flags multi_index multi_target
local root_suffix
local dir_postfix

Expand Down Expand Up @@ -1617,6 +1618,9 @@ CT_IterateMultilibs() {
# will work. If not, we'll supply both multi_root/multi_os_dir (which will
# likely break later, e.g. while building final GCC with C++ support). But,
# we've done all we can.
# We do supply original multi_os_dir for consumers that need to look inside
# GCC's directories (e.g. to locate the libraries), under the name of
# multi_os_dir_gcc.
multi_flags=$( echo "${multilib#*;}" | sed -r -e 's/@/ -/g;' )
multi_dir="${multilib%%;*}"
multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory ${multi_flags} )
Expand All @@ -1640,6 +1644,7 @@ CT_IterateMultilibs() {
multi_flags=$( echo "${multilib#*;}" | sed -r -e 's/@/ -/g;' )
multi_dir="${multilib%%;*}"
multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory ${multi_flags} )
multi_os_dir_gcc="${multi_os_dir}"
multi_root=$( "${CT_TARGET}-gcc" -print-sysroot ${multi_flags} )
multi_target=$( "${CT_TARGET}-gcc" -print-multiarch ${multi_flags} )
root_suffix="${multi_root#${CT_SYSROOT_DIR}}"
Expand Down

0 comments on commit b1ac2e7

Please sign in to comment.