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] |
On Wed, Dec 8, 2010 at 3:59 PM, Yann E. MORIN <yann.morin.1998@anciens.enib.fr> wrote: > # HG changeset patch > # User Bryan Hundven <bryanhundven@gmail.com> > # Date 1287436323 -7200 > # Node ID 844af83f1a8fcc4275b120fbbcdb93af16d1a719 > # Parent Âc78e61daa6977913fe7a92d8bf6358f47c0d255c > cc/gcc: build bare-metal gcc statically > > - add a new parameter to do_cc_core: build_statically=[yes|no] > - pass build_statically=yes in core_pass_2 when doing bare_metal > - fix handling the static / static libstdc++ / static complibs stuff > - add a commment to keep both blocks (in core and final) in sync > > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> > > diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh > --- a/scripts/build/cc/gcc.sh > +++ b/scripts/build/cc/gcc.sh > @@ -63,12 +63,19 @@ >   # In any other case, build the static core gcc and, if using gcc-4.3+, >   # also build the target libgcc. >   case "${CT_BARE_METAL},${CT_CANADIAN},${CT_THREADS}" in > -    Ây,*,*) Âdo_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes;; > +    Ây,*,*) > +      Âif [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then > +        Âdo_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes build_staticlinked=yes > +      Âelse > +        Âdo_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes > +      Âfi > +      Â;; >     ,y,*)  ;; >     ,,nptl) >       do_cc_core mode=shared build_libgcc=yes >       ;; > -    Â,,win32) do_cc_core mode=static build_libgcc=yes > +    Â,,win32) > +      Âdo_cc_core mode=static build_libgcc=yes >       ;; >     *) Âif [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then >         do_cc_core mode=static build_libgcc=yes > @@ -84,18 +91,20 @@ > Â# This function is used to build both the static and the shared core C conpiler, > Â# with or without the target libgcc. We need to know wether: > Â# Â- we're building static, shared or bare metal: mode=[static|shared|baremetal] > -# Â- we need to build libgcc or not       : build_libgcc=[yes|no]   (default: no) > -# Â- we need to build libstdc++ or not     Â: build_libstdcxx=[yes|no] Â(default: no) > -# Usage: do_cc_core_static mode=[static|shared|baremetal] build_libgcc=[yes|no] > +# Â- we need to build libgcc or not       : build_libgcc=[yes|no]    (default: no) > +# Â- we need to build libstdc++ or not     Â: build_libstdcxx=[yes|no]  Â(default: no) > +# Â- we need to build statically linked or not Â: build_staticlinked=[yes|no] (default: no) > +# Usage: do_cc_core mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no] > Âdo_cc_core() { >   local mode >   local build_libgcc=no >   local build_libstdcxx=no > +  Âlocal build_staticlinked=no >   local core_prefix_dir >   local lang_opt >   local tmp >   local -a extra_config > -  Âlocal core_LDFLAGS > +  Âlocal -a core_LDFLAGS >   local -a core_targets > >   while [ $# -ne 0 ]; do > @@ -158,13 +167,35 @@ >     extra_config+=("--disable-__cxa_atexit") >   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 > -  Âif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then > -    Âcore_LDFLAGS='-lstdc++ -lm' > +  Â# *** WARNING ! *** > +  Â# Keep this full if-else-if-elif-fi-fi block in sync > +  Â# with the same block in do_cc, below. > +  Âif [ "${build_staticlinked}" = "yes" ]; then > +    Âcore_LDFLAGS+=("-static") > +    Âextra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++ -lm") > +    Â# Companion libraries are build static (eg !shared), so > +    Â# 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++") > +    Âfinal_LDFLAGS+=("-lm") > +  Âelse > +    Âif [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then > +      Â# this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2 > +      Â# build script > +      Â# FIXME: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, > +      Â# 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 > +      Â# 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 > +      Âcore_LDFLAGS+=("-lstdc++") > +      Âcore_LDFLAGS+=("-lm") > +    Âfi >   fi > + >   if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then >     extra_config+=("--with-gmp=${CT_COMPLIBS_DIR}") >     extra_config+=("--with-mpfr=${CT_COMPLIBS_DIR}") > @@ -202,7 +233,7 @@ >   # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532) >   CC_FOR_BUILD="${CT_BUILD}-gcc"         Â\ >   CFLAGS="${CT_CFLAGS_FOR_HOST}"         Â\ > -  ÂLDFLAGS="${core_LDFLAGS}"            \ > +  ÂLDFLAGS="${core_LDFLAGS[*]}"          Â\ >   CT_DoExecLog CFG                Â\ >   "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" Â\ >     --build=${CT_BUILD}             \ > @@ -373,6 +404,9 @@ >     extra_config+=(--disable-libssp) >   fi > > +  Â# *** WARNING ! *** > +  Â# Keep this full if-else-if-elif-fi-fi block in sync > +  Â# with the same block in do_cc_core, above. >   if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then >     final_LDFLAGS+=("-static") >     extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++ -lm") > Ah, oh well. I guess I "didn't care" about bare-metal. Thanks for fixing that! As for the -lstdc++ stuff, -static-libstdc++ could be set by doing something like: ------8<----8<------ if [ ! "${CT_CC_GCC_4_5_or_later}" = "y" ]; then extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm") else core_LDFLAGS+=("-static-libstdc++") fi ------8<----8<------ ? If you don't want to do that, I can add it to my list of patches for gcc/binutils snapshot support. -Bryan (P.S., I don't know who '-r' is, it was in the "To:" field of this email... ;) ) -- 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] |