1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 00:59:48 +00:00

gcc: Upgrade 7.2 -> 7.3

The static PIE patch was updated by Juro Bystricky <juro.bystricky@intel.com>
to work with gcc 7.3.

This update from the stable gcc 7 branch includes the retpoline
functionality which is useful to assist with recent security issues.

Two backported patches were dropped as they're included in 7.3.

(From OE-Core rev: 99b1998157ecbd2bc8ac7c24fae859d48b152f58)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2018-01-23 17:03:26 -08:00
parent c770664d31
commit c23734c45f
61 changed files with 56 additions and 293 deletions
@@ -1,52 +0,0 @@
From 5cbb8e6b1122092b3eaabd4270b2f316aa40407c Mon Sep 17 00:00:00 2001
From: ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 31 Oct 2017 18:27:52 +0000
Subject: [PATCH] PR rtl-optimization/81803 * lra-constraints.c
(curr_insn_transform): Also reload the whole register for a strict subreg
no wider than a word if this is for a WORD_REGISTER_OPERATIONS target.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254275 138bc75d-0d04-0410-961f-82ee72b054a4
Upstream-Status: Backport
This patch removes changes to Changelog from the original patch upstream. This is
because we are backporting a patch to a stable version, making changes to Changelog,
especially up '* GCC 7.2.0 released.', feels a little weird.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
gcc/lra-constraints.c | 11 ++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index a423f069836..3758409bb9c 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -4207,8 +4207,9 @@ curr_insn_transform (bool check_only_p)
reg = SUBREG_REG (*loc);
byte = SUBREG_BYTE (*loc);
if (REG_P (reg)
- /* Strict_low_part requires reload the register not
- the sub-register. */
+ /* Strict_low_part requires reloading the register and not
+ just the subreg. Likewise for a strict subreg no wider
+ than a word for WORD_REGISTER_OPERATIONS targets. */
&& (curr_static_id->operand[i].strict_low
|| (!paradoxical_subreg_p (mode, GET_MODE (reg))
&& (hard_regno
@@ -4219,7 +4220,11 @@ curr_insn_transform (bool check_only_p)
&& (goal_alt[i] == NO_REGS
|| (simplify_subreg_regno
(ira_class_hard_regs[goal_alt[i]][0],
- GET_MODE (reg), byte, mode) >= 0)))))
+ GET_MODE (reg), byte, mode) >= 0)))
+ || (GET_MODE_PRECISION (mode)
+ < GET_MODE_PRECISION (GET_MODE (reg))
+ && GET_MODE_SIZE (GET_MODE (reg)) <= UNITS_PER_WORD
+ && WORD_REGISTER_OPERATIONS)))
{
/* An OP_INOUT is required when reloading a subreg of a
mode wider than a word to ensure that data beyond the
--
2.13.0
@@ -1,37 +0,0 @@
From 44ef80688b56beea85c0070840dea1e2a4e34aed Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 13 Jun 2017 12:12:52 -0700
Subject: [PATCH 49/49] gcc: Enable static PIE
Static PIE support in GCC
see
https://gcc.gnu.org/ml/gcc/2015-06/msg00008.html
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/gnu-user.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 2787a3d16be..ee7b781319e 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,10 +51,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined HAVE_LD_PIE
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{!shared: %{pg|p|profile:gcrt1.o%s;: \
- %{" PIE_SPEC ":Scrt1.o%s} %{" NO_PIE_SPEC ":crt1.o%s}}} \
- crti.o%s %{static:crtbeginT.o%s;: %{shared:crtbeginS.o%s} \
+ %{" PIE_SPEC ":%{static:rcrt1.o%s;:Scrt1.o%s}} %{" NO_PIE_SPEC ":crt1.o%s}}} \
+ crti.o%s %{shared:crtbeginS.o%s;: \
%{" PIE_SPEC ":crtbeginS.o%s} \
- %{" NO_PIE_SPEC ":crtbegin.o%s}} \
+ %{" NO_PIE_SPEC ":%{static:crtbeginT.o%s;:crtbegin.o%s}}} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
fvtable-verify=std:vtv_start.o%s} \
--
2.13.1
@@ -1,194 +0,0 @@
From 8c18b422211878ba02503462cb22a2cc25a0a325 Mon Sep 17 00:00:00 2001
From: rearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 19 Oct 2017 13:14:55 +0000
Subject: [PATCH] [ARM] PR 82445 - suppress 32-bit aligned ldrd/strd peepholing
with -mno-unaligned-access
Peephole patterns exist in the arm backend to spot load/store
operations to adjacent memory operations in order to convert them into
ldrd/strd instructions. However, when we have strict alignment
enforced, then we can only do this if the accesses are known to be
64-bit aligned; this is unlikely to be the case for most loads. The
patch adds some alignment checking to the code that validates the
addresses for use in the peephole patterns. This should also fix
incorrect generation of ldrd/strd with unaligned accesses that could
previously have occurred on ARMv5e where all such operations must be
64-bit aligned.
I've added some new tests as well. In doing so I discovered that the
ldrd/strd peephole tests could never fail since they would match the
source file name in the scanned assembly as well as any instructions
of the intended type. I've fixed those by tightening the scan results
slightly.
gcc:
* config/arm/arm.c (align_ok_ldrd_strd): New function.
(mem_ok_for_ldrd_strd): New parameter align. Extract the alignment of the
mem into it.
(gen_operands_ldrd_strd): Validate the alignment of the accesses.
testsuite:
* gcc.target/arm/peep-ldrd-1.c: Tighten test scan pattern.
* gcc.target/arm/peep-strd-1.c: Likewise.
* gcc.target/arm/peep-ldrd-2.c: New test.
* gcc.target/arm/peep-strd-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@253891 138bc75d-0d04-0410-961f-82ee72b054a4
---
Upstream-Status: Backport
Signed-off-by: Khem Raj <raj.khem@gmail.com>
gcc/ChangeLog | 8 +++++++
gcc/config/arm/arm.c | 27 ++++++++++++++++++----
gcc/testsuite/ChangeLog | 8 +++++++
gcc/testsuite/gcc.target/arm/peep-ldrd-1.c | 2 +-
.../arm/{peep-ldrd-1.c => peep-ldrd-2.c} | 4 ++--
gcc/testsuite/gcc.target/arm/peep-strd-1.c | 2 +-
.../arm/{peep-strd-1.c => peep-strd-2.c} | 4 ++--
7 files changed, 44 insertions(+), 11 deletions(-)
copy gcc/testsuite/gcc.target/arm/{peep-ldrd-1.c => peep-ldrd-2.c} (63%)
copy gcc/testsuite/gcc.target/arm/{peep-strd-1.c => peep-strd-2.c} (58%)
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 1ded0d2a17d..989957f048e 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -15199,12 +15199,23 @@ operands_ok_ldrd_strd (rtx rt, rtx rt2, rtx rn, HOST_WIDE_INT offset,
return true;
}
+/* Return true if a 64-bit access with alignment ALIGN and with a
+ constant offset OFFSET from the base pointer is permitted on this
+ architecture. */
+static bool
+align_ok_ldrd_strd (HOST_WIDE_INT align, HOST_WIDE_INT offset)
+{
+ return (unaligned_access
+ ? (align >= BITS_PER_WORD && (offset & 3) == 0)
+ : (align >= 2 * BITS_PER_WORD && (offset & 7) == 0));
+}
+
/* Helper for gen_operands_ldrd_strd. Returns true iff the memory
operand MEM's address contains an immediate offset from the base
- register and has no side effects, in which case it sets BASE and
- OFFSET accordingly. */
+ register and has no side effects, in which case it sets BASE,
+ OFFSET and ALIGN accordingly. */
static bool
-mem_ok_for_ldrd_strd (rtx mem, rtx *base, rtx *offset)
+mem_ok_for_ldrd_strd (rtx mem, rtx *base, rtx *offset, HOST_WIDE_INT *align)
{
rtx addr;
@@ -15223,6 +15234,7 @@ mem_ok_for_ldrd_strd (rtx mem, rtx *base, rtx *offset)
gcc_assert (MEM_P (mem));
*offset = const0_rtx;
+ *align = MEM_ALIGN (mem);
addr = XEXP (mem, 0);
@@ -15263,7 +15275,7 @@ gen_operands_ldrd_strd (rtx *operands, bool load,
bool const_store, bool commute)
{
int nops = 2;
- HOST_WIDE_INT offsets[2], offset;
+ HOST_WIDE_INT offsets[2], offset, align[2];
rtx base = NULL_RTX;
rtx cur_base, cur_offset, tmp;
int i, gap;
@@ -15275,7 +15287,8 @@ gen_operands_ldrd_strd (rtx *operands, bool load,
registers, and the corresponding memory offsets. */
for (i = 0; i < nops; i++)
{
- if (!mem_ok_for_ldrd_strd (operands[nops+i], &cur_base, &cur_offset))
+ if (!mem_ok_for_ldrd_strd (operands[nops+i], &cur_base, &cur_offset,
+ &align[i]))
return false;
if (i == 0)
@@ -15389,6 +15402,7 @@ gen_operands_ldrd_strd (rtx *operands, bool load,
/* Swap the instructions such that lower memory is accessed first. */
std::swap (operands[0], operands[1]);
std::swap (operands[2], operands[3]);
+ std::swap (align[0], align[1]);
if (const_store)
std::swap (operands[4], operands[5]);
}
@@ -15402,6 +15416,9 @@ gen_operands_ldrd_strd (rtx *operands, bool load,
if (gap != 4)
return false;
+ if (!align_ok_ldrd_strd (align[0], offset))
+ return false;
+
/* Make sure we generate legal instructions. */
if (operands_ok_ldrd_strd (operands[0], operands[1], base, offset,
false, load))
diff --git a/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c b/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
index eb2b86ee7b6..d49eff6b87e 100644
--- a/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
+++ b/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
@@ -8,4 +8,4 @@ int foo(int a, int b, int* p, int *q)
*p = a;
return a;
}
-/* { dg-final { scan-assembler "ldrd" } } */
+/* { dg-final { scan-assembler "ldrd\\t" } } */
diff --git a/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c b/gcc/testsuite/gcc.target/arm/peep-ldrd-2.c
similarity index 63%
copy from gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
copy to gcc/testsuite/gcc.target/arm/peep-ldrd-2.c
index eb2b86ee7b6..6822c2b1454 100644
--- a/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
+++ b/gcc/testsuite/gcc.target/arm/peep-ldrd-2.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_prefer_ldrd_strd } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mno-unaligned-access" } */
int foo(int a, int b, int* p, int *q)
{
a = p[2] + p[3];
@@ -8,4 +8,4 @@ int foo(int a, int b, int* p, int *q)
*p = a;
return a;
}
-/* { dg-final { scan-assembler "ldrd" } } */
+/* { dg-final { scan-assembler-not "ldrd\\t" } } */
diff --git a/gcc/testsuite/gcc.target/arm/peep-strd-1.c b/gcc/testsuite/gcc.target/arm/peep-strd-1.c
index bd330769599..fe1beac7229 100644
--- a/gcc/testsuite/gcc.target/arm/peep-strd-1.c
+++ b/gcc/testsuite/gcc.target/arm/peep-strd-1.c
@@ -6,4 +6,4 @@ void foo(int a, int b, int* p)
p[2] = a;
p[3] = b;
}
-/* { dg-final { scan-assembler "strd" } } */
+/* { dg-final { scan-assembler "strd\\t" } } */
diff --git a/gcc/testsuite/gcc.target/arm/peep-strd-1.c b/gcc/testsuite/gcc.target/arm/peep-strd-2.c
similarity index 58%
copy from gcc/testsuite/gcc.target/arm/peep-strd-1.c
copy to gcc/testsuite/gcc.target/arm/peep-strd-2.c
index bd330769599..bfc5ebe9eec 100644
--- a/gcc/testsuite/gcc.target/arm/peep-strd-1.c
+++ b/gcc/testsuite/gcc.target/arm/peep-strd-2.c
@@ -1,9 +1,9 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_prefer_ldrd_strd } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mno-unaligned-access" } */
void foo(int a, int b, int* p)
{
p[2] = a;
p[3] = b;
}
-/* { dg-final { scan-assembler "strd" } } */
+/* { dg-final { scan-assembler-not "strd\\t" } } */
--
2.15.0
@@ -2,13 +2,13 @@ require gcc-common.inc
# Third digit in PV should be incremented after a minor release
PV = "7.2.0"
PV = "7.3.0"
# BINV should be incremented to a revision after a minor gcc release
BINV = "7.2.0"
BINV = "7.3.0"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-7.2:${FILE_DIRNAME}/gcc-7.2/backport:"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-7.3:${FILE_DIRNAME}/gcc-7.3/backport:"
DEPENDS =+ "mpfr gmp libmpc zlib"
NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
@@ -78,11 +78,10 @@ SRC_URI = "\
${BACKPORTS} \
"
BACKPORTS = "\
file://0051-ARM-PR-82445-suppress-32-bit-aligned-ldrd-strd-peeph.patch \
file://0001-PR-rtl-optimization-81803.patch \
"
SRC_URI[md5sum] = "ff370482573133a7fcdd96cd2f552292"
SRC_URI[sha256sum] = "1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a"
SRC_URI[md5sum] = "be2da21680f27624f3a87055c4ba5af2"
SRC_URI[sha256sum] = "832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/git"
@@ -138,16 +138,16 @@ index 68a558e9992..060cd7169c6 100644
@opindex Wfloat-equal
@opindex Wno-float-equal
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 120c5c0792a..6315aa0dd16 100644
index c48178f..f63d53d 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1035,6 +1035,8 @@ proper position among the other output files. */
@@ -1029,6 +1029,8 @@ proper position among the other output files. */
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \
+ %{Wno-poison-system-directories:--no-poison-system-directories} \
+ %{Werror=poison-system-directories:--error-poison-system-directories} \
%{static:} %{L*} %(mfwrap) %(link_libgcc) " \
%{static|no-pie:} %{L*} %(mfwrap) %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
diff --git a/gcc/incpath.c b/gcc/incpath.c
@@ -0,0 +1,46 @@
From 44ef80688b56beea85c0070840dea1e2a4e34aed Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 13 Jun 2017 12:12:52 -0700
Subject: [PATCH 49/49] gcc: Enable static PIE
Static PIE support in GCC
see
https://gcc.gnu.org/ml/gcc/2015-06/msg00008.html
startfiles before patch:
-static -> crt1.o crti.o crtbeginT.o
-static -PIE -> crt1.o crti.o crtbeginT.o
after patch:
-static -> crt1.o crti.o crtbeginT.o
-static -PIE -> rcrt1.o crti.o crtbeginS.o
Upstream-Status: Pending
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
---
gcc/config/gnu-user.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index de605b0..b035bbe 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -52,11 +52,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:gcrt1.o%s; \
- static:crt1.o%s; \
+ static: %{" PIE_SPEC ": rcrt1.o%s; :crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} \
crti.o%s \
- %{static:crtbeginT.o%s; \
+ %{static: %{" PIE_SPEC ": crtbeginS.o%s; :crtbeginT.o%s}; \
shared|" PIE_SPEC ":crtbeginS.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
2.13.1
+1
View File
@@ -105,6 +105,7 @@ gcclibdir = "${libdir}/gcc"
BINV = "${PV}"
#S = "${WORKDIR}/gcc-${PV}"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
target_includedir ?= "${includedir}"