diff mbox

Add BUILD/HOST extra cflags/ldflags

Message ID d24043276c9243a35421.1353077450@macbook-smorlat.local
State Accepted
Commit 1c56c03b7ed5
Headers show

Commit Message

Yann Diorcet Nov. 16, 2012, 2:50 p.m. UTC
# HG changeset patch
# User Yann Diorcet (diorcet.yann@gmail.com)
# Date 1353075957 -3600
# Node ID d24043276c9243a35421763b192f4cf59cea650b
# Parent  515c5c4635d99ebe4877e1cbb52af227cfd75d5f
Add BUILD/HOST extra cflags/ldflags

config: Add entry for each flags
scripts: Update scripts with new flags

Signed-off-by: Yann Diorcet <diorcet.yann@gmail.com>


--
For unsubscribe information see http://sourceware.org/lists.html#faq

Comments

Yann E. MORIN Nov. 19, 2012, 11:48 p.m. UTC | #1
Yann, All,

Your patch:
    scripts: add BUILD/HOST extra cflags/ldflags

has been applied as: #1c56c03b7ed5
    http://crosstool-ng.org/hg/crosstool-ng/rev/1c56c03b7ed5

Thank you!

Regards,
Yann E. MORIN.



--
For unsubscribe information see http://sourceware.org/lists.html#faq
diff mbox

Patch

diff -r 515c5c4635d9 -r d24043276c92 config/global/build-behave.in
--- a/config/global/build-behave.in	Fri Nov 16 14:59:27 2012 +0100
+++ b/config/global/build-behave.in	Fri Nov 16 15:25:57 2012 +0100
@@ -41,7 +41,27 @@ 
       Use gcc's option -pipe to use pipes rather than temp files when building
       the toolchain.
 
-config EXTRA_FLAGS_FOR_HOST
+config EXTRA_CFLAGS_FOR_BUILD
+    string
+    prompt "Extra build compiler flags"
+    default ""
+    help
+      Extra flags to pass to the build C and C++ compiler.
+
+      May be used to change the default features of the build
+      compiler such as turning off the stack protector or fortify.
+      
+config EXTRA_LDFLAGS_FOR_BUILD
+    string
+    prompt "Extra build linker flags"
+    default ""
+    help
+      Extra flags to pass to the build linker.
+
+      May be used to change the default features of the build
+      linker.
+      
+config EXTRA_CFLAGS_FOR_HOST
     string
     prompt "Extra host compiler flags"
     default ""
@@ -50,6 +70,16 @@ 
 
       May be used to change the default features of the host
       compiler such as turning off the stack protector or fortify.
+      
+config EXTRA_LDFLAGS_FOR_HOST
+    string
+    prompt "Extra host linker flags"
+    default ""
+    help
+      Extra flags to pass to the host linker.
+
+      May be used to change the default features of the host
+      linker.
 
 choice
     bool
diff -r 515c5c4635d9 -r d24043276c92 scripts/build/binutils/binutils.sh
--- a/scripts/build/binutils/binutils.sh	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/build/binutils/binutils.sh	Fri Nov 16 15:25:57 2012 +0100
@@ -39,6 +39,8 @@ 
 
     binutils_opts+=( "host=${CT_BUILD}" )
     binutils_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    binutils_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+    binutils_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
 
     do_binutils_backend "${binutils_opts[@]}"
 
@@ -58,6 +60,7 @@ 
     binutils_opts+=( "prefix=${CT_PREFIX_DIR}" )
     binutils_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
     binutils_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    binutils_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     binutils_opts+=( "build_manuals=${CT_BUILD_MANUALS}" )
 
     do_binutils_backend "${binutils_opts[@]}"
@@ -99,13 +102,15 @@ 
 #     host          : machine to run on         : tuple     : (none)
 #     prefix        : prefix to install into    : dir       : (none)
 #     static_build  : build statcially          : bool      : no
-#     cflags        : host cflags to use        : string    : (empty)
+#     cflags        : cflags to use             : string    : (empty)
+#     ldflags       : ldflags to use            : string    : (empty)
 #     build_manuals : whether to build manuals  : bool      : no
 do_binutils_backend() {
     local host
     local prefix
     local static_build
     local cflags
+    local ldflags
     local build_manuals=no
     local -a extra_config
     local -a extra_make_flags
@@ -158,6 +163,7 @@ 
     CT_DoExecLog CFG                                            \
     CFLAGS="${cflags}"                                          \
     CXXFLAGS="${cflags}"                                        \
+    LDFLAGS="${ldflags}"                                        \
     "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure"   \
         --build=${CT_BUILD}                                     \
         --host=${host}                                          \
diff -r 515c5c4635d9 -r d24043276c92 scripts/build/binutils/elf2flt.sh
--- a/scripts/build/binutils/elf2flt.sh	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/build/binutils/elf2flt.sh	Fri Nov 16 15:25:57 2012 +0100
@@ -49,6 +49,8 @@ 
 
     elf2flt_opts+=( "host=${CT_BUILD}" )
     elf2flt_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+    elf2flt_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
     elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_HOST}" )
 
     do_elf2flt_backend "${elf2flt_opts[@]}"
@@ -68,6 +70,7 @@ 
     elf2flt_opts+=( "prefix=${CT_PREFIX_DIR}" )
     elf2flt_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
     elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    elf2flt_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" )
 
     do_elf2flt_backend "${elf2flt_opts[@]}"
@@ -102,12 +105,14 @@ 
 #     host          : machine to run on         : tuple     : (none)
 #     prefix        : prefix to install into    : dir       : (none)
 #     static_build  : build statcially          : bool      : no
-#     cflags        : host cflags to use        : string    : (empty)
+#     cflags        : cflags to use             : string    : (empty)
+#     ldflags       : ldflags to use            : string    : (empty)
 do_elf2flt_backend() {
     local host
     local prefix
     local static_build
     local cflags
+    local ldflags
     local binutils_bld
     local binutils_src
     local arg
@@ -120,7 +125,8 @@ 
 
     CT_DoLog EXTRA "Configuring elf2flt"
     CT_DoExecLog CFG                                            \
-    CFLAGS="${host_cflags}"                                     \
+    CFLAGS="${cflags}"                                          \
+    LDFLAGS="${ldflags}"                                        \
     "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure"     \
         --build=${CT_BUILD}                                     \
         --host=${host}                                          \
diff -r 515c5c4635d9 -r d24043276c92 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/build/cc/gcc.sh	Fri Nov 16 15:25:57 2012 +0100
@@ -88,6 +88,7 @@ 
     core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" )
     core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
     core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     core_opts+=( "lang_list=c" )
 
     CT_DoStep INFO "Installing pass-1 core C compiler"
@@ -108,6 +109,7 @@ 
     core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
     core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" )
     core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     core_opts+=( "lang_list=c" )
 
     # Different conditions are at stake here:
@@ -155,7 +157,8 @@ 
 #   build_libstdcxx     : build libstdc++ or not                    : bool      : no
 #   build_staticlinked  : build statically linked or not            : bool      : no
 #   build_manuals       : whether to build manuals or not           : bool      : no
-#   cflags              : host CFLAGS to use                        : string    : (empty)
+#   cflags              : cflags to use                             : string    : (empty)
+#   ldflags             : ldflags to use                            : string    : (empty)
 # Usage: do_cc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no]
 do_cc_core_backend() {
     local mode
@@ -168,6 +171,7 @@ 
     local complibs
     local lang_list
     local cflags
+    local ldflags
     local tmp
     local -a host_libstdcxx_flags
     local -a extra_config
@@ -226,6 +230,8 @@ 
     else
         extra_config+=("--disable-__cxa_atexit")
     fi
+    
+    core_LDFLAGS+=("${ldflags}")
 
     # *** WARNING ! ***
     # Keep this full if-else-if-elif-fi-fi block in sync
@@ -521,6 +527,7 @@ 
     final_opts+=( "prefix=${CT_PREFIX_DIR}" )
     final_opts+=( "complibs=${CT_HOST_COMPLIBS_DIR}" )
     final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     final_opts+=( "lang_list=$( cc_gcc_lang_list )" )
     if [ "${CT_BUILD_MANUALS}" = "y" ]; then
         final_opts+=( "build_manuals=yes" )
@@ -553,7 +560,8 @@ 
 #   host          : the host we run onto                : tuple     : (none)
 #   prefix        : the runtime prefix                  : dir       : (none)
 #   complibs      : the companion libraries prefix      : dir       : (none)
-#   cflags        : the host CFLAGS                     : string    : (empty)
+#   cflags        : cflags to use                       : string    : (empty)
+#   ldflags       : ldflags to use                      : string    : (empty)
 #   lang_list     : the list of languages to build      : string    : (empty)
 #   build_manuals : whether to build manuals or not     : bool      : no
 do_cc_backend() {
@@ -561,6 +569,7 @@ 
     local prefix
     local complibs
     local cflags
+    local ldflags
     local lang_list
     local build_manuals
     local -a host_libstdcxx_flags
@@ -627,6 +636,8 @@ 
             extra_config+=(--disable-libquadmath-support)
         fi
     fi
+    
+    final_LDFLAGS+=("${ldflags}")
 
     # *** WARNING ! ***
     # Keep this full if-else-if-elif-fi-fi block in sync
diff -r 515c5c4635d9 -r d24043276c92 scripts/build/companion_libs/100-gmp.sh
--- a/scripts/build/companion_libs/100-gmp.sh	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/build/companion_libs/100-gmp.sh	Fri Nov 16 15:25:57 2012 +0100
@@ -37,6 +37,8 @@ 
 
     gmp_opts+=( "host=${CT_BUILD}" )
     gmp_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    gmp_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+    gmp_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
     do_gmp_backend "${gmp_opts[@]}"
 
     CT_Popd
@@ -53,6 +55,7 @@ 
     gmp_opts+=( "host=${CT_HOST}" )
     gmp_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
     gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    gmp_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     do_gmp_backend "${gmp_opts[@]}"
 
     CT_Popd
@@ -63,11 +66,13 @@ 
 #     Parameter     : description               : type      : default
 #     host          : machine to run on         : tuple     : (none)
 #     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
+#     cflags        : cflags to use             : string    : (empty)
+#     ldflags       : ldflags to use            : string    : (empty)
 do_gmp_backend() {
     local host
     local prefix
     local cflags
+    local ldflags
     local arg
 
     for arg in "$@"; do
@@ -78,6 +83,7 @@ 
 
     CT_DoExecLog CFG                                \
     CFLAGS="${cflags} -fexceptions"                 \
+    LDFLAGS="${ldflags}"                            \
     "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
         --build=${CT_BUILD}                         \
         --host=${host}                              \
diff -r 515c5c4635d9 -r d24043276c92 scripts/build/companion_libs/110-mpfr.sh
--- a/scripts/build/companion_libs/110-mpfr.sh	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/build/companion_libs/110-mpfr.sh	Fri Nov 16 15:25:57 2012 +0100
@@ -80,6 +80,8 @@ 
 
     mpfr_opts+=( "host=${CT_BUILD}" )
     mpfr_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+    mpfr_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
     do_mpfr_backend "${mpfr_opts[@]}"
 
     CT_Popd
@@ -96,6 +98,7 @@ 
     mpfr_opts+=( "host=${CT_HOST}" )
     mpfr_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
     mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    mpfr_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     do_mpfr_backend "${mpfr_opts[@]}"
 
     CT_Popd
@@ -106,11 +109,13 @@ 
 #     Parameter     : description               : type      : default
 #     host          : machine to run on         : tuple     : (none)
 #     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
+#     cflags        : cflags to use             : string    : (empty)
+#     ldflags       : ldflags to use            : string    : (empty)
 do_mpfr_backend() {
     local host
     local prefix
     local cflags
+    local ldflags
     local arg
 
     for arg in "$@"; do
@@ -128,7 +133,8 @@ 
     CT_DoLog EXTRA "Configuring MPFR"
     CT_DoExecLog CFG                                    \
     CC="${host}-gcc"                                    \
-    CFLAGS="${CT_CFLAGS_FOR_HOST}"                      \
+    CFLAGS="${cflags}"                                  \
+    LDFLAGS="${ldflags}"                                \
     "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
         --build=${CT_BUILD}                             \
         --host=${host}                                  \
diff -r 515c5c4635d9 -r d24043276c92 scripts/build/companion_libs/120-ppl.sh
--- a/scripts/build/companion_libs/120-ppl.sh	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/build/companion_libs/120-ppl.sh	Fri Nov 16 15:25:57 2012 +0100
@@ -40,6 +40,8 @@ 
 
     ppl_opts+=( "host=${CT_BUILD}" )
     ppl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    ppl_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+    ppl_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
     do_ppl_backend "${ppl_opts[@]}"
 
     CT_Popd
@@ -56,6 +58,7 @@ 
     ppl_opts+=( "host=${CT_HOST}" )
     ppl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
     ppl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    ppl_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     do_ppl_backend "${ppl_opts[@]}"
 
     CT_Popd
@@ -66,11 +69,13 @@ 
 #     Parameter     : description               : type      : default
 #     host          : machine to run on         : tuple     : (none)
 #     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
+#     cflags        : cflags to use             : string    : (empty)
+#     ldflags       : ldflags to use            : string    : (empty)
 do_ppl_backend() {
     local host
     local prefix
     local cflags
+    local ldflags
     local arg
 
     for arg in "$@"; do
@@ -82,6 +87,7 @@ 
     CT_DoExecLog CFG                                \
     CFLAGS="${cflags}"                              \
     CXXFLAGS="${cflags}"                            \
+    LDFLAGS="${ldflags}"                            \
     "${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
         --build=${CT_BUILD}                         \
         --host=${host}                              \
diff -r 515c5c4635d9 -r d24043276c92 scripts/build/companion_libs/130-cloog.sh
--- a/scripts/build/companion_libs/130-cloog.sh	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/build/companion_libs/130-cloog.sh	Fri Nov 16 15:25:57 2012 +0100
@@ -53,6 +53,8 @@ 
 
     cloog_opts+=( "host=${CT_BUILD}" )
     cloog_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    cloog_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+    cloog_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
     do_cloog_backend "${cloog_opts[@]}"
 
     CT_Popd
@@ -69,6 +71,7 @@ 
     cloog_opts+=( "host=${CT_HOST}" )
     cloog_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
     cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    cloog_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     do_cloog_backend "${cloog_opts[@]}"
 
     CT_Popd
@@ -79,11 +82,13 @@ 
 #     Parameter     : description               : type      : default
 #     host          : machine to run on         : tuple     : (none)
 #     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
+#     cflags        : cflags to use             : string    : (empty)
+#     ldflags       : ldflags to use            : string    : (empty)
 do_cloog_backend() {
     local host
     local prefix
     local cflags
+    local ldflags
     local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
     local arg
 
@@ -95,6 +100,7 @@ 
 
     CT_DoExecLog CFG                            \
     CFLAGS="${cflags}"                          \
+    LDFLAGS="${ldflags}"                        \
     LIBS="-lm"                                  \
     "${cloog_src_dir}/configure"                \
         --build=${CT_BUILD}                     \
diff -r 515c5c4635d9 -r d24043276c92 scripts/build/companion_libs/140-mpc.sh
--- a/scripts/build/companion_libs/140-mpc.sh	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/build/companion_libs/140-mpc.sh	Fri Nov 16 15:25:57 2012 +0100
@@ -38,6 +38,8 @@ 
 
     mpc_opts+=( "host=${CT_BUILD}" )
     mpc_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    mpc_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+    mpc_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
     do_mpc_backend "${mpc_opts[@]}"
 
     CT_Popd
@@ -54,6 +56,7 @@ 
     mpc_opts+=( "host=${CT_HOST}" )
     mpc_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
     mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    mpc_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     do_mpc_backend "${mpc_opts[@]}"
 
     CT_Popd
@@ -64,11 +67,13 @@ 
 #     Parameter     : description               : type      : default
 #     host          : machine to run on         : tuple     : (none)
 #     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
+#     cflags        : cflags to use             : string    : (empty)
+#     ldflags       : ldflags to use            : string    : (empty)
 do_mpc_backend() {
     local host
     local prefix
     local cflags
+    local ldflags
     local arg
 
     for arg in "$@"; do
@@ -79,6 +84,7 @@ 
 
     CT_DoExecLog CFG                                \
     CFLAGS="${cflags}"                              \
+    LDFLAGS="${ldflags}"                            \
     "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
         --build=${CT_BUILD}                         \
         --host=${host}                              \
diff -r 515c5c4635d9 -r d24043276c92 scripts/build/companion_libs/200-libelf.sh
--- a/scripts/build/companion_libs/200-libelf.sh	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/build/companion_libs/200-libelf.sh	Fri Nov 16 15:25:57 2012 +0100
@@ -38,6 +38,8 @@ 
 
     libelf_opts+=( "host=${CT_BUILD}" )
     libelf_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    libelf_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+    libelf_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
     do_libelf_backend "${libelf_opts[@]}"
 
     CT_Popd
@@ -54,6 +56,7 @@ 
     libelf_opts+=( "host=${CT_HOST}" )
     libelf_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
     libelf_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    libelf_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
     do_libelf_backend "${libelf_opts[@]}"
 
     CT_Popd
@@ -87,13 +90,15 @@ 
 #     destdir       : out-of-tree install dir   : string    : /
 #     host          : machine to run on         : tuple     : (none)
 #     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
+#     cflags        : cflags to use             : string    : (empty)
+#     ldflags       : ldflags to use           : string    : (empty)
 #     shared        : also buils shared lib     : bool      : n
 do_libelf_backend() {
     local destdir="/"
     local host
     local prefix
     local cflags
+    local ldflags
     local shared
     local -a extra_config
     local arg
@@ -114,6 +119,7 @@ 
     CC="${host}-gcc"                                        \
     RANLIB="${host}-ranlib"                                 \
     CFLAGS="${cflags} -fPIC"                                \
+    LDFLAGS="${ldflags}"                                    \
     "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
         --build=${CT_BUILD}                                 \
         --host=${host}                                      \
diff -r 515c5c4635d9 -r d24043276c92 scripts/crosstool-NG.sh.in
--- a/scripts/crosstool-NG.sh.in	Fri Nov 16 14:59:27 2012 +0100
+++ b/scripts/crosstool-NG.sh.in	Fri Nov 16 15:25:57 2012 +0100
@@ -488,12 +488,22 @@ 
         rm -f "${tmp}"
     fi
 
-    # Help gcc
+    # Help build gcc
+    # Explicitly optimise, else the lines below will overide the
+    # package's default optimisation flags
+    CT_CFLAGS_FOR_BUILD="-O2 -g"
+    CT_CFLAGS_FOR_BUILD+=" ${CT_EXTRA_CFLAGS_FOR_BUILD}"
+    CT_LDFLAGS_FOR_BUILD=
+    CT_LDFLAGS_FOR_BUILD+=" ${CT_EXTRA_LDFLAGS_FOR_BUILD}"
+    
+    # Help host gcc
     # Explicitly optimise, else the lines below will overide the
     # package's default optimisation flags
     CT_CFLAGS_FOR_HOST="-O2 -g"
     [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe"
-    CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_FLAGS_FOR_HOST}"
+    CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_CFLAGS_FOR_HOST}"
+    CT_LDFLAGS_FOR_HOST=
+    CT_LDFLAGS_FOR_HOST+=" ${CT_EXTRA_LDFLAGS_FOR_HOST}"
 
     # Set the shell to be used by ./configure scripts and by Makefiles (those
     # that support it!).