Sync up with buildroot GCC 6.2.0 patches.

Additionally, copy from 5.4.0:
- 910-nios2-bad-multilib-default.patch (needed for nios2 sample)
- 930-libgcc-disable-split-stack-nothreads.patch (applicable to 6.2.0 as well)

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2016-11-29 11:15:21 -08:00
parent e3c764cc2d
commit 3285ccbd3e
11 changed files with 2243 additions and 166 deletions

View File

@ -0,0 +1,69 @@
From 07453188b18a2cbe815917dbb893b4ebfdd793b6 Mon Sep 17 00:00:00 2001
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 26 Aug 2016 10:23:20 +0000
Subject: [PATCH] [ARM] PR target/70473: Reduce size of Cortex-A8 automaton
PR target/70473
* config/arm/cortex-a8-neon.md (cortex_a8_vfp_muld): Reduce
reservation duration to 15 cycles.
(cortex_a8_vfp_macs): Likewise.
(cortex_a8_vfp_macd): Likewise.
(cortex_a8_vfp_divs): Likewise.
(cortex_a8_vfp_divd): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239772
138bc75d-0d04-0410-961f-82ee72b054a4
[Backport from gcc upstream commit 79f5d5e3cd5a668d5ecb2b6b0cce80ef5706ac53.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
gcc/config/arm/cortex-a8-neon.md | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/gcc/config/arm/cortex-a8-neon.md b/gcc/config/arm/cortex-a8-neon.md
index 45f861f..b16c299 100644
--- a/gcc/config/arm/cortex-a8-neon.md
+++ b/gcc/config/arm/cortex-a8-neon.md
@@ -357,30 +357,34 @@
(eq_attr "type" "fmuls"))
"cortex_a8_vfp,cortex_a8_vfplite*11")
+;; Don't model a reservation for more than 15 cycles as this explodes the
+;; state space of the automaton for little gain. It is unlikely that the
+;; scheduler will find enough instructions to hide the full latency of the
+;; instructions.
(define_insn_reservation "cortex_a8_vfp_muld" 17
(and (eq_attr "tune" "cortexa8")
(eq_attr "type" "fmuld"))
- "cortex_a8_vfp,cortex_a8_vfplite*16")
+ "cortex_a8_vfp,cortex_a8_vfplite*15")
(define_insn_reservation "cortex_a8_vfp_macs" 21
(and (eq_attr "tune" "cortexa8")
(eq_attr "type" "fmacs,ffmas"))
- "cortex_a8_vfp,cortex_a8_vfplite*20")
+ "cortex_a8_vfp,cortex_a8_vfplite*15")
(define_insn_reservation "cortex_a8_vfp_macd" 26
(and (eq_attr "tune" "cortexa8")
(eq_attr "type" "fmacd,ffmad"))
- "cortex_a8_vfp,cortex_a8_vfplite*25")
+ "cortex_a8_vfp,cortex_a8_vfplite*15")
(define_insn_reservation "cortex_a8_vfp_divs" 37
(and (eq_attr "tune" "cortexa8")
(eq_attr "type" "fdivs, fsqrts"))
- "cortex_a8_vfp,cortex_a8_vfplite*36")
+ "cortex_a8_vfp,cortex_a8_vfplite*15")
(define_insn_reservation "cortex_a8_vfp_divd" 65
(and (eq_attr "tune" "cortexa8")
(eq_attr "type" "fdivd, fsqrtd"))
- "cortex_a8_vfp,cortex_a8_vfplite*64")
+ "cortex_a8_vfp,cortex_a8_vfplite*15")
;; Comparisons can actually take 7 cycles sometimes instead of four,
;; but given all the other instructions lumped into type=ffarith that
--
2.7.4

View File

@ -1,166 +0,0 @@
Fetched from Xilinx gcc git at https://github.com/Xilinx/gcc
From 23c35173490ac2d6348a668dfc9c1a6eb62171f2 Mon Sep 17 00:00:00 2001
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Date: Mon, 18 Jun 2012 20:18:13 +0200
Subject: [PATCH] [Patch, microblaze]: Enable DWARF exception handling support.
Changelog
2013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
David Holsgrove <david.holsgrove@xilinx.com>
* common/config/microblaze/microblaze-common.c: Remove
TARGET_EXCEPT_UNWIND_INFO definition.
* config/microblaze/microblaze-protos.h: Add
microblaze_eh_return prototype.
* gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
microblaze_expand_epilogue, microblaze_return_addr): Handle
calls_eh_return
(microblaze_eh_return): New function.
* gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
ASM_PREFERRED_EH_DATA_FORMAT
* gcc/config/microblaze/microblaze.md: Define eh_return pattern.
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
gcc/common/config/microblaze/microblaze-common.c | 3 ---
gcc/config/microblaze/microblaze-protos.h | 1 +
gcc/config/microblaze/microblaze.c | 29 ++++++++++++++++++++----
gcc/config/microblaze/microblaze.h | 15 ++++++++++++
gcc/config/microblaze/microblaze.md | 11 +++++++++
5 files changed, 52 insertions(+), 7 deletions(-)
Index: b/gcc/common/config/microblaze/microblaze-common.c
===================================================================
--- a/gcc/common/config/microblaze/microblaze-common.c
+++ b/gcc/common/config/microblaze/microblaze-common.c
@@ -37,7 +37,4 @@
#undef TARGET_OPTION_OPTIMIZATION_TABLE
#define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table
-#undef TARGET_EXCEPT_UNWIND_INFO
-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
-
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
Index: b/gcc/config/microblaze/microblaze-protos.h
===================================================================
--- a/gcc/config/microblaze/microblaze-protos.h
+++ b/gcc/config/microblaze/microblaze-protos.h
@@ -56,6 +56,7 @@
extern int symbol_mentioned_p (rtx);
extern int label_mentioned_p (rtx);
extern bool microblaze_cannot_force_const_mem (machine_mode, rtx);
+extern void microblaze_eh_return (rtx op0);
#endif /* RTX_CODE */
/* Declare functions in microblaze-c.c. */
Index: b/gcc/config/microblaze/microblaze.c
===================================================================
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -1959,6 +1959,11 @@
if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM))
return 1;
+ if (crtl->calls_eh_return
+ && regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) {
+ return 1;
+ }
+
if (!crtl->is_leaf)
{
if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM)
@@ -1986,6 +1991,13 @@
return 1;
}
+ if (crtl->calls_eh_return
+ && (regno == EH_RETURN_DATA_REGNO (0)
+ || regno == EH_RETURN_DATA_REGNO (1)))
+ {
+ return 1;
+ }
+
return 0;
}
@@ -3067,6 +3079,12 @@
emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx));
}
+ if (crtl->calls_eh_return)
+ emit_insn (gen_addsi3 (stack_pointer_rtx,
+ stack_pointer_rtx,
+ gen_rtx_raw_REG (SImode,
+ MB_EH_STACKADJ_REGNUM)));
+
emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST +
MB_ABI_SUB_RETURN_ADDR_REGNUM)));
}
@@ -3364,10 +3382,13 @@
if (count != 0)
return NULL_RTX;
- return gen_rtx_PLUS (Pmode,
- get_hard_reg_initial_val (Pmode,
- MB_ABI_SUB_RETURN_ADDR_REGNUM),
- GEN_INT (8));
+ return get_hard_reg_initial_val (Pmode,
+ MB_ABI_SUB_RETURN_ADDR_REGNUM);
+}
+
+void microblaze_eh_return (rtx op0)
+{
+ emit_insn (gen_movsi(gen_rtx_MEM(Pmode, stack_pointer_rtx), op0));
}
/* Queue an .ident string in the queue of top-level asm statements.
Index: b/gcc/config/microblaze/microblaze.h
===================================================================
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -184,6 +184,21 @@
#define INCOMING_RETURN_ADDR_RTX \
gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM)
+/* Specifies the offset from INCOMING_RETURN_ADDR_RTX and the actual return PC. */
+#define RETURN_ADDR_OFFSET (8)
+
+/* Describe how we implement __builtin_eh_return. */
+#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? MB_ABI_FIRST_ARG_REGNUM + (N) : INVALID_REGNUM)
+
+#define MB_EH_STACKADJ_REGNUM MB_ABI_INT_RETURN_VAL2_REGNUM
+#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, MB_EH_STACKADJ_REGNUM)
+
+/* Select a format to encode pointers in exception handling data. CODE
+ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
+ true if the symbol may be affected by dynamic relocations. */
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
+ ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
+
/* Use DWARF 2 debugging information by default. */
#define DWARF2_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
Index: b/gcc/config/microblaze/microblaze.md
===================================================================
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -2272,4 +2272,15 @@
(set_attr "mode" "SI")
(set_attr "length" "4")])
+; This is used in compiling the unwind routines.
+(define_expand "eh_return"
+ [(use (match_operand 0 "general_operand" ""))]
+ ""
+ "
+{
+ microblaze_eh_return(operands[0]);
+ DONE;
+}")
+
(include "sync.md")
+

View File

@ -0,0 +1,15 @@
remove unused header, which breaks the toolchain building
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
diff -Nur gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c gcc-5.3.0/libgcc/config/m68k/linux-atomic.c
--- gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c 2015-01-05 13:33:28.000000000 +0100
+++ gcc-5.3.0/libgcc/config/m68k/linux-atomic.c 2016-03-19 09:25:07.000000000 +0100
@@ -33,7 +33,6 @@
using the kernel helper defined below. There is no support for
64-bit operations yet. */
-#include <asm/unistd.h>
#include <stdbool.h>
#ifndef __NR_atomic_cmpxchg_32

View File

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

View File

@ -0,0 +1,60 @@
From ae9c3e354440c4a0f105a9eabfb2f77be085ebc1 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Thu, 18 Aug 2016 17:59:16 +0200
Subject: [PATCH] libgcc/mkmap-symver: support skip_underscore
Some platforms, such as Blackfin, have a special prefix for assembly
symbols as opposed to C symbols. For this reason, a function named
"foo()" in C will in fact be visible as a symbol called "_foo" in the
ELF binary.
The current linker version script logic in libgcc doesn't take into
account this situation properly. The Blackfin specific
libgcc/config/bfin/libgcc-glibc.ver has an additional "_" in front of
every symbol so that it matches the output of "nm" (which gets parsed to
produce the final linker version script). But due to this additional
"_", ld no longer matches with the symbols since "ld" does the matching
with the original symbol name, not the one prefixed with "_".
Due to this, none of the symbols in libgcc/config/bfin/libgcc-glibc.ver
are actually matched with symbols in libgcc. This causes all libgcc
symbols to be left as "LOCAL", which causes lots of "undefined
reference" whenever some C or C++ code that calls a function of libgcc
is compiled.
To address this, this commit introduces a "skip_underscore" variable to
the mkmap-symver script. It tells mkmap-symver to ignore the leading
underscore from the "nm" output.
Note that this new argument is different from the existing
"leading_underscore" argument, which *adds* an additional underscore to
the generated linker version script.
Having this functionality paves the way to using the generic linker
version information for Blackfin, instead of using a custom one.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
libgcc/mkmap-symver.awk | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libgcc/mkmap-symver.awk b/libgcc/mkmap-symver.awk
index 266832a..30bb179 100644
--- a/libgcc/mkmap-symver.awk
+++ b/libgcc/mkmap-symver.awk
@@ -47,7 +47,11 @@ state == "nm" && ($1 == "U" || $2 == "U") {
state == "nm" && NF == 3 {
split ($3, s, "@")
- def[s[1]] = 1;
+ if (skip_underscore)
+ symname = substr(s[1], 2);
+ else
+ symname = s[1];
+ def[symname] = 1;
sawsymbol = 1;
next;
}
--
2.7.4

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
From 9d9f97ca5d1ceba66677bf406c9b31027dc1f22e Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Fri, 19 Aug 2016 13:54:46 +0200
Subject: [PATCH] libgcc: fix DWARF compilation with FDPIC targets
The build of unwind-dw2-fde-dip.c currently fails for FDPIC targets with
the following error:
libgcc/unwind-dw2-fde-dip.c:167:31: error: storage size of 'load_base' isn't known
struct elf32_fdpic_loadaddr load_base;
This patch addresses that by defining load_base with the appropriate
type on FDPIC targets. It has been tested on FRV and Blackfin.
Fixes PR gcc/68468.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
libgcc/unwind-dw2-fde-dip.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c
index f7a1c3f..801bce8 100644
--- a/libgcc/unwind-dw2-fde-dip.c
+++ b/libgcc/unwind-dw2-fde-dip.c
@@ -124,7 +124,11 @@ static struct frame_hdr_cache_element
{
_Unwind_Ptr pc_low;
_Unwind_Ptr pc_high;
+#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__
+ struct elf32_fdpic_loadaddr load_base;
+#else
_Unwind_Ptr load_base;
+#endif
const ElfW(Phdr) *p_eh_frame_hdr;
const ElfW(Phdr) *p_dynamic;
struct frame_hdr_cache_element *link;
@@ -163,7 +167,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
struct unw_eh_callback_data *data = (struct unw_eh_callback_data *) ptr;
const ElfW(Phdr) *phdr, *p_eh_frame_hdr, *p_dynamic;
long n, match;
-#ifdef __FRV_FDPIC__
+#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__
struct elf32_fdpic_loadaddr load_base;
#else
_Unwind_Ptr load_base;
@@ -347,7 +351,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
break;
}
}
-# elif defined __FRV_FDPIC__ && defined __linux__
+# elif (defined __FRV_FDPIC__ || defined __BFIN_FDPIC__) && defined __linux__
data->dbase = load_base.got_value;
# else
# error What is DW_EH_PE_datarel base on this platform?
--
2.7.4

View File

@ -0,0 +1,17 @@
enable _REENTRANT when -lpthread is used
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
diff -Nur gcc-6.2.0.orig/gcc/config/bfin/linux.h gcc-6.2.0/gcc/config/bfin/linux.h
--- gcc-6.2.0.orig/gcc/config/bfin/linux.h 2016-01-04 15:30:50.000000000 +0100
+++ gcc-6.2.0/gcc/config/bfin/linux.h 2016-09-30 20:48:17.446636819 +0200
@@ -38,6 +38,9 @@
"%{static:--start-group} %{mfast-fp:-lbffastfp} %G %L %{static:--end-group} \
%{!static:%{mfast-fp:-lbffastfp} %G}"
+#undef CPP_SPEC
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
+
#undef LINK_SPEC
#define LINK_SPEC "\
%{mfdpic: -m elf32bfinfd -z text} %{shared} %{pie} \

View File

@ -0,0 +1,28 @@
diff -ur gcc-6.2.0.orig/gcc/config/nios2/nios2.h gcc-6.2.0/gcc/config/nios2/nios2.h
--- gcc-6.2.0.orig/gcc/config/nios2/nios2.h 2016-11-29 10:27:50.364479625 -0800
+++ gcc-6.2.0/gcc/config/nios2/nios2.h 2016-11-29 10:29:55.069624746 -0800
@@ -63,11 +63,11 @@
#if TARGET_ENDIAN_DEFAULT == 0
# define ASM_SPEC "%{!meb:-EL} %{meb:-EB} %{march=*:-march=%*}"
# define LINK_SPEC_ENDIAN "%{!meb:-EL} %{meb:-EB}"
-# define MULTILIB_DEFAULTS { "EL" }
+# define MULTILIB_DEFAULTS { "mel" }
#else
# define ASM_SPEC "%{!mel:-EB} %{mel:-EL} %{march=*:-march=%*}"
# define LINK_SPEC_ENDIAN "%{!mel:-EB} %{mel:-EL}"
-# define MULTILIB_DEFAULTS { "EB" }
+# define MULTILIB_DEFAULTS { "meb" }
#endif
#define LINK_SPEC LINK_SPEC_ENDIAN \
diff -ur gcc-6.2.0.orig/gcc/config/nios2/t-nios2 gcc-6.2.0/gcc/config/nios2/t-nios2
--- gcc-6.2.0.orig/gcc/config/nios2/t-nios2 2016-11-29 10:27:50.364479625 -0800
+++ gcc-6.2.0/gcc/config/nios2/t-nios2 2016-11-29 10:29:03.517151014 -0800
@@ -22,6 +22,5 @@
# MULTILIB_DIRNAMES = nomul mulx fpu-60-1 fpu-60-2
# MULTILIB_EXCEPTIONS =
-# MULTILIB_OPTIONS += EL/EB
+# MULTILIB_OPTIONS += mel/meb
# MULTILIB_DIRNAMES += le be
-# MULTILIB_MATCHES += EL=mel EB=meb

View File

@ -0,0 +1,14 @@
disable split-stack for non-thread builds
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
diff -Nur gcc-5.3.0.orig/libgcc/config/t-stack gcc-5.3.0/libgcc/config/t-stack
--- gcc-5.3.0.orig/libgcc/config/t-stack 2010-10-01 21:31:49.000000000 +0200
+++ gcc-5.3.0/libgcc/config/t-stack 2016-03-07 03:25:32.000000000 +0100
@@ -1,4 +1,6 @@
# Makefile fragment to provide generic support for -fsplit-stack.
# This should be used in config.host for any host which supports
# -fsplit-stack.
+ifeq ($(enable_threads),yes)
LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c
+endif

View File

@ -0,0 +1,19 @@
Enable POSIX threads for uClinux targets
Reported upstream:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71721
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
diff -Nur gcc-5.4.0.orig/gcc/config.gcc gcc-5.4.0/gcc/config.gcc
--- gcc-5.4.0.orig/gcc/config.gcc 2015-09-10 16:17:53.000000000 +0200
+++ gcc-5.4.0/gcc/config.gcc 2016-07-01 21:26:02.772958441 +0200
@@ -808,6 +808,9 @@
*-*-uclinux*)
extra_options="$extra_options gnu-user.opt"
use_gcc_stdint=wrap
+ case ${enable_threads} in
+ "" | yes | posix) thread_file='posix' ;;
+ esac
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
;;
*-*-rdos*)