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]

[PATCH 2 of 2] cc/gcc: add support for a statcally linked shared core for static toolchain


# HG changeset patch
# User Bryan Hundven <bryanhundven@gmail.com>
# Date 1287435325 25200
# Node ID fa5bd6f1ea1aa117771e4c53fefaba16ba603d82
# Parent  8091950d99a8b10bbff4b7a35518380afeefc5f6
cc/gcc: add support for a statcally linked shared core for static toolchain

This commit also updates the usage for do_cc_core.

diff -r 8091950d99a8 -r fa5bd6f1ea1a scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh	Mon Oct 18 12:15:08 2010 -0700
+++ b/scripts/build/cc/gcc.sh	Mon Oct 18 13:55:25 2010 -0700
@@ -66,9 +66,18 @@
         y,*,*)  do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes;;
         ,y,*)   ;;
         ,,nptl)
-            do_cc_core mode=shared build_libgcc=yes
+            if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
+                do_cc_core mode=shared build_libgcc=yes build_staticlinked=yes
+            else
+                do_cc_core mode=shared build_libgcc=yes
+            fi
             ;;
-        ,,win32) do_cc_core mode=static build_libgcc=yes
+        ,,win32)
+            if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
+                do_cc_core mode=static build_libgcc=yes build_staticlinked=yes
+            else
+                do_cc_core mode=static build_libgcc=yes
+            fi
             ;;
         *)  if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then
                 do_cc_core mode=static build_libgcc=yes
@@ -84,18 +93,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
@@ -163,7 +174,12 @@
     # is needed. Shoe-horn it in our LDFLAGS
     # Ditto libm on some Fedora boxen
     if [ "${CT_COMPLIBS_SHARED}" != "y" ]; then
-        core_LDFLAGS='-lstdc++ -lm'
+        if [ "${build_staticlinked}" = "yes" ]; then
+            core_LDFLAGS+=("-static")
+            extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++ -lm")
+        fi
+        core_LDFLAGS+=("-lstdc++")
+        core_LDFLAGS+=("-lm")
     fi
     if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then
         extra_config+=("--with-gmp=${CT_COMPLIBS_DIR}")
@@ -202,7 +218,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 ALL                                \
     "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure"  \
         --build=${CT_BUILD}                         \

--
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]