toolchain: add coldfire support
authorWaldemar Brodkorb <wbx@openadk.org>
Fri, 29 Apr 2016 17:51:23 +0000 (19:51 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 30 Apr 2016 16:50:46 +0000 (18:50 +0200)
Add support for m68k/coldfire. A gcc patch is required
to avoid gcc ICE.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
arch/Config.in
arch/Config.in.m68k
package/gcc/4.8.5/891-fix-m68k-uclinux.patch [new file with mode: 0644]
package/gcc/4.9.3/891-fix-m68k-uclinux.patch [new file with mode: 0644]
package/gcc/5.3.0/891-fix-m68k-uclinux.patch [new file with mode: 0644]
package/gcc/6.1.0/891-fix-m68k-uclinux.patch [new file with mode: 0644]
package/gcc/gcc-final/gcc-final.mk
package/uclibc/uclibc.mk

index 3f1453fc0a63635d8bd9bfcf275fe85c317fed44..be37481ac2b29fdf1da187f354446b934ebdfbc1 100644 (file)
@@ -94,7 +94,7 @@ config BR2_i386
 
 config BR2_m68k
        bool "m68k"
-       select BR2_ARCH_HAS_MMU_MANDATORY
+       # MMU support is set by the subarchitecture file, arch/Config.in.m68k
        help
          Motorola 68000 family microprocessor
          http://en.wikipedia.org/wiki/M68k
index 94494c88077667189eb621e1d1453e7c4b71c4b7..da06c3a9bbd0a1395d1dbab32deb04dcc854eac8 100644 (file)
@@ -4,6 +4,14 @@ config BR2_ARCH
 config BR2_ENDIAN
        default "BIG"
 
+# symbols used to distinguish between m68k and coldfire
+# for gcc multilib
+config BR2_m68k_m68k
+       bool
+
+config BR2_m68k_cf
+       bool
+
 # coldfire variants will be added later
 choice
        prompt "Target CPU"
@@ -14,8 +22,20 @@ choice
 
 config BR2_m68k_68040
        bool "68040"
+       select BR2_m68k_m68k
+       select BR2_ARCH_HAS_MMU_MANDATORY
+
+config BR2_m68k_cf5208
+       bool "5208"
+       select BR2_m68k_cf
+       select BR2_SOFT_FLOAT
 
 endchoice
 
 config BR2_GCC_TARGET_CPU
        default "68040"         if BR2_m68k_68040
+       default "5208"          if BR2_m68k_cf5208
+
+config BR2_GCC_TARGET_ARCH
+       default "m68k"          if BR2_m68k_m68k
+       default "cf"            if BR2_m68k_cf
diff --git a/package/gcc/4.8.5/891-fix-m68k-uclinux.patch b/package/gcc/4.8.5/891-fix-m68k-uclinux.patch
new file mode 100644 (file)
index 0000000..37c7ac4
--- /dev/null
@@ -0,0 +1,18 @@
+avoids internal compiler error while compiling linux-atomic.c
+See here:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53833
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-4.8.5.orig/libgcc/config.host gcc-4.8.5/libgcc/config.host
+--- gcc-4.8.5.orig/libgcc/config.host  2014-03-20 17:12:30.000000000 +0100
++++ gcc-4.8.5/libgcc/config.host       2016-04-27 15:04:01.521171537 +0200
+@@ -689,7 +689,7 @@
+ m68k*-*-openbsd*)
+       ;;
+ m68k-*-uclinux*)      # Motorola m68k/ColdFire running uClinux with uClibc
+-      tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux"
++      tmake_file="$tmake_file m68k/t-floatlib"
+       md_unwind_header=m68k/linux-unwind.h
+       ;;
+ m68k-*-linux*)                        # Motorola m68k's running GNU/Linux
diff --git a/package/gcc/4.9.3/891-fix-m68k-uclinux.patch b/package/gcc/4.9.3/891-fix-m68k-uclinux.patch
new file mode 100644 (file)
index 0000000..4347642
--- /dev/null
@@ -0,0 +1,18 @@
+avoids internal compiler error while compiling linux-atomic.c
+See here:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53833
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-4.9.3.orig/libgcc/config.host gcc-4.9.3/libgcc/config.host
+--- gcc-4.9.3.orig/libgcc/config.host  2014-03-27 16:40:31.000000000 +0100
++++ gcc-4.9.3/libgcc/config.host       2016-04-05 16:20:53.422809885 +0200
+@@ -750,7 +750,7 @@
+ m68k*-*-openbsd*)
+       ;;
+ m68k-*-uclinux*)      # Motorola m68k/ColdFire running uClinux with uClibc
+-      tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux"
++      tmake_file="$tmake_file m68k/t-floatlib"
+       md_unwind_header=m68k/linux-unwind.h
+       ;;
+ m68k-*-linux*)                        # Motorola m68k's running GNU/Linux
diff --git a/package/gcc/5.3.0/891-fix-m68k-uclinux.patch b/package/gcc/5.3.0/891-fix-m68k-uclinux.patch
new file mode 100644 (file)
index 0000000..4e186bd
--- /dev/null
@@ -0,0 +1,18 @@
+avoids internal compiler error while compiling linux-atomic.c
+See here:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53833
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-5.3.0.orig/libgcc/config.host gcc-5.3.0/libgcc/config.host
+--- gcc-5.3.0.orig/libgcc/config.host  2015-10-01 14:01:18.000000000 +0200
++++ gcc-5.3.0/libgcc/config.host       2016-04-26 21:30:25.353691745 +0200
+@@ -794,7 +794,7 @@
+ m68k*-*-openbsd*)
+       ;;
+ m68k-*-uclinux*)      # Motorola m68k/ColdFire running uClinux with uClibc
+-      tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux"
++      tmake_file="$tmake_file m68k/t-floatlib"
+       md_unwind_header=m68k/linux-unwind.h
+       ;;
+ m68k-*-linux*)                        # Motorola m68k's running GNU/Linux
diff --git a/package/gcc/6.1.0/891-fix-m68k-uclinux.patch b/package/gcc/6.1.0/891-fix-m68k-uclinux.patch
new file mode 100644 (file)
index 0000000..754aa74
--- /dev/null
@@ -0,0 +1,18 @@
+avoids internal compiler error while compiling linux-atomic.c
+See here:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53833
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-6.1.0.orig/libgcc/config.host gcc-6.1.0/libgcc/config.host
+--- gcc-6.1.0.orig/libgcc/config.host  2016-02-26 21:02:28.000000000 +0100
++++ gcc-6.1.0/libgcc/config.host       2016-04-29 09:18:40.377989160 +0200
+@@ -812,7 +812,7 @@
+ m68k*-*-openbsd*)
+       ;;
+ m68k-*-uclinux*)      # Motorola m68k/ColdFire running uClinux with uClibc
+-      tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux"
++      tmake_file="$tmake_file m68k/t-floatlib"
+       md_unwind_header=m68k/linux-unwind.h
+       ;;
+ m68k-*-linux*)                        # Motorola m68k's running GNU/Linux
index 69fdc0c059e25c712f638b76f9cf829ca9d8765d..1d1d72e6e7b03e04c2e4fcc6da0414c4d18ad0ee 100644 (file)
@@ -125,6 +125,15 @@ endef
 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_LD_LINUX_LINK
 endif
 
+# coldfire is not working without removing these object files from libgcc.a
+ifeq ($(BR2_m68k_cf),y)
+define HOST_GCC_FINAL_M68K_LIBGCC_FIXUP
+       find $(STAGING_DIR) -name libgcc.a -print | \
+               while read t; do $(GNU_TARGET_NAME)-ar dv "$t" _ctors.o; done
+endef
+HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_M68K_LIBGCC_FIXUP
+endif
+
 # Cannot use the HOST_GCC_FINAL_USR_LIBS mechanism below, because we want
 # libgcc_s to be installed in /lib and not /usr/lib.
 define HOST_GCC_FINAL_INSTALL_LIBGCC
index 0dfb454f54e9337e836a2b68ffa033a695e03817..b8ccee2cc8c922428f7808dbe5b79f7fc932313f 100644 (file)
@@ -100,6 +100,21 @@ endif
 
 endif # arm
 
+#
+# m68k/coldfire definitions
+#
+
+ifeq ($(UCLIBC_TARGET_ARCH),m68k)
+
+# disable DOPIC for flat without separate data
+ifeq ($(BR2_BINFMT_FLAT_ONE),y)
+define UCLIBC_M68K_BINFMT_FLAT
+       $(call KCONFIG_DISABLE_OPT,DOPIC,$(@D)/.config)
+endef
+endif
+
+endif # m68k/coldfire
+
 #
 # MIPS definitions
 #
@@ -372,6 +387,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS
        $(UCLIBC_ARM_ABI_CONFIG)
        $(UCLIBC_ARM_BINFMT_FLAT)
        $(UCLIBC_ARM_NO_CONTEXT_FUNCS)
+       $(UCLIBC_M68K_BINFMT_FLAT)
        $(UCLIBC_MIPS_ABI_CONFIG)
        $(UCLIBC_MIPS_ISA_CONFIG)
        $(UCLIBC_SH_TYPE_CONFIG)