diff mbox

[2/3] GCC: Copy minimal sysroot instead of just headers

Message ID CAOYw7duVmnyBS0rFXuk25kONeboS89sMMCJUgV3b+YFVF_cDKg@mail.gmail.com
State New
Headers show

Commit Message

Ray Donnelly Feb. 4, 2014, 8:34 a.m. UTC
# HG changeset patch
# User Ray Donnelly <mingw.android@gmail.com>
# Date 1391500511 0
#      Tue Feb 04 07:55:11 2014 +0000
# Node ID 45760158aca33981b5bb882191043bd708b57dbb
# Parent  2eab7ceda925402555d7d3107e5828734ac74c11
GCC: Copy minimal sysroot instead of just headers

Before starting the build of the 2nd stage GCC,
as well as copying the headers, it is necessary
to also copy the start libraries and stub libc.
copy_headers is renamed to copy_minimal_sysroot
and find is used to copy ${CT_SYSROOT_DIR}/lib*
and ${CT_SYSROOT_DIR}/include otherwise linking
libgcc_s.so fails since GCC "cannot find -lc".

Signed-off-by: Ray Donnelly <mingw.android@gmail.com>

         *)
             CT_Abort "Internal Error: 'mode' must be one of:
'static', 'shared' or 'baremetal', not '${mode:-(empty)}'"
@@ -225,9 +226,14 @@
         [ -n "${CT_TOOLCHAIN_BUGURL}" ] &&
extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
     fi

-    if [ "${copy_headers}" = "y" ]; then
-        CT_DoLog DEBUG "Copying headers to install area of bootstrap
gcc, so it can build libgcc2"
-        CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}"
"${prefix}/${CT_TARGET}/include"
+    if [ "${copy_minimal_sysroot}" = "y" ]; then
+        CT_DoLog DEBUG "Copying headers and libs to install area of
bootstrap gcc, so it can build libgcc2"
+        CT_Pushd "${CT_HEADERS_DIR}/.."
+        sysroot_dirs=$(find . -mindepth 1 -maxdepth 1 -type d \(
-name "lib*" -or -name "include" \) -exec basename {} \;)
+        for sysroot_dir in $sysroot_dirs; do
+          CT_DoExecLog ALL cp -a "${sysroot_dir}"
"${prefix}/${CT_TARGET}/${sysroot_dir}"
+        done
+        CT_Popd
     fi

     for tmp in ARCH ABI CPU TUNE FPU FLOAT; do

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

Patch

diff -r 2eab7ceda925 -r 45760158aca3 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh Tue Feb 04 07:40:45 2014 +0000
+++ b/scripts/build/cc/gcc.sh Tue Feb 04 07:55:11 2014 +0000
@@ -189,6 +189,7 @@ 
     local -a core_LDFLAGS
     local -a core_targets
     local arg
+    local sysroot_dirs

     for arg in "$@"; do
         eval "${arg// /\\ }"
@@ -201,18 +202,18 @@ 
             extra_config+=("--with-newlib")
             extra_config+=("--enable-threads=no")
             extra_config+=("--disable-shared")
-            copy_headers=y  # For baremetal, as there's no headers to copy,
-                            # we copy an empty directory. So, who cares?
+            copy_minimal_sysroot=y  # For baremetal, as there's no
minimal sysroot to copy,
+                                    # we copy some empty directories.
So, who cares?
             ;;
         shared)
             extra_config+=("--enable-shared")
-            copy_headers=y
+            copy_minimal_sysroot=y
             ;;
         baremetal)
             extra_config+=("--with-newlib")
             extra_config+=("--enable-threads=no")
             extra_config+=("--disable-shared")
-            copy_headers=n
+            copy_minimal_sysroot=n
             ;;