Skip to content

Commit

Permalink
toolchain/gcc: add 6.1.0
Browse files Browse the repository at this point in the history
-fno-plt and musl-libc patches already get upstream, then dropped
in GCC 6. Other patches are almost identical compared to GCC 5.4.

Compile and run tested on ar71xx/Qihoo C301 and
mvebu/Linksys WRT1900ac v1

Signed-off-by: Syrone Wong <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]> [cleanups/fixes]
  • Loading branch information
wongsyrone authored and nbd168 committed Jul 15, 2016
1 parent a4e90e2 commit 445604a
Show file tree
Hide file tree
Showing 23 changed files with 892 additions and 0 deletions.
4 changes: 4 additions & 0 deletions toolchain/gcc/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ choice
bool "gcc 5.x"
depends on !arc

config GCC_USE_VERSION_6
bool "gcc 6.x"
depends on !arc

endchoice

config GCC_USE_GRAPHITE
Expand Down
1 change: 1 addition & 0 deletions toolchain/gcc/Config.version
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ config GCC_VERSION_4_8_ARC
config GCC_VERSION
string
default "arc-2016.03" if GCC_VERSION_4_8_ARC
default "6.1.0" if GCC_USE_VERSION_6
default "5.4.0"

config GCC_VERSION_4_8
Expand Down
4 changes: 4 additions & 0 deletions toolchain/gcc/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ ifeq ($(PKG_VERSION),5.4.0)
PKG_MD5SUM:=4c626ac2a83ef30dfb9260e6f59c2b30
endif

ifeq ($(PKG_VERSION),6.1.0)
PKG_MD5SUM:=8fb6cb98b8459f5863328380fbf06bd1
endif

ifneq ($(CONFIG_GCC_VERSION_4_8_ARC),)
PKG_VERSION:=4.8.5
PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/archive/arc-2016.03
Expand Down
65 changes: 65 additions & 0 deletions toolchain/gcc/patches/6.1.0/001-revert_register_mode_search.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Revert of:

commit 275035b56823b26d5fb7e90fad945b998648edf2
Author: bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu Sep 5 14:09:07 2013 +0000

PR target/58139
* reginfo.c (choose_hard_reg_mode): Scan through all mode classes
looking for widest mode.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4


--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -625,35 +625,40 @@ choose_hard_reg_mode (unsigned int regno
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) hard_regno_nregs[regno][mode] == nregs
&& HARD_REGNO_MODE_OK (regno, mode)
- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;

+ if (found_mode != VOIDmode)
+ return found_mode;
+
for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) hard_regno_nregs[regno][mode] == nregs
&& HARD_REGNO_MODE_OK (regno, mode)
- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;

+ if (found_mode != VOIDmode)
+ return found_mode;
+
for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) hard_regno_nregs[regno][mode] == nregs
&& HARD_REGNO_MODE_OK (regno, mode)
- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;

+ if (found_mode != VOIDmode)
+ return found_mode;
+
for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) hard_regno_nregs[regno][mode] == nregs
&& HARD_REGNO_MODE_OK (regno, mode)
- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;

if (found_mode != VOIDmode)
14 changes: 14 additions & 0 deletions toolchain/gcc/patches/6.1.0/002-case_insensitive.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/include/filenames.h
+++ b/include/filenames.h
@@ -43,11 +43,6 @@ extern "C" {
# define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
#else /* not DOSish */
-# if defined(__APPLE__)
-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
-# endif
-# endif /* __APPLE__ */
# define HAS_DRIVE_SPEC(f) (0)
# define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
23 changes: 23 additions & 0 deletions toolchain/gcc/patches/6.1.0/010-documentation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3021,18 +3021,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)

-doc/%.info: %.texi
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/%.info:

# Duplicate entry to handle renaming of gccinstall.info
-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/gccinstall.info:

doc/cpp.dvi: $(TEXI_CPP_FILES)
doc/gcc.dvi: $(TEXI_GCC_FILES)
33 changes: 33 additions & 0 deletions toolchain/gcc/patches/6.1.0/100-uclibc-conf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--- a/contrib/regression/objs-gcc.sh
+++ b/contrib/regression/objs-gcc.sh
@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
then
make all-gdb all-dejagnu all-ld || exit 1
make install-gdb install-dejagnu install-ld || exit 1
+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
+ then
+ make all-gdb all-dejagnu all-ld || exit 1
+ make install-gdb install-dejagnu install-ld || exit 1
elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
make bootstrap || exit 1
make install || exit 1
--- a/libjava/classpath/ltconfig
+++ b/libjava/classpath/ltconfig
@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-

# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case $host_os in
-linux-gnu*) ;;
+linux-gnu*|linux-uclibc*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac

@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
;;

# This must be Linux ELF.
-linux-gnu*)
+linux*)
version_type=linux
need_lib_prefix=no
need_version=no
13 changes: 13 additions & 0 deletions toolchain/gcc/patches/6.1.0/230-musl_libssp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -858,7 +858,9 @@ proper position among the other output f
#endif

#ifndef LINK_SSP_SPEC
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if DEFAULT_LIBC == LIBC_MUSL
+#define LINK_SSP_SPEC "-lssp_nonshared"
+#elif defined(TARGET_LIBC_PROVIDES_SSP)
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit:}"
#else
11 changes: 11 additions & 0 deletions toolchain/gcc/patches/6.1.0/800-arm_v5te_no_ldrd_strd.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -166,7 +166,7 @@ extern void (*arm_lang_output_object_att
/* Thumb-1 only. */
#define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)

-#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
+#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
&& !TARGET_THUMB1)

#define TARGET_CRC32 (arm_arch_crc)
25 changes: 25 additions & 0 deletions toolchain/gcc/patches/6.1.0/810-arm-softfloat-libgcc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--- a/libgcc/config/arm/t-linux
+++ b/libgcc/config/arm/t-linux
@@ -1,6 +1,10 @@
LIB1ASMSRC = arm/lib1funcs.S
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
+ _arm_fixsfsi _arm_fixunssfsi

# Just for these, we omit the frame pointer since it makes such a big
# difference.
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -60,8 +60,6 @@
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"

-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
-
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"

#define LINUX_TARGET_LINK_SPEC "%{h*} \
36 changes: 36 additions & 0 deletions toolchain/gcc/patches/6.1.0/820-libgcc_pic.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -888,11 +888,12 @@ $(libgcov-driver-objects): %$(objext): $

# Static libraries.
libgcc.a: $(libgcc-objects)
+libgcc_pic.a: $(libgcc-s-objects)
libgcov.a: $(libgcov-objects)
libunwind.a: $(libunwind-objects)
libgcc_eh.a: $(libgcc-eh-objects)

-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
-rm -f $@

objects="$(objects)"; \
@@ -913,7 +914,7 @@ all: libunwind.a
endif

ifeq ($(enable_shared),yes)
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1115,6 +1116,10 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a

+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
+
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
13 changes: 13 additions & 0 deletions toolchain/gcc/patches/6.1.0/830-arm_unbreak_armv4t.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
http://sourceware.org/ml/crossgcc/2008-05/msg00009.html

--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -45,7 +45,7 @@
The ARM10TDMI core is the default for armv5t, so set
SUBTARGET_CPU_DEFAULT to achieve this. */
#undef SUBTARGET_CPU_DEFAULT
-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi

/* TARGET_BIG_ENDIAN_DEFAULT is set in
config.gcc for big endian configurations. */
19 changes: 19 additions & 0 deletions toolchain/gcc/patches/6.1.0/840-armv4_pass_fix-v4bx_to_ld.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -94,10 +94,15 @@
#define MUSL_DYNAMIC_LINKER \
"/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"

+/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC
+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
+
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
#undef LINK_SPEC
-#define LINK_SPEC EABI_LINK_SPEC \
+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)

47 changes: 47 additions & 0 deletions toolchain/gcc/patches/6.1.0/850-use_shared_libgcc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -132,10 +132,6 @@
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)

-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
- do not use -lfloat. */
-#undef LIBGCC_SPEC
-
/* Clear the instruction cache from `beg' to `end'. This is
implemented in lib1funcs.S, so ensure an error if this definition
is used. */
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -53,6 +53,10 @@ see the files COPYING3 and COPYING.RUNTI
builtin_assert ("system=posix"); \
} while (0)

+#ifndef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
+#endif
+
/* Determine which dynamic linker to use depending on whether GLIBC or
uClibc or Bionic or musl is the default C library and whether
-muclibc or -mglibc or -mbionic or -mmusl has been passed to change
--- a/libgcc/mkmap-symver.awk
+++ b/libgcc/mkmap-symver.awk
@@ -132,5 +132,5 @@ function output(lib) {
else if (inherit[lib])
printf("} %s;\n", inherit[lib]);
else
- printf ("\n local:\n\t*;\n};\n");
+ printf ("\n\t*;\n};\n");
}
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -60,6 +60,9 @@
#undef CPP_OS_DEFAULT_SPEC
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"

+#undef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+
#undef LINK_SHLIB_SPEC
#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"

12 changes: 12 additions & 0 deletions toolchain/gcc/patches/6.1.0/851-libgcc_no_compat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/libgcc/config/t-libunwind
+++ b/libgcc/config/t-libunwind
@@ -2,8 +2,7 @@

HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER

-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c

# Override the default value from t-slibgcc-elf-ver and mention -lunwind
11 changes: 11 additions & 0 deletions toolchain/gcc/patches/6.1.0/870-ppc_no_crtsavres.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -23090,7 +23090,7 @@ rs6000_savres_strategy (rs6000_stack_t *
/* Define cutoff for using out-of-line functions to save registers. */
if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
{
- if (!optimize_size)
+ if (1)
{
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
11 changes: 11 additions & 0 deletions toolchain/gcc/patches/6.1.0/880-no_java_section.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -395,7 +395,7 @@ see the files COPYING3 and COPYING.RUNTI
/* If we have named section and we support weak symbols, then use the
.jcr section for recording java classes which need to be registered
at program start-up time. */
-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
+#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
#ifndef JCR_SECTION_NAME
#define JCR_SECTION_NAME ".jcr"
#endif
9 changes: 9 additions & 0 deletions toolchain/gcc/patches/6.1.0/900-bad-mips16-crt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16

# Version these symbols if building libgcc.so.
SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+
+CRTSTUFF_T_CFLAGS += -mno-mips16
+CRTSTUFF_T_CFLAGS_S += -mno-mips16
Loading

0 comments on commit 445604a

Please sign in to comment.