From dbcf9d6015bfbfae767b64aa11ba553ac105cc81 Mon Sep 17 00:00:00 2001 From: Riku Voipio Date: Wed, 22 Jul 2009 18:08:09 +0300 Subject: [PATCH] support different gcc search patchs On many crosscompilers ld/as/etc are not installed in same dir as gcc. They get run in sb2 without argv mangling. Without mangling -rpath-link gets not passed, and recursive linking fails. in sb2-config-gcc-toolchain ask gcc where it searches for progs and use that list for gcc component path map on argvenvp mapping. Signed-off-by: Riku Voipio Signed-off-by: Lauri Aarnio --- lua_scripts/argvenvp_gcc.lua | 30 +++++++++++++++++++++--------- utils/sb2-config-gcc-toolchain | 4 ++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/lua_scripts/argvenvp_gcc.lua b/lua_scripts/argvenvp_gcc.lua index 26ee3bde..e68b0c17 100644 --- a/lua_scripts/argvenvp_gcc.lua +++ b/lua_scripts/argvenvp_gcc.lua @@ -60,16 +60,28 @@ function register_gcc_component_path(tmp, gccrule) -- 2. note that cross_gcc_dir is not empty, this file -- won't be loaded at all if it is (see argvenvp.lua), -- 3. Wrappers for host-* tools live in /sb2/wrappers. - if gccrule == nil or gccrule.cross_gcc_dir == nil then - tmp.path_prefixes = generic_gcc_tools_path_prefixes - else - local gcc_tools_path_prefixes = { - "/usr/bin/", - gccrule.cross_gcc_dir, - "/sb2/" - } - tmp.path_prefixes = gcc_tools_path_prefixes + local gcc_tools_path_prefixes = {} + + -- lua array copy wtf + for j,x in ipairs(generic_gcc_tools_path_prefixes) do + table.insert(gcc_tools_path_prefixes, x) + end + + if gccrule == nil then + return + end + + if gccrule.cross_gcc_dir ~= nil then + table.insert(gcc_tools_path_prefixes, gccrule.cross_gcc_dir) end + + if gccrule.cross_gcc_progs_path ~= nil then + for path in string.gmatch(gccrule.cross_gcc_progs_path,"[^:]+") do + table.insert(gcc_tools_path_prefixes, path) + end + end + + tmp.path_prefixes = gcc_tools_path_prefixes argvmods[tmp.name] = tmp end diff --git a/utils/sb2-config-gcc-toolchain b/utils/sb2-config-gcc-toolchain index 63723d7e..eb2dea67 100755 --- a/utils/sb2-config-gcc-toolchain +++ b/utils/sb2-config-gcc-toolchain @@ -94,6 +94,7 @@ gcc_config$gcc_version_id = { cross_gcc_prefix_list="$SBOX_CROSS_GCC_PREFIX_LIST", cross_gcc_dir="$SBOX_CROSS_GCC_DIR", + cross_gcc_progs_path="$SBOX_CROSS_GCC_PROGS_PATH", cross_gcc_version="$SBOX_CROSS_GCC_VERSION", cross_gcc_shortversion="$SBOX_CROSS_GCC_SHORTVERSION", @@ -257,6 +258,9 @@ else fi fi +# Path where gcc searches for sub-tools (ld, as, cc1,..) +SBOX_CROSS_GCC_PROGS_PATH=$($GCC -print-search-dirs|grep ^programs:|sed 's/programs: =//') + # default for the cross-gcc prefix list: # these may be changed by sb2rc.$MAPPING_MODE