1.1 --- a/config/toolchain.in Sat Aug 29 18:27:47 2009 +0200
1.2 +++ b/config/toolchain.in Sun Aug 30 00:27:12 2009 +0200
1.3 @@ -296,4 +296,42 @@
1.4
1.5 endif # CROSS_NATIVE || CANADIAN
1.6
1.7 +# Kept as a separate if block, even if it could go into the above block,
1.8 +# because it seems better. No real reason, only that it seems right...
1.9 +if CANADIAN
1.10 +
1.11 +comment "Host specifics"
1.12 +
1.13 +choice
1.14 + bool
1.15 + prompt "| Install tools wrapper as:"
1.16 + default TOOLS_WRAPPER_SHELL
1.17 +
1.18 +config TOOLS_WRAPPER_SCRIPT
1.19 + bool
1.20 + prompt "shell script"
1.21 + help
1.22 + If your host has a shell, then you should say 'Y' here, to use
1.23 + a (very very simple) shell script as wrapper.
1.24 +
1.25 + See docs/overview.txt, section "Tools wrapper".
1.26 +
1.27 +config TOOLS_WRAPPER_EXEC
1.28 + bool
1.29 + prompt "executable"
1.30 + help
1.31 + If your host lacks a shell, then you should say 'Y' here, to use
1.32 + an executable.
1.33 +
1.34 + See docs/overview.txt, section "Tools wrapper".
1.35 +
1.36 +endchoice
1.37 +
1.38 +config TOOLS_WRAPPER
1.39 + string
1.40 + default "script" if TOOLS_WRAPPER_SCRIPT
1.41 + default "exec" if TOOLS_WRAPPER_EXEC
1.42 +
1.43 +endif # CROSS_NATIVE || CANADIAN
1.44 +
1.45 endmenu
2.1 --- a/docs/overview.txt Sat Aug 29 18:27:47 2009 +0200
2.2 +++ b/docs/overview.txt Sun Aug 30 00:27:12 2009 +0200
2.3 @@ -25,6 +25,7 @@
2.4 Testing all toolchains at once
2.5 Overriding the number of // jobs
2.6 Note on // jobs
2.7 + Tools wrapper
2.8 Using the toolchain
2.9 Toolchain types
2.10 Internals
2.11 @@ -382,6 +383,52 @@
2.12 refering to the number of // jobs when making the *components*. That is, we
2.13 speak of the number of // jobs used to build gcc, glibc, and so on...
2.14
2.15 +Tools wrapper |
2.16 +--------------+
2.17 +
2.18 +Starting with gcc-4.3 come two new dependencies: GMP and MPFR. With gcc-4.4,
2.19 +come three new ones: GMP, PPL and CLooG/ppl. These are libraries that enable
2.20 +advanced features to gcc. Additionally, some of the libraries can be used by
2.21 +binutils and gdb. Unfortunately, not all systems on which crosstool-NG runs
2.22 +have all of those libraries. And for those that do, the versions of those
2.23 +libraries may be older than the version required by gcc.
2.24 +
2.25 +This is why crosstool-NG builds its own set of libraries as part of the
2.26 +toolchain.
2.27 +
2.28 +The libraries are built as shared libraries, because building them as static
2.29 +libraries has some short-comings. This poses no problem at build time, as
2.30 +crosstool-NG correctly points gcc (and binutiols and gdb) to the correct
2.31 +place where our own version of the libraries are installed. But it poses
2.32 +a problem when gcc et al. are run: the place where the libraries are is most
2.33 +probably not known to the host dynamic linker. Still worse, if the host system
2.34 +has its own versions, then ld.so would load the wrong library!
2.35 +
2.36 +So we have to force the dynamic linker to load the correct version. We do this
2.37 +by using the LD_LIBRARY_PATH variable, that informs the dynamic linker where
2.38 +to look for shared libraries prior to searching its standard places. But we
2.39 +can't impose that burden on all the system (because it'd be a nightmare to
2.40 +configure, and because two tolchains on the same system may use different
2.41 +versions of the libraries); so we have to do it on a per-toolchain basis.
2.42 +
2.43 +So we rename all binaries of the toolchain (by adding a dot '.' as their first
2.44 +character), and add a small program, the so-called "tools wrapper", that
2.45 +correctly sets LD_LIBRARY_PATH prior to running the real tool.
2.46 +
2.47 +First, the wrapper was written as a POSIX-compliant shell script. That shell
2.48 +script is very simple, if not trivial, and works great. The only drawback is
2.49 +that it does not work on host systems that lack a shell, for example the
2.50 +MingW32 environment. To solve the issue, the wrapper has been re-written in C,
2.51 +and compiled at build time. This C wrapper is much more complex than the shell
2.52 +script, and although it sems to be working, it's been only lightly tested.
2.53 +Some of the expected short-comings with this C wrapper are;
2.54 + - multi-byte file names may not be handled correctly
2.55 + - it's really big for what it does
2.56 +
2.57 +So, the default wrapper installed with your toolchain is the shell script.
2.58 +If you know that your system is missing a shell, then you shall use the C
2.59 +wrapper (and report back whether it works, or does not work, for you).
2.60 +
2.61
2.62 _______________________
2.63 /
3.1 --- a/scripts/build/internals.sh Sat Aug 29 18:27:47 2009 +0200
3.2 +++ b/scripts/build/internals.sh Sun Aug 30 00:27:12 2009 +0200
3.3 @@ -46,9 +46,25 @@
3.4 CT_DoLog EXTRA "Installing toolchain wrappers"
3.5 CT_Pushd "${CT_PREFIX_DIR}/bin"
3.6
3.7 - # Copy the wrapper
3.8 - CT_DoExecLog DEBUG install -m 0755 "${CT_LIB_DIR}/scripts/wrapper.in" \
3.9 - ".${CT_TARGET}-wrapper"
3.10 + # Install the wrapper
3.11 + case "${CT_TOOLS_WRAPPER}" in
3.12 + script)
3.13 + CT_DoExecLog DEBUG install \
3.14 + -m 0755 \
3.15 + "${CT_LIB_DIR}/scripts/wrapper.in" \
3.16 + ".${CT_TARGET}-wrapper"
3.17 + ;;
3.18 + exec)
3.19 + _t="-s"
3.20 + if [ "${CT_DEBUG_CT}" = "y" ]; then
3.21 + _t="" # If debugging crosstool-NG, don't strip the wrapper
3.22 + fi
3.23 + CT_DoExecLog "${HOST_CC}" \
3.24 + -Wall -Wextra -Wunreachable-code -Werror \
3.25 + -O3 -static ${_t} \
3.26 + -o ".${CT_TARGET}-wrapper"
3.27 + ;;
3.28 + esac
3.29
3.30 # Replace every tools with the wrapper
3.31 # Do it unconditionally, even for those tools that happen to be shell