Skip to content

Commit

Permalink
Merge pull request #622 from stilor/missing-linaro-patches
Browse files Browse the repository at this point in the history
Add patches to Linaro GCC
  • Loading branch information
stilor committed Feb 28, 2017
2 parents ed7e671 + 9928386 commit c8b355e
Show file tree
Hide file tree
Showing 102 changed files with 8,994 additions and 127 deletions.
9 changes: 3 additions & 6 deletions config/cc/gcc.in
Expand Up @@ -86,9 +86,8 @@ config CC_GCC_V_6_3_0

config CC_GCC_V_linaro_5_4
bool
prompt "linaro-5.4-2017.01 (OBSOLETE)"
prompt "linaro-5.4-2017.01"
depends on CC_GCC_SHOW_LINARO
depends on OBSOLETE
select CC_GCC_5

config CC_GCC_V_5_4_0
Expand All @@ -98,15 +97,13 @@ config CC_GCC_V_5_4_0

config CC_GCC_V_linaro_4_9
bool
prompt "linaro-4.9-2017.01 (OBSOLETE)"
prompt "linaro-4.9-2017.01"
depends on CC_GCC_SHOW_LINARO
depends on OBSOLETE
select CC_GCC_4_9

config CC_GCC_V_4_9_4
bool
prompt "4.9.4 (OBSOLETE)"
depends on OBSOLETE
prompt "4.9.4"
select CC_GCC_4_9

config CC_GCC_V_linaro_4_8
Expand Down
129 changes: 129 additions & 0 deletions patches/gcc/linaro-4.8-2015.06/001_gcc_bug_62231.patch
@@ -0,0 +1,129 @@
As-applied. From:

https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02625.html

Linked from bug62231 comment 4 there

diff -durN a/gcc/defaults.h b/gcc/defaults.h
--- a/gcc/defaults.h 2013-01-10 12:38:27.000000000 -0800
+++ b/gcc/defaults.h 2014-12-15 13:26:13.498904465 -0800
@@ -438,6 +438,11 @@
#define DWARF_FRAME_REGNUM(REG) DBX_REGISTER_NUMBER (REG)
#endif

+/* The mapping from dwarf CFA reg number to internal dwarf reg numbers. */
+#ifndef DWARF_REG_TO_UNWIND_COLUMN
+#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
+#endif
+
/* Map register numbers held in the call frame info that gcc has
collected using DWARF_FRAME_REGNUM to those that should be output in
.debug_frame and .eh_frame. */
diff -durN a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
--- a/gcc/dwarf2cfi.c 2013-01-10 12:38:27.000000000 -0800
+++ b/gcc/dwarf2cfi.c 2014-12-15 13:50:24.554883694 -0800
@@ -225,7 +225,44 @@
emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size));
}

-/* Generate code to initialize the register size table. */
+/* Helper for expand_builtin_init_dwarf_reg_sizes. Generate code to
+ initialize the dwarf register size table entry corresponding to register
+ REGNO in REGMODE. TABLE is the table base address, SLOTMODE is the mode
+ to use for the size entry to initialize, and WROTE_RETURN_COLUMN needs to
+ be set to true if the dwarf register number for REGNO is the dwarf return
+ column number. */
+
+static
+void init_one_dwarf_reg_size (int regno, enum machine_mode regmode,
+ rtx table, enum machine_mode slotmode,
+ bool *wrote_return_column)
+{
+ const unsigned int dnum = DWARF_FRAME_REGNUM (regno);
+ const unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
+ const unsigned int dcol = DWARF_REG_TO_UNWIND_COLUMN (rnum);
+
+ const HOST_WIDE_INT slotoffset = dcol * GET_MODE_SIZE (slotmode);
+ const HOST_WIDE_INT regsize = GET_MODE_SIZE (regmode);
+
+ if (rnum >= DWARF_FRAME_REGISTERS)
+ return;
+
+ if (dnum == DWARF_FRAME_RETURN_COLUMN)
+ {
+ if (regmode == VOIDmode)
+ return;
+ *wrote_return_column = true;
+ }
+
+ if (slotoffset < 0)
+ return;
+
+ emit_move_insn (adjust_address (table, slotmode, slotoffset),
+ gen_int_mode (regsize, slotmode));
+}
+
+/* Generate code to initialize the dwarf register size table located
+ at the provided ADDRESS. */

void
expand_builtin_init_dwarf_reg_sizes (tree address)
@@ -238,30 +275,21 @@

for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{
- unsigned int dnum = DWARF_FRAME_REGNUM (i);
- unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
-
- if (rnum < DWARF_FRAME_REGISTERS)
- {
- HOST_WIDE_INT offset = rnum * GET_MODE_SIZE (mode);
- enum machine_mode save_mode = reg_raw_mode[i];
- HOST_WIDE_INT size;
-
- if (HARD_REGNO_CALL_PART_CLOBBERED (i, save_mode))
- save_mode = choose_hard_reg_mode (i, 1, true);
- if (dnum == DWARF_FRAME_RETURN_COLUMN)
- {
- if (save_mode == VOIDmode)
- continue;
- wrote_return_column = true;
- }
- size = GET_MODE_SIZE (save_mode);
- if (offset < 0)
- continue;
+ enum machine_mode save_mode = reg_raw_mode[i];
+ rtx span;

- emit_move_insn (adjust_address (mem, mode, offset),
- gen_int_mode (size, mode));
- }
+ span = targetm.dwarf_register_span (gen_rtx_REG (save_mode, i));
+ if (!span)
+ init_one_dwarf_reg_size (i, save_mode, mem, mode, &wrote_return_column);
+ else
+ {
+ for (int si = 0; si < XVECLEN (span, 0); si++)
+ {
+ rtx reg = XVECEXP (span, 0, si);
+ init_one_dwarf_reg_size
+ (REGNO (reg), GET_MODE (reg), mem, mode, &wrote_return_column);
+ }
+ }
}

if (!wrote_return_column)
diff -durN a/libgcc/unwind-dw2.c b/libgcc/unwind-dw2.c
--- a/libgcc/unwind-dw2.c 2013-05-31 16:21:46.000000000 -0700
+++ b/libgcc/unwind-dw2.c 2014-12-15 13:26:13.570904866 -0800
@@ -55,10 +55,6 @@
#define PRE_GCC3_DWARF_FRAME_REGISTERS DWARF_FRAME_REGISTERS
#endif

-#ifndef DWARF_REG_TO_UNWIND_COLUMN
-#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
-#endif
-
/* ??? For the public function interfaces, we tend to gcc_assert that the
column numbers are in range. For the dwarf2 unwind info this does happen,
although so far in a case that doesn't actually matter.
18 changes: 18 additions & 0 deletions patches/gcc/linaro-4.8-2015.06/002_gcc_bug_62231.patch
@@ -0,0 +1,18 @@
As-applied. From:

https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02605.html

Linked from bug62231 comment 4 there

diff -durN a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
--- a/gcc/config/rs6000/rs6000.c 2014-12-08 17:29:04.000000000 -0800
+++ b/gcc/config/rs6000/rs6000.c 2014-12-15 14:44:46.568801843 -0800
@@ -1673,7 +1673,7 @@
SCmode so as to pass the value correctly in a pair of
registers. */
else if (TARGET_E500_DOUBLE && FLOAT_MODE_P (mode) && mode != SCmode
- && !DECIMAL_FLOAT_MODE_P (mode))
+ && !DECIMAL_FLOAT_MODE_P (mode) && SPE_SIMD_REGNO_P (regno))
reg_size = UNITS_PER_FP_WORD;

else
15 changes: 15 additions & 0 deletions patches/gcc/linaro-4.8-2015.06/100-uclibc-conf.patch
@@ -0,0 +1,15 @@
Index: gcc-4.8.0/contrib/regression/objs-gcc.sh
===================================================================
--- gcc-4.8.0.orig/contrib/regression/objs-gcc.sh 2009-04-09 17:00:19.000000000 +0200
+++ gcc-4.8.0/contrib/regression/objs-gcc.sh 2013-03-23 17:39:04.000000000 +0100
@@ -106,6 +106,10 @@
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
@@ -0,0 +1,14 @@
--- gcc-4.9.4/libtool-ldflags 2016-12-20 11:13:12.669668125 -0800
+++ gcc-4.9.4/libtool-ldflags 2016-12-20 11:28:34.894826286 -0800
@@ -36,6 +36,11 @@
for arg
do
case $arg in
+ -framework)
+ # libtool handles this option. It should not be prefixed with
+ # -Xcompiler, as that would split it from the argument that
+ # follows.
+ ;;
-f*|--*)
# Libtool does not ascribe any special meaning options
# that begin with -f or with a double-dash. So, it will
@@ -0,0 +1,122 @@
http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00269.html

On glibc the libc.so carries a copy of the math function copysignl() but
on uClibc math functions like copysignl() live in libm. Since libgcc_s
contains unresolved symbols, any attempt to link against libgcc_s
without explicitely specifying -lm fails, resulting in a broken
bootstrap of the compiler.

Forward port to gcc 4.5.1 by Gustavo Zacarias <gustavo@zacarias.com.ar>

---
libgcc/Makefile.in | 4 +++-
libgcc/configure | 32 ++++++++++++++++++++++++++++++++
libgcc/configure.ac | 21 +++++++++++++++++++++
3 files changed, 56 insertions(+), 1 deletion(-)

Index: gcc-4.8.0/libgcc/Makefile.in
===================================================================
--- gcc-4.8.0.orig/libgcc/Makefile.in 2013-02-04 20:06:20.000000000 +0100
+++ gcc-4.8.0/libgcc/Makefile.in 2013-03-24 09:12:43.000000000 +0100
@@ -41,6 +41,7 @@
decimal_float = @decimal_float@
enable_decimal_float = @enable_decimal_float@
fixed_point = @fixed_point@
+LIBGCC_LIBM = @LIBGCC_LIBM@

host_noncanonical = @host_noncanonical@
target_noncanonical = @target_noncanonical@
@@ -927,9 +928,10 @@
@multilib_dir@,$(MULTIDIR),$(subst \
@shlib_objs@,$(objects) libgcc.a,$(subst \
@shlib_base_name@,libgcc_s,$(subst \
+ @libgcc_libm@,$(LIBGCC_LIBM),$(subst \
@shlib_map_file@,$(mapfile),$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
- @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
+ @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK)))))))))

libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
# @multilib_flags@ is still needed because this may use
Index: gcc-4.8.0/libgcc/configure
===================================================================
--- gcc-4.8.0.orig/libgcc/configure 2012-11-05 00:08:42.000000000 +0100
+++ gcc-4.8.0/libgcc/configure 2013-03-24 09:12:43.000000000 +0100
@@ -564,6 +564,7 @@
tmake_file
sfp_machine_header
set_use_emutls
+LIBGCC_LIBM
set_have_cc_tls
vis_hide
fixed_point
@@ -4481,6 +4482,37 @@
fi
fi

+# On powerpc libgcc_s references copysignl which is a libm function but
+# glibc apparently also provides it via libc as opposed to uClibc where
+# it lives in libm.
+echo "$as_me:$LINENO: checking for library containing copysignl" >&5
+echo $ECHO_N "checking for library containing copysignl... $ECHO_C" >&6
+if test "${libgcc_cv_copysignl_lib+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ echo '#include <features.h>' > conftest.c
+ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
+ libgcc_cv_copysignl_lib="-lc"
+ if { ac_try='${CC-cc} -S conftest.c -o conftest.s 1>&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+ libgcc_cv_copysignl_lib="-lm"
+ fi
+ rm -f conftest.*
+
+fi
+echo "$as_me:$LINENO: result: $libgcc_cv_copysignl_lib" >&5
+echo "${ECHO_T}$libgcc_cv_copysignl_lib" >&6
+
+case /${libgcc_cv_copysignl_lib}/ in
+ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
+ *) LIBGCC_LIBM= ;;
+esac

# Conditionalize the makefile for this target machine.
tmake_file_=
Index: gcc-4.8.0/libgcc/configure.ac
===================================================================
--- gcc-4.8.0.orig/libgcc/configure.ac 2012-10-15 15:10:30.000000000 +0200
+++ gcc-4.8.0/libgcc/configure.ac 2013-03-24 09:12:43.000000000 +0100
@@ -326,6 +326,27 @@
fi
AC_SUBST(set_have_cc_tls)

+# On powerpc libgcc_s references copysignl which is a libm function but
+# glibc apparently also provides it via libc as opposed to uClibc where
+# it lives in libm.
+AC_CACHE_CHECK
+ libgcc_cv_copysignl_lib,
+ echo '#include <features.h>' > conftest.c
+ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
+ libgcc_cv_copysignl_lib="-lc"
+ if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD)
+ then
+ libgcc_cv_copysignl_lib="-lm"
+ fi
+ rm -f conftest.*
+ ])
+
+case /${libgcc_cv_copysignl_lib}/ in
+ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
+ *) LIBGCC_LIBM= ;;
+esac
+AC_SUBST(LIBGCC_LIBM)
+
# See if we have emulated thread-local storage.
GCC_CHECK_EMUTLS
set_use_emutls=
37 changes: 37 additions & 0 deletions patches/gcc/linaro-4.8-2015.06/111-pr65730.patch
@@ -0,0 +1,37 @@
From b9a7775674d91c7af8043a83211ffeaa576327d7 Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Fri, 10 Apr 2015 17:46:30 +0300
Subject: [PATCH] Fix PR target/65730

2015-05-20 Max Filippov <jcmvbkbc@gmail.com>
gcc/
* config/xtensa/xtensa.c (init_alignment_context): Replace MULT
by BITS_PER_UNIT with ASHIFT by exact_log2 (BITS_PER_UNIT).

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
Backported from: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223452
Changes to ChangeLog are dropped.

gcc/config/xtensa/xtensa.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index eb039ba..7296e36 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1461,8 +1461,9 @@ init_alignment_context (struct alignment_context *ac, rtx mem)
if (ac->shift != NULL_RTX)
{
/* Shift is the byte count, but we need the bitcount. */
- ac->shift = expand_simple_binop (SImode, MULT, ac->shift,
- GEN_INT (BITS_PER_UNIT),
+ gcc_assert (exact_log2 (BITS_PER_UNIT) >= 0);
+ ac->shift = expand_simple_binop (SImode, ASHIFT, ac->shift,
+ GEN_INT (exact_log2 (BITS_PER_UNIT)),
NULL_RTX, 1, OPTAB_DIRECT);
ac->modemask = expand_simple_binop (SImode, ASHIFT,
GEN_INT (GET_MODE_MASK (mode)),
--
1.8.1.4

25 changes: 25 additions & 0 deletions patches/gcc/linaro-4.8-2015.06/130-pr43538.patch
@@ -0,0 +1,25 @@
From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001
From: glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 25 Apr 2014 08:03:08 +0000
Subject: [PATCH] 2014-04-25 Marc Glisse <marc.glisse@inria.fr>

PR target/43538
* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
config/mt-gnu | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/mt-gnu b/config/mt-gnu
index 15bf417..5c696f5 100644
--- a/config/mt-gnu
+++ b/config/mt-gnu
@@ -1 +1 @@
-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
+CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE
--
2.1.4

0 comments on commit c8b355e

Please sign in to comment.