Commit a8095c99 authored by Bernhard Rosenkränzer's avatar Bernhard Rosenkränzer Committed by Richard Purdie
Browse files

gcc: upgrade 11.2 -> current 12 snapshot


gcc 12 is expected to be released this month or early next month.
Update so we're prepared.
This keeps/ports all patches currently applied to 11.2 that haven't
landed upstream yet.

[v2: Back out the zephyr DWARF-4 workaround]

(From OE-Core rev: 540116ca70fb71ac489b61b74b3a397ff92f27e2)
Signed-off-by: default avatarBernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
Signed-off-by: default avatarRichard Purdie <richard.purdie@linuxfoundation.org>
No related merge requests found
Showing with 28 additions and 5512 deletions
+28 -5512
......@@ -2,11 +2,14 @@ require gcc-common.inc
# Third digit in PV should be incremented after a minor release
PV = "11.2.0"
PV = "12.0.1"
# BINV should be incremented to a revision after a minor gcc release
BINV = "11.2.0"
BINV = "12.0.1"
MAJOR = "12"
SNAPSHOT = "20220313"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:"
......@@ -26,7 +29,7 @@ LIC_FILES_CHKSUM = "\
#RELEASE ?= "5b2ac9b40c325e9209c0bd55955db84aad4a0cc5"
#BASEURI ?= "https://github.com/gcc-mirror/gcc/archive/${RELEASE}.zip;downloadfilename=gcc-${PV}-${RELEASE}.zip"
BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz \
BASEURI ?= "https://mirror.koddos.net/gcc/snapshots/${MAJOR}-${SNAPSHOT}/gcc-${MAJOR}-${SNAPSHOT}.tar.xz \
"
SRC_URI = "\
${BASEURI} \
......@@ -36,43 +39,27 @@ SRC_URI = "\
file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
file://0009-cpp-honor-sysroot.patch \
file://0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
file://0012-gcc-Fix-argument-list-too-long-error.patch \
file://0014-libtool.patch \
file://0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
file://0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
file://0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
file://0018-export-CPP.patch \
file://0019-Ensure-target-gcc-headers-can-be-included.patch \
file://0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
file://0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
file://0024-handle-sysroot-support-for-nativesdk-gcc.patch \
file://0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
file://0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
file://0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
file://0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
file://0030-sync-gcc-stddef.h-with-musl.patch \
file://0033-Re-introduce-spe-commandline-options.patch \
file://0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
file://0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
file://0036-mingw32-Enable-operation_not_supported.patch \
file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \
file://0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch \
file://0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch \
file://0001-Fix-install-path-of-linux64.h.patch \
file://0001-CVE-2021-35465.patch \
file://0002-CVE-2021-35465.patch \
file://0003-CVE-2021-35465.patch \
file://0004-CVE-2021-35465.patch \
file://0001-CVE-2021-42574.patch \
file://0002-CVE-2021-42574.patch \
file://0003-CVE-2021-42574.patch \
file://0004-CVE-2021-42574.patch \
file://0001-CVE-2021-46195.patch \
file://0042-Fix-thread-stack-size-init.patch \
"
SRC_URI[sha256sum] = "d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b"
SRC_URI[sha256sum] = "979d8cbe9b2ed2ab4434f52097754e004a207cf6541aea3e167c5d0f74957633"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${MAJOR}-${SNAPSHOT}"
# For dev release snapshotting
#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${RELEASE}"
......
......@@ -2,7 +2,7 @@ require gcc-configure-common.inc
SUMMARY = "Runtime libraries from GCC"
# Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPL-3.0-only"
# Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPLv3"
# All gcc-runtime packages are now covered by the runtime exception.
LICENSE = "GPL-3.0-with-GCC-exception"
......
From 3929bca9ca95de9d35e82ae8828b188029e3eb70 Mon Sep 17 00:00:00 2001
From: Richard Earnshaw <rearnsha@arm.com>
Date: Fri, 11 Jun 2021 16:02:05 +0100
Subject: [PATCH] arm: Add command-line option for enabling CVE-2021-35465
mitigation [PR102035]
Add a new option, -mfix-cmse-cve-2021-35465 and document it. Enable it
automatically for cortex-m33, cortex-m35p and cortex-m55.
gcc:
PR target/102035
* config/arm/arm.opt (mfix-cmse-cve-2021-35465): New option.
* doc/invoke.texi (Arm Options): Document it.
* config/arm/arm-cpus.in (quirk_vlldm): New feature bit.
(ALL_QUIRKS): Add quirk_vlldm.
(cortex-m33): Add quirk_vlldm.
(cortex-m35p, cortex-m55): Likewise.
* config/arm/arm.c (arm_option_override): Enable fix_vlldm if
targetting an affected CPU and not explicitly controlled on
the command line.
CVE: CVE-2021-35465
Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=3929bca9ca95de9d35e82ae8828b188029e3eb70]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
gcc/config/arm/arm-cpus.in | 9 +++++++--
gcc/config/arm/arm.c | 9 +++++++++
gcc/config/arm/arm.opt | 4 ++++
gcc/doc/invoke.texi | 9 +++++++++
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
--- a/gcc/config/arm/arm.c 2021-11-15 02:13:11.100579812 -0800
+++ b/gcc/config/arm/arm.c 2021-11-15 02:17:36.988237692 -0800
@@ -3610,6 +3610,15 @@ arm_option_override (void)
fix_cm3_ldrd = 0;
}
+ /* Enable fix_vlldm by default if required. */
+ if (fix_vlldm == 2)
+ {
+ if (bitmap_bit_p (arm_active_target.isa, isa_bit_quirk_vlldm))
+ fix_vlldm = 1;
+ else
+ fix_vlldm = 0;
+ }
+
/* Hot/Cold partitioning is not currently supported, since we can't
handle literal pool placement in that case. */
if (flag_reorder_blocks_and_partition)
diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in
--- a/gcc/config/arm/arm-cpus.in 2021-11-15 02:13:11.104579747 -0800
+++ b/gcc/config/arm/arm-cpus.in 2021-11-15 02:17:36.984237757 -0800
@@ -186,6 +186,9 @@ define feature quirk_armv6kz
# Cortex-M3 LDRD quirk.
define feature quirk_cm3_ldrd
+# v8-m/v8.1-m VLLDM errata.
+define feature quirk_vlldm
+
# Don't use .cpu assembly directive
define feature quirk_no_asmcpu
@@ -322,7 +325,7 @@ define implied vfp_base MVE MVE_FP ALL_F
# architectures.
# xscale isn't really a 'quirk', but it isn't an architecture either and we
# need to ignore it for matching purposes.
-define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd xscale quirk_no_asmcpu
+define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd quirk_vlldm xscale quirk_no_asmcpu
define fgroup IGNORE_FOR_MULTILIB cdecp0 cdecp1 cdecp2 cdecp3 cdecp4 cdecp5 cdecp6 cdecp7
@@ -1570,6 +1573,7 @@ begin cpu cortex-m33
architecture armv8-m.main+dsp+fp
option nofp remove ALL_FP
option nodsp remove armv7em
+ isa quirk_vlldm
costs v7m
end cpu cortex-m33
@@ -1579,6 +1583,7 @@ begin cpu cortex-m35p
architecture armv8-m.main+dsp+fp
option nofp remove ALL_FP
option nodsp remove armv7em
+ isa quirk_vlldm
costs v7m
end cpu cortex-m35p
@@ -1590,7 +1595,7 @@ begin cpu cortex-m55
option nomve remove mve mve_float
option nofp remove ALL_FP mve_float
option nodsp remove MVE mve_float
- isa quirk_no_asmcpu
+ isa quirk_no_asmcpu quirk_vlldm
costs v7m
vendor 41
end cpu cortex-m55
diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt
--- a/gcc/config/arm/arm.opt 2021-11-15 02:13:11.104579747 -0800
+++ b/gcc/config/arm/arm.opt 2021-11-15 02:17:36.988237692 -0800
@@ -268,6 +268,10 @@ Target Var(fix_cm3_ldrd) Init(2)
Avoid overlapping destination and address registers on LDRD instructions
that may trigger Cortex-M3 errata.
+mfix-cmse-cve-2021-35465
+Target Var(fix_vlldm) Init(2)
+Mitigate issues with VLLDM on some M-profile devices (CVE-2021-35465).
+
munaligned-access
Target Var(unaligned_access) Init(2) Save
Enable unaligned word and halfword accesses to packed data.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
--- a/gcc/doc/invoke.texi 2021-11-15 02:13:11.112579616 -0800
+++ b/gcc/doc/invoke.texi 2021-11-15 02:17:36.996237562 -0800
@@ -804,6 +804,7 @@ Objective-C and Objective-C++ Dialects}.
-mverbose-cost-dump @gol
-mpure-code @gol
-mcmse @gol
+-mfix-cmse-cve-2021-35465 @gol
-mfdpic}
@emph{AVR Options}
@@ -20487,6 +20488,14 @@ Generate secure code as per the "ARMv8-M
Development Tools Engineering Specification", which can be found on
@url{https://developer.arm.com/documentation/ecm0359818/latest/}.
+@item -mfix-cmse-cve-2021-35465
+@opindex mfix-cmse-cve-2021-35465
+Mitigate against a potential security issue with the @code{VLLDM} instruction
+in some M-profile devices when using CMSE (CVE-2021-365465). This option is
+enabled by default when the option @option{-mcpu=} is used with
+@code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option
+@option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
+
@item -mfdpic
@itemx -mno-fdpic
@opindex mfdpic
From f10bec5ffa487ad3033ed5f38cfd0fc7d696deab Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Mon, 31 Jan 2022 14:28:42 +0000
Subject: [PATCH] libiberty: Fix infinite recursion in rust demangler.
libiberty/
PR demangler/98886
PR demangler/99935
* rust-demangle.c (struct rust_demangler): Add a recursion
counter.
(demangle_path): Increment/decrement the recursion counter upon
entry and exit. Fail if the counter exceeds a fixed limit.
(demangle_type): Likewise.
(rust_demangle_callback): Initialise the recursion counter,
disabling if requested by the option flags.
CVE: CVE-2021-46195
Upstream-Status: Backport
[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=f10bec5ffa487ad3033ed5f38cfd0fc7d696deab]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
libiberty/rust-demangle.c | 47 ++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 6 deletions(-)
diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c
index 18c760491bd..3b24d63892a 100644
--- a/libiberty/rust-demangle.c
+++ b/libiberty/rust-demangle.c
@@ -74,6 +74,12 @@ struct rust_demangler
/* Rust mangling version, with legacy mangling being -1. */
int version;
+ /* Recursion depth. */
+ unsigned int recursion;
+ /* Maximum number of times demangle_path may be called recursively. */
+#define RUST_MAX_RECURSION_COUNT 1024
+#define RUST_NO_RECURSION_LIMIT ((unsigned int) -1)
+
uint64_t bound_lifetime_depth;
};
@@ -671,6 +677,15 @@ demangle_path (struct rust_demangler *rdm, int in_value)
if (rdm->errored)
return;
+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
+ {
+ ++ rdm->recursion;
+ if (rdm->recursion > RUST_MAX_RECURSION_COUNT)
+ /* FIXME: There ought to be a way to report
+ that the recursion limit has been reached. */
+ goto fail_return;
+ }
+
switch (tag = next (rdm))
{
case 'C':
@@ -688,10 +703,7 @@ demangle_path (struct rust_demangler *rdm, int in_value)
case 'N':
ns = next (rdm);
if (!ISLOWER (ns) && !ISUPPER (ns))
- {
- rdm->errored = 1;
- return;
- }
+ goto fail_return;
demangle_path (rdm, in_value);
@@ -776,9 +788,15 @@ demangle_path (struct rust_demangler *rdm, int in_value)
}
break;
default:
- rdm->errored = 1;
- return;
+ goto fail_return;
}
+ goto pass_return;
+
+ fail_return:
+ rdm->errored = 1;
+ pass_return:
+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
+ -- rdm->recursion;
}
static void
@@ -870,6 +888,19 @@ demangle_type (struct rust_demangler *rdm)
return;
}
+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
+ {
+ ++ rdm->recursion;
+ if (rdm->recursion > RUST_MAX_RECURSION_COUNT)
+ /* FIXME: There ought to be a way to report
+ that the recursion limit has been reached. */
+ {
+ rdm->errored = 1;
+ -- rdm->recursion;
+ return;
+ }
+ }
+
switch (tag)
{
case 'R':
@@ -1030,6 +1061,9 @@ demangle_type (struct rust_demangler *rdm)
rdm->next--;
demangle_path (rdm, 0);
}
+
+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
+ -- rdm->recursion;
}
/* A trait in a trait object may have some "existential projections"
@@ -1320,6 +1354,7 @@ rust_demangle_callback (const char *mangled, int options,
rdm.skipping_printing = 0;
rdm.verbose = (options & DMGL_VERBOSE) != 0;
rdm.version = 0;
+ rdm.recursion = (options & DMGL_NO_RECURSE_LIMIT) ? RUST_NO_RECURSION_LIMIT : 0;
rdm.bound_lifetime_depth = 0;
/* Rust symbols always start with _R (v0) or _ZN (legacy). */
--
2.27.0
......@@ -4,6 +4,7 @@ Date: Fri, 29 Mar 2013 08:37:11 +0400
Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com> [ported to gcc 12]
Upstream-Status: Inappropriate [embedded specific]
---
......@@ -12,10 +13,10 @@ Upstream-Status: Inappropriate [embedded specific]
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 504f6410274..bcebad264ec 100755
index f7e0fa46c9c..ce1f596e4ca 100755
--- a/configure
+++ b/configure
@@ -9728,7 +9728,7 @@ fi
@@ -10177,7 +10177,7 @@ fi
# for target_alias and gcc doesn't manage it consistently.
target_configargs="--cache-file=./config.cache ${target_configargs}"
......@@ -25,10 +26,10 @@ index 504f6410274..bcebad264ec 100755
*" newlib "*)
case " $target_configargs " in
diff --git a/configure.ac b/configure.ac
index 088e735c5db..1289fe08760 100644
index 434b1a267a4..a139a3c80ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3240,7 +3240,7 @@ fi
@@ -3348,7 +3348,7 @@ fi
# for target_alias and gcc doesn't manage it consistently.
target_configargs="--cache-file=./config.cache ${target_configargs}"
......
From 574e7950bd6b34e9e2cacce18c802b45505d1d0a Mon Sep 17 00:00:00 2001
From: Richard Earnshaw <rearnsha@arm.com>
Date: Fri, 18 Jun 2021 17:16:25 +0100
Subject: [PATCH] arm: add erratum mitigation to __gnu_cmse_nonsecure_call
[PR102035]
Add the recommended erratum mitigation sequence to
__gnu_cmse_nonsecure_call for use on Armv8-m.main devices. Since this
is in the library code we cannot know in advance whether the core we
are running on will be affected by this, so always enable it.
libgcc:
PR target/102035
* config/arm/cmse_nonsecure_call.S (__gnu_cmse_nonsecure_call):
Add vlldm erratum work-around.
CVE: CVE-2021-35465
Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=574e7950bd6b34e9e2cacce18c802b45505d1d0a]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
libgcc/config/arm/cmse_nonsecure_call.S | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S
--- a/libgcc/config/arm/cmse_nonsecure_call.S
+++ b/libgcc/config/arm/cmse_nonsecure_call.S
@@ -102,6 +102,11 @@ blxns r4
#ifdef __ARM_PCS_VFP
vpop.f64 {d8-d15}
#else
+/* VLLDM erratum mitigation sequence. */
+mrs r5, control
+tst r5, #8 /* CONTROL_S.SFPA */
+it ne
+.inst.w 0xeeb00a40 /* vmovne s0, s0 */
vlldm sp /* Lazy restore of d0-d16 and FPSCR. */
add sp, sp, #0x88 /* Free space used to save floating point registers. */
#endif /* __ARM_PCS_VFP */
......@@ -14,14 +14,15 @@ wants this to be a failure, they can add "-Werror=poison-system-directories".
Upstream-Status: Pending
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com> [ported to gcc 12]
---
gcc/common.opt | 4 ++++
gcc/config.in | 10 ++++++++++
gcc/configure | 19 +++++++++++++++++++
gcc/configure.ac | 16 ++++++++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.c | 9 +++++++--
gcc/incpath.c | 21 +++++++++++++++++++++
gcc/gcc.cc | 9 +++++++--
gcc/incpath.cc | 21 +++++++++++++++++++++
7 files changed, 86 insertions(+), 2 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
......@@ -158,10 +159,10 @@ index 7a368959e5e..6659a903bf0 100644
@item -Wfloat-equal
@opindex Wfloat-equal
@opindex Wno-float-equal
diff --git a/gcc/gcc.c b/gcc/gcc.c
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 7837553958b..19c75b6e20d 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1152,6 +1152,8 @@ proper position among the other output files. */
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\
......@@ -185,10 +186,10 @@ index 7837553958b..19c75b6e20d 100644
/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
diff --git a/gcc/incpath.c b/gcc/incpath.c
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index 446d280321d..fbfc0ce03b8 100644
--- a/gcc/incpath.c
+++ b/gcc/incpath.c
--- a/gcc/incpath.cc
+++ b/gcc/incpath.cc
@@ -26,6 +26,7 @@
#include "intl.h"
#include "incpath.h"
......
From 30461cf8dba3d3adb15a125e4da48800eb2b9b8f Mon Sep 17 00:00:00 2001
From: Richard Earnshaw <rearnsha@arm.com>
Date: Fri, 18 Jun 2021 17:18:37 +0100
Subject: [PATCH] arm: fix vlldm erratum for Armv8.1-m [PR102035]
For Armv8.1-m we generate code that emits VLLDM directly and do not
rely on support code in the library, so emit the mitigation directly
as well, when required. In this case, we can use the compiler options
to determine when to apply the fix and when it is safe to omit it.
gcc:
PR target/102035
* config/arm/arm.md (attribute arch): Add fix_vlldm.
(arch_enabled): Use it.
* config/arm/vfp.md (lazy_store_multiple_insn): Add alternative to
use when erratum mitigation is needed.
CVE: CVE-2021-35465
Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=30461cf8dba3d3adb15a125e4da48800eb2b9b8f]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
gcc/config/arm/arm.md | 11 +++++++++--
gcc/config/arm/vfp.md | 10 +++++++---
2 files changed, 16 insertions(+), 5 deletions(-)
diff -upr a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
--- a/gcc/config/arm/arm.md 2020-07-22 23:35:17.344384552 -0700
+++ b/gcc/config/arm/arm.md 2021-11-11 20:33:58.431543947 -0800
@@ -132,9 +132,12 @@
; TARGET_32BIT, "t1" or "t2" to specify a specific Thumb mode. "v6"
; for ARM or Thumb-2 with arm_arch6, and nov6 for ARM without
; arm_arch6. "v6t2" for Thumb-2 with arm_arch6 and "v8mb" for ARMv8-M
-; Baseline. This attribute is used to compute attribute "enabled",
+; Baseline. "fix_vlldm" is for fixing the v8-m/v8.1-m VLLDM erratum.
+; This attribute is used to compute attribute "enabled",
; use type "any" to enable an alternative in all cases.
-(define_attr "arch" "any,a,t,32,t1,t2,v6,nov6,v6t2,v8mb,iwmmxt,iwmmxt2,armv6_or_vfpv3,neon,mve"
+(define_attr "arch" "any, a, t, 32, t1, t2, v6,nov6, v6t2, \
+ v8mb, fix_vlldm, iwmmxt, iwmmxt2, armv6_or_vfpv3, \
+ neon, mve"
(const_string "any"))
(define_attr "arch_enabled" "no,yes"
@@ -177,6 +180,10 @@
(match_test "TARGET_THUMB1 && arm_arch8"))
(const_string "yes")
+ (and (eq_attr "arch" "fix_vlldm")
+ (match_test "fix_vlldm"))
+ (const_string "yes")
+
(and (eq_attr "arch" "iwmmxt2")
(match_test "TARGET_REALLY_IWMMXT2"))
(const_string "yes")
diff -upr a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
--- a/gcc/config/arm/vfp.md 2020-07-22 23:35:17.356384684 -0700
+++ b/gcc/config/arm/vfp.md 2021-11-11 20:33:58.431543947 -0800
@@ -1703,12 +1703,15 @@
(set_attr "type" "mov_reg")]
)
+;; Both this and the next instruction are treated by GCC in the same
+;; way as a blockage pattern. That's perhaps stronger than it needs
+;; to be, but we do not want accesses to the VFP register bank to be
+;; moved across either instruction.
+
(define_insn "lazy_store_multiple_insn"
- [(set (match_operand:SI 0 "s_register_operand" "+&rk")
- (post_dec:SI (match_dup 0)))
- (unspec_volatile [(const_int 0)
- (mem:SI (post_dec:SI (match_dup 0)))]
- VUNSPEC_VLSTM)]
+ [(unspec_volatile
+ [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk"))]
+ VUNSPEC_VLSTM)]
"use_cmse && reload_completed"
"vlstm%?\\t%0"
[(set_attr "predicable" "yes")
@@ -1716,14 +1719,16 @@
)
(define_insn "lazy_load_multiple_insn"
- [(set (match_operand:SI 0 "s_register_operand" "+&rk")
- (post_inc:SI (match_dup 0)))
- (unspec_volatile:SI [(const_int 0)
- (mem:SI (match_dup 0))]
- VUNSPEC_VLLDM)]
+ [(unspec_volatile
+ [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk,rk"))]
+ VUNSPEC_VLLDM)]
"use_cmse && reload_completed"
- "vlldm%?\\t%0"
- [(set_attr "predicable" "yes")
+ "@
+ vscclrm\\t{vpr}\;vlldm\\t%0
+ vlldm\\t%0"
+ [(set_attr "arch" "fix_vlldm,*")
+ (set_attr "predicable" "no")
+ (set_attr "length" "8,4")
(set_attr "type" "load_4")]
)
From 1a7f2c0774129750fdf73e9f1b78f0ce983c9ab3 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Tue, 2 Nov 2021 09:54:32 -0400
Subject: [PATCH] libcpp: escape non-ASCII source bytes in -Wbidi-chars=
[PR103026]
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
This flags rich_locations associated with -Wbidi-chars= so that
non-ASCII bytes will be escaped when printing the source lines
(using the diagnostics support I added in
r12-4825-gbd5e882cf6e0def3dd1bc106075d59a303fe0d1e).
In particular, this ensures that the printed source lines will
be pure ASCII, and thus the visual ordering of the characters
will be the same as the logical ordering.
Before:
Wbidi-chars-1.c: In function âmainâ:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | /*â® } â¦if (isAdmin)⩠⦠begin admins only */
| ^
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | /* end admins only â® { â¦*/
| ^
Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
6 | int LRE_âª_PDF_\u202c;
| ^
Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
8 | int LRE_\u202a_PDF_â¬_;
| ^
Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
10 | const char *s1 = "LRE_âª_PDF_\u202c";
| ^
Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
12 | const char *s2 = "LRE_\u202a_PDF_â¬";
| ^
After:
Wbidi-chars-1.c: In function âmainâ:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
| ^
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | /* end admins only <U+202E> { <U+2066>*/
| ^
Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
6 | int LRE_<U+202A>_PDF_\u202c;
| ^
Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
8 | int LRE_\u202a_PDF_<U+202C>_;
| ^
Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
10 | const char *s1 = "LRE_<U+202A>_PDF_\u202c";
| ^
Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
12 | const char *s2 = "LRE_\u202a_PDF_<U+202C>";
| ^
libcpp/ChangeLog:
PR preprocessor/103026
* lex.c (maybe_warn_bidi_on_close): Use a rich_location
and call set_escape_on_output (true) on it.
(maybe_warn_bidi_on_char): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
CVE: CVE-2021-42574
Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=1a7f2c0774129750fdf73e9f1b78f0ce983c9ab3]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
libcpp/lex.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 8188e33b07d..2421d6c0f40 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1427,9 +1427,11 @@ maybe_warn_bidi_on_close (cpp_reader *pfile, const uchar *p)
const location_t loc
= linemap_position_for_column (pfile->line_table,
CPP_BUF_COLUMN (pfile->buffer, p));
- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
- "unpaired UTF-8 bidirectional control character "
- "detected");
+ rich_location rich_loc (pfile->line_table, loc);
+ rich_loc.set_escape_on_output (true);
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "unpaired UTF-8 bidirectional control character "
+ "detected");
}
/* We're done with this context. */
bidi::on_close ();
@@ -1454,6 +1456,9 @@ maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind,
const location_t loc
= linemap_position_for_column (pfile->line_table,
CPP_BUF_COLUMN (pfile->buffer, p));
+ rich_location rich_loc (pfile->line_table, loc);
+ rich_loc.set_escape_on_output (true);
+
/* It seems excessive to warn about a PDI/PDF that is closing
an opened context because we've already warned about the
opening character. Except warn when we have a UCN x UTF-8
@@ -1462,20 +1467,20 @@ maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind,
{
if (warn_bidi == bidirectional_unpaired
&& bidi::current_ctx_ucn_p () != ucn_p)
- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
- "UTF-8 vs UCN mismatch when closing "
- "a context by \"%s\"", bidi::to_str (kind));
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "UTF-8 vs UCN mismatch when closing "
+ "a context by \"%s\"", bidi::to_str (kind));
}
else if (warn_bidi == bidirectional_any)
{
if (kind == bidi::kind::PDF || kind == bidi::kind::PDI)
- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
- "\"%s\" is closing an unopened context",
- bidi::to_str (kind));
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "\"%s\" is closing an unopened context",
+ bidi::to_str (kind));
else
- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
- "found problematic Unicode character \"%s\"",
- bidi::to_str (kind));
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "found problematic Unicode character \"%s\"",
+ bidi::to_str (kind));
}
}
/* We're done with this context. */
--
2.27.0
......@@ -22,13 +22,14 @@ gcc/ChangeLog:
* gcc.c: Pass sysroot options to cpp for preprocessed source
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com> [ported to gcc 12]
[YOCTO #2074]
Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582725.html]
---
gcc/cp/lang-specs.h | 2 +-
gcc/gcc.c | 2 +-
gcc/gcc.cc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: gcc-11.2.0/gcc/cp/lang-specs.h
......@@ -44,10 +45,10 @@ Index: gcc-11.2.0/gcc/cp/lang-specs.h
" %{!fsyntax-only:"
" %{fmodule-only:%{!S:-o %g.s%V}}"
" %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
Index: gcc-11.2.0/gcc/gcc.c
Index: gcc-11.2.0/gcc/gcc.cc
===================================================================
--- gcc-11.2.0.orig/gcc/gcc.c
+++ gcc-11.2.0/gcc/gcc.c
--- gcc-11.2.0.orig/gcc/gcc.cc
+++ gcc-11.2.0/gcc/gcc.cc
@@ -1470,7 +1470,7 @@ static const struct compiler default_com
%W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
{".i", "@cpp-output", 0, 0, 0},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment