From patchwork Fri Nov 16 14:50:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Diorcet X-Patchwork-Id: 199645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E85E92C0093 for ; Sat, 17 Nov 2012 01:51:18 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sourceware.org; s=default; x=1353682279; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Content-Type:MIME-Version:Content-Transfer-Encoding: Subject:Message-Id:User-Agent:Date:From:To:Cc:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Subscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=hwaCLu8KKnwdKV7sDmuj 4fQl1Rs=; b=o4E7hEUZjhpVbx1qBIE0dlKeD0WcfAIbUfmsoUMo7S0eOYS+kaAe 6/o+Yrry6cwWuWyPb/yxLnArNLNe0CrQf//2xv1PjS1n+hU5CZE9VQVXFuqsihEF f2xugJ465DUZ6E2nGv96nDf0jCthIv1LIdcAY3UbP+8gDvIBPMD1ao8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=sourceware.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Content-Type:MIME-Version:Content-Transfer-Encoding:Subject:X-Mercurial-Node:Message-Id:User-Agent:Date:From:To:Cc:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=k2Z6E0LrYrHMX23klloZEBoL43KOV0Q8ZmPVrjgRkgSgjY8u0ZLDtI5bR28fmR SGAKnqFJvb/DWhrssQ8PpHATCeM6+op67M3TbNJw32k/LV2zx6vIgQ89rp2A+f2e iIdl5vzwwTmvZ78F5Ek+O97NiB61jil6Qc0NDFR7JnjfQ=; Received: (qmail 2282 invoked by alias); 16 Nov 2012 14:51:13 -0000 Received: (qmail 2269 invoked by uid 22791); 16 Nov 2012 14:51:12 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_DC, TW_IB X-Spam-Check-By: sourceware.org Received: from mail-wg0-f43.google.com (HELO mail-wg0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Nov 2012 14:51:01 +0000 Received: by mail-wg0-f43.google.com with SMTP id dq12so44611wgb.12 for ; Fri, 16 Nov 2012 06:51:00 -0800 (PST) Received: by 10.180.93.136 with SMTP id cu8mr5564852wib.7.1353077459931; Fri, 16 Nov 2012 06:50:59 -0800 (PST) Received: from macbook-smorlat.local (vig38-2-81-56-113-2.fbx.proxad.net. [81.56.113.2]) by mx.google.com with ESMTPS id y3sm172495wix.6.2012.11.16.06.50.58 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 16 Nov 2012 06:50:59 -0800 (PST) MIME-Version: 1.0 Subject: [PATCH] Add BUILD/HOST extra cflags/ldflags X-Mercurial-Node: d24043276c9243a35421763b192f4cf59cea650b Message-Id: User-Agent: Mercurial-patchbomb/2.3.1 Date: Fri, 16 Nov 2012 15:50:50 +0100 From: Yann Diorcet To: "Yann E. MORIN" Cc: crossgcc@sourceware.org X-IsSubscribed: yes Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org Delivered-To: mailing list crossgcc@sourceware.org # 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 --- For unsubscribe information see http://sourceware.org/lists.html#faq 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!).