Skip to content

Commit

Permalink
support different gcc search patchs
Browse files Browse the repository at this point in the history
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 <riku.voipio@iki.fi>
Signed-off-by: Lauri Aarnio <Lauri.Aarnio@iki.fi>
  • Loading branch information
Riku Voipio committed Jul 22, 2009
1 parent 101799b commit dbcf9d6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
30 changes: 21 additions & 9 deletions lua_scripts/argvenvp_gcc.lua
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions utils/sb2-config-gcc-toolchain
Expand Up @@ -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",
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit dbcf9d6

Please sign in to comment.