This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
# HG changeset patch # User Bryan Hundven <bryanhundven@gmail.com> # Date 1287163549 25200 # Node ID 723f12354ba302905f8398b9d4bc2697e780a247 # Parent 3b812ba8d0019ae5c283b3848bd3461ae17195aa Add support for static toolchains diff -r 3b812ba8d001 -r 723f12354ba3 config/cc/gcc.in.2 --- a/config/cc/gcc.in.2 Sat Oct 09 11:38:04 2010 +0200 +++ b/config/cc/gcc.in.2 Fri Oct 15 10:25:49 2010 -0700 @@ -41,6 +41,7 @@ prompt "Link libstdc++ statically into the gcc binary" default y depends on CC_GCC_4_4_or_later + depends on ! STATIC_TOOLCHAIN help Newer gcc versions use the PPL library which is C++ code. Statically linking libstdc++ increases the likeliness that the gcc binary will diff -r 3b812ba8d001 -r 723f12354ba3 config/companion_libs.in --- a/config/companion_libs.in Sat Oct 09 11:38:04 2010 +0200 +++ b/config/companion_libs.in Fri Oct 15 10:25:49 2010 -0700 @@ -141,6 +141,7 @@ prompt "Build shared companion libraries" default n depends on COMPLIBS + depends on ! STATIC_TOOLCHAIN select WRAPPER_NEEDED help By default, the companion libraries will be build static. If you want to diff -r 3b812ba8d001 -r 723f12354ba3 config/toolchain.in --- a/config/toolchain.in Sat Oct 09 11:38:04 2010 +0200 +++ b/config/toolchain.in Fri Oct 15 10:25:49 2010 -0700 @@ -27,6 +27,14 @@ In fact, the sysroot path is constructed as: ${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_DIR_PREFIX}/sys-root + +config STATIC_TOOLCHAIN + bool + prompt "Build Static Toolchain" + depends on EXPERIMENTAL + default n + help + Compile binutils and gcc as static binaries. comment "Tuple completion and aliasing" diff -r 3b812ba8d001 -r 723f12354ba3 scripts/build/binutils/binutils.sh --- a/scripts/build/binutils/binutils.sh Sat Oct 09 11:38:04 2010 +0200 +++ b/scripts/build/binutils/binutils.sh Fri Oct 15 10:25:49 2010 -0700 @@ -18,11 +18,16 @@ # Build binutils do_binutils() { local -a extra_config + local -a extra_make_flags mkdir -p "${CT_BUILD_DIR}/build-binutils" cd "${CT_BUILD_DIR}/build-binutils" CT_DoStep INFO "Installing binutils" + + if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then + extra_make_flags+=("LDFLAGS=-all-static") + fi CT_DoLog EXTRA "Configuring binutils" CFLAGS="${CT_CFLAGS_FOR_HOST}" \ @@ -40,8 +45,13 @@ ${CT_BINUTILS_EXTRA_CONFIG} \ ${BINUTILS_SYSROOT_ARG} + if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then + CT_DoLog EXTRA "Prepare binutils for static build" + CT_DoExecLog ALL make configure-host + fi + CT_DoLog EXTRA "Building binutils" - CT_DoExecLog ALL make ${PARALLELMFLAGS} + CT_DoExecLog ALL make "${extra_make_flags[@]}" ${PARALLELMFLAGS} CT_DoLog EXTRA "Installing binutils" CT_DoExecLog ALL make install @@ -66,6 +76,7 @@ # Now on for the target libraries do_binutils_target() { local -a extra_config + local -a extra_make_flags local -a targets local -a build_targets local -a install_targets @@ -77,6 +88,10 @@ build_targets+=("all-${t}") install_targets+=("install-${t}") done + + if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then + extra_make_flags+=("LDFLAGS=-all-static") + fi if [ "${#targets[@]}" -ne 0 ]; then CT_DoStep INFO "Installing binutils for target" @@ -99,8 +114,13 @@ ${CT_ARCH_WITH_FLOAT} \ ${CT_BINUTILS_EXTRA_CONFIG} + if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then + CT_DoLog EXTRA "Prepare binutils for static build" + CT_DoExecLog ALL make configure-host + fi + CT_DoLog EXTRA "Building binutils' libraries (${targets[*]}) for target" - CT_DoExecLog ALL make ${PARALLELMFLAGS} "${build_targets[@]}" + CT_DoExecLog ALL make "${extra_make_flags[@]}" ${PARALLELMFLAGS} "${build_targets[@]}" CT_DoLog EXTRA "Installing binutils' libraries (${targets[*]}) for target" CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" "${install_targets[@]}" diff -r 3b812ba8d001 -r 723f12354ba3 scripts/build/cc/gcc.sh --- a/scripts/build/cc/gcc.sh Sat Oct 09 11:38:04 2010 +0200 +++ b/scripts/build/cc/gcc.sh Fri Oct 15 10:25:49 2010 -0700 @@ -305,8 +305,8 @@ # Build final gcc do_cc() { local -a extra_config + local -a final_LDFLAGS local tmp - local final_LDFLAGS # If building for bare metal, nothing to be done here, the static core conpiler is enough! [ "${CT_BARE_METAL}" = "y" ] && return 0 @@ -389,11 +389,16 @@ # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm") elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then + if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then + final_LDFLAGS+=("-static") + extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++ -lm") + fi # When companion libraries are build static (eg !shared), # the libstdc++ is not pulled automatically, although it # is needed. Shoe-horn it in our LDFLAGS # Ditto libm on some Fedora boxen - final_LDFLAGS='-lstdc++ -lm' + final_LDFLAGS+=("-lstdc++") + final_LDFLAGS+=("-lm") fi if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then extra_config+=("--with-gmp=${CT_COMPLIBS_DIR}") @@ -451,7 +456,7 @@ # embedded systems don't really need message catalogs... CC_FOR_BUILD="${CT_BUILD}-gcc" \ CFLAGS="${CT_CFLAGS_FOR_HOST}" \ - LDFLAGS="${final_LDFLAGS}" \ + LDFLAGS="${final_LDFLAGS[@]}" \ CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \ -- For unsubscribe information see http://sourceware.org/lists.html#faq
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |