[cross-gcc] Add libgcc support for some arches.

David Howells dhowells at fedoraproject.org
Thu Nov 15 15:20:20 UTC 2012


commit 889078a25ebd667e51490a474ace3859d21501a6
Author: Dan HorĂ¡k <dan at danny.cz>
Date:   Thu Nov 15 13:58:20 2012 +0000

    Add libgcc support for some arches.

 cross-gcc-with-libgcc.patch |   26 ++++++++++++++++++++++++++
 cross-gcc.spec              |   24 ++++++++++++++++++++++--
 2 files changed, 48 insertions(+), 2 deletions(-)
---
diff --git a/cross-gcc-with-libgcc.patch b/cross-gcc-with-libgcc.patch
new file mode 100644
index 0000000..6143131
--- /dev/null
+++ b/cross-gcc-with-libgcc.patch
@@ -0,0 +1,26 @@
+diff -up gcc-4.7.0/libgcc/unwind-generic.h.cross-libgcc-ia64 gcc-4.7.0/libgcc/unwind-generic.h
+--- gcc-4.7.0/libgcc/unwind-generic.h.cross-libgcc-ia64	2012-06-01 18:14:22.552450391 +0200
++++ gcc-4.7.0/libgcc/unwind-generic.h	2012-06-01 18:14:42.523121821 +0200
+@@ -211,7 +211,9 @@ _Unwind_SjLj_Resume_or_Rethrow (struct _
+    compatible with the standard ABI for IA-64, we inline these.  */
+ 
+ #ifdef __ia64__
++#ifndef inhibit_libc
+ #include <stdlib.h>
++#endif
+ 
+ static inline _Unwind_Ptr
+ _Unwind_GetDataRelBase (struct _Unwind_Context *_C)
+diff -up gcc-4.7.0/libgcc/config/m68k/linux-atomic.c.cross-libgcc-m68k gcc-4.7.0/libgcc/config/m68k/linux-atomic.c
+--- gcc-4.7.0/libgcc/config/m68k/linux-atomic.c.cross-libgcc-m68k	2012-06-01 18:08:54.998851298 +0200
++++ gcc-4.7.0/libgcc/config/m68k/linux-atomic.c	2012-06-01 18:09:16.871488040 +0200
+@@ -33,7 +33,9 @@ see the files COPYING3 and COPYING.RUNTI
+    using the kernel helper defined below.  There is no support for
+    64-bit operations yet.  */
+ 
++#ifndef inhibit_libc
+ #include <asm/unistd.h>
++#endif
+ #include <stdbool.h>
+ 
+ #ifndef __NR_atomic_cmpxchg_32
diff --git a/cross-gcc.spec b/cross-gcc.spec
index 27570d4..595869a 100644
--- a/cross-gcc.spec
+++ b/cross-gcc.spec
@@ -88,6 +88,9 @@ Patch16: gcc47-rh837630.patch
 Patch17: gcc47-arm-hfp-ldso.patch
 
 Patch100: cross-intl-filename.patch
+# ia64 - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44553
+# m68k - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53557
+Patch101: cross-gcc-with-libgcc.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: binutils >= 2.20.51.0.2-12
@@ -171,6 +174,9 @@ the number of packages. \
 %do_package x86_64-linux-gnu	%{build_x86_64}
 %do_package xtensa-linux-gnu	%{build_xtensa}
 
+# we won't build libgcc for those as it depends on C library or kernel headers
+%define no_libgcc_targets	tile-linux-gnu
+
 ###############################################################################
 #
 # Preparation
@@ -200,6 +206,7 @@ cd %{srcdir}
 %patch17 -p0 -b .arm-hfp-ldso~
 %endif
 %patch100 -p0 -b .cross-intl~
+%patch101 -p1 -b .with-libgcc~
 
 # Move the version number back to 4.7.2
 sed -i -e 's/4\.7\.3/4.7.2/' gcc/BASE-VER
@@ -411,6 +418,12 @@ done
 
 function build_target () {
     arch=$1
+
+    case $arch in
+	%{no_libgcc_targets})	with_libgcc="";;
+	*)			with_libgcc="all-target-libgcc";;
+    esac
+
     AR_FOR_TARGET=%{_bindir}/$arch-ar \
     AS_FOR_TARGET=%{_bindir}/$arch-as \
     DLLTOOL_FOR_TARGET=%{_bindir}/$arch-dlltool \
@@ -421,7 +434,7 @@ function build_target () {
     STRIP_FOR_TARGET=%{_bindir}/$arch-strip \
     WINDRES_FOR_TARGET=%{_bindir}/$arch-windres \
     WINDMC_FOR_TARGET=%{_bindir}/$arch-windmc \
-    make -C $target %{_smp_mflags} tooldir=%{_prefix} all-gcc
+    make -C $target %{_smp_mflags} tooldir=%{_prefix} all-gcc ${with_libgcc}
 }
 
 for target in `cat target.list`
@@ -478,7 +491,13 @@ rm -rf %{buildroot}
 
 function install_bin () {
     arch=$1
-    make -C $arch DESTDIR=%{buildroot} install-gcc
+
+    case $arch in
+	%{no_libgcc_targets})	with_libgcc="";;
+	*)			with_libgcc="install-target-libgcc";;
+    esac
+
+    make -C $arch DESTDIR=%{buildroot} install-gcc ${with_libgcc}
 }
 
 for target in `cat target.list`
@@ -642,6 +661,7 @@ rm -rf %{buildroot}
 * Thu Nov 15 2012 David Howells <dhowells at redhat.com> - 4.7.2-1.aa.20121114
 - Move to the gcc-4.7-aarch64 SVN branch and add a compiler for the aarch64 arch.
 - Disable sjlj exception support.
+- Compile libgcc for certain platforms.
 
 * Mon Oct 15 2012 Jon Ciesla <limburgher at gmail.com> - 4.7.1-0.1.20120606.2
 - Provides: bundled(libiberty)


More information about the scm-commits mailing list