summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2021-04-09 12:46:03 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-04-18 11:37:24 +0100
commite237e345fbb640e6123d3c70f9c92002758f7910 (patch)
tree200ae2dc2d2cf841be94874d216af91cbf04e8df /meta
parentb50e51b1c848e0162e693e986be59c15e5e57e5c (diff)
downloadpoky-e237e345fbb640e6123d3c70f9c92002758f7910.tar.gz
gcc: Upgrade to 10.3.0 bug-fix release
Drop aarch64 backports which are already upstream List of bugs fixed is [1] [1] https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED&list_id=298084&resolution=FIXED&target_milestone=10.3 (From OE-Core rev: 023806e0e0de2b0e814e6e38d78bf2faa9661f19) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/conf/distro/include/maintainers.inc2
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.3.inc (renamed from meta/recipes-devtools/gcc/gcc-10.2.inc)12
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian_10.3.bb (renamed from meta/recipes-devtools/gcc/gcc-cross-canadian_10.2.bb)0
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_10.3.bb (renamed from meta/recipes-devtools/gcc/gcc-cross_10.2.bb)0
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk_10.3.bb (renamed from meta/recipes-devtools/gcc/gcc-crosssdk_10.2.bb)0
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_10.3.bb (renamed from meta/recipes-devtools/gcc/gcc-runtime_10.2.bb)0
-rw-r--r--meta/recipes-devtools/gcc/gcc-sanitizers_10.3.bb (renamed from meta/recipes-devtools/gcc/gcc-sanitizers_10.2.bb)0
-rw-r--r--meta/recipes-devtools/gcc/gcc-source_10.3.bb (renamed from meta/recipes-devtools/gcc/gcc-source_10.2.bb)0
-rw-r--r--meta/recipes-devtools/gcc/gcc/0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch66
-rw-r--r--meta/recipes-devtools/gcc/gcc/0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch202
-rw-r--r--meta/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch10
-rw-r--r--meta/recipes-devtools/gcc/gcc/0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch607
-rw-r--r--meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc/0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch658
-rw-r--r--meta/recipes-devtools/gcc/gcc/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch6
-rw-r--r--meta/recipes-devtools/gcc/gcc/0004-64-bit-multilib-hack.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch10
-rw-r--r--meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch6
-rw-r--r--meta/recipes-devtools/gcc/gcc/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch12
-rw-r--r--meta/recipes-devtools/gcc/gcc/0008-fortran-cross-compile-hack.patch6
-rw-r--r--meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch6
-rw-r--r--meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch6
-rw-r--r--meta/recipes-devtools/gcc/gcc/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch12
-rw-r--r--meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch11
-rw-r--r--meta/recipes-devtools/gcc/gcc/0013-Disable-sdt.patch18
-rw-r--r--meta/recipes-devtools/gcc/gcc/0014-libtool.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch14
-rw-r--r--meta/recipes-devtools/gcc/gcc/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0019-Ensure-target-gcc-headers-can-be-included.patch6
-rw-r--r--meta/recipes-devtools/gcc/gcc/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0022-aarch64-Add-support-for-musl-ldso.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch10
-rw-r--r--meta/recipes-devtools/gcc/gcc/0024-handle-sysroot-support-for-nativesdk-gcc.patch15
-rw-r--r--meta/recipes-devtools/gcc/gcc/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch8
-rw-r--r--meta/recipes-devtools/gcc/gcc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch12
-rw-r--r--meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch4
-rw-r--r--meta/recipes-devtools/gcc/gcc/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0030-sync-gcc-stddef.h-with-musl.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0031-fix-segmentation-fault-in-precompiled-header-generat.patch4
-rw-r--r--meta/recipes-devtools/gcc/gcc/0032-Fix-for-testsuite-failure.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0033-Re-introduce-spe-commandline-options.patch6
-rw-r--r--meta/recipes-devtools/gcc/gcc/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch10
-rw-r--r--meta/recipes-devtools/gcc/gcc/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch4
-rw-r--r--meta/recipes-devtools/gcc/gcc/0036-mingw32-Enable-operation_not_supported.patch8
-rw-r--r--meta/recipes-devtools/gcc/gcc/0037-libatomic-Do-not-enforce-march-on-aarch64.patch2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0038-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch (renamed from meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch)13
-rw-r--r--meta/recipes-devtools/gcc/gcc_10.3.bb (renamed from meta/recipes-devtools/gcc/gcc_10.2.bb)0
-rw-r--r--meta/recipes-devtools/gcc/libgcc-initial_10.3.bb (renamed from meta/recipes-devtools/gcc/libgcc-initial_10.2.bb)0
-rw-r--r--meta/recipes-devtools/gcc/libgcc_10.3.bb (renamed from meta/recipes-devtools/gcc/libgcc_10.2.bb)0
-rw-r--r--meta/recipes-devtools/gcc/libgfortran_10.3.bb (renamed from meta/recipes-devtools/gcc/libgfortran_10.2.bb)0
54 files changed, 140 insertions, 1681 deletions
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 6276331857..030a09cd26 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -191,7 +191,7 @@ RECIPE_MAINTAINER_pn-gcc-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Khem Raj <r
191RECIPE_MAINTAINER_pn-gcc-crosssdk-${SDK_SYS} = "Khem Raj <raj.khem@gmail.com>" 191RECIPE_MAINTAINER_pn-gcc-crosssdk-${SDK_SYS} = "Khem Raj <raj.khem@gmail.com>"
192RECIPE_MAINTAINER_pn-gcc-runtime = "Khem Raj <raj.khem@gmail.com>" 192RECIPE_MAINTAINER_pn-gcc-runtime = "Khem Raj <raj.khem@gmail.com>"
193RECIPE_MAINTAINER_pn-gcc-sanitizers = "Khem Raj <raj.khem@gmail.com>" 193RECIPE_MAINTAINER_pn-gcc-sanitizers = "Khem Raj <raj.khem@gmail.com>"
194RECIPE_MAINTAINER_pn-gcc-source-10.2.0 = "Khem Raj <raj.khem@gmail.com>" 194RECIPE_MAINTAINER_pn-gcc-source-10.3.0 = "Khem Raj <raj.khem@gmail.com>"
195RECIPE_MAINTAINER_pn-gconf = "Ross Burton <ross.burton@arm.com>" 195RECIPE_MAINTAINER_pn-gconf = "Ross Burton <ross.burton@arm.com>"
196RECIPE_MAINTAINER_pn-gcr = "Alexander Kanavin <alex.kanavin@gmail.com>" 196RECIPE_MAINTAINER_pn-gcr = "Alexander Kanavin <alex.kanavin@gmail.com>"
197RECIPE_MAINTAINER_pn-gdb = "Khem Raj <raj.khem@gmail.com>" 197RECIPE_MAINTAINER_pn-gdb = "Khem Raj <raj.khem@gmail.com>"
diff --git a/meta/recipes-devtools/gcc/gcc-10.2.inc b/meta/recipes-devtools/gcc/gcc-10.3.inc
index c0cd8b31d5..7fcb058fea 100644
--- a/meta/recipes-devtools/gcc/gcc-10.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-10.3.inc
@@ -2,11 +2,11 @@ require gcc-common.inc
2 2
3# Third digit in PV should be incremented after a minor release 3# Third digit in PV should be incremented after a minor release
4 4
5PV = "10.2.0" 5PV = "10.3.0"
6 6
7# BINV should be incremented to a revision after a minor gcc release 7# BINV should be incremented to a revision after a minor gcc release
8 8
9BINV = "10.2.0" 9BINV = "10.3.0"
10 10
11FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:" 11FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:"
12 12
@@ -65,13 +65,9 @@ SRC_URI = "\
65 file://0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \ 65 file://0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
66 file://0036-mingw32-Enable-operation_not_supported.patch \ 66 file://0036-mingw32-Enable-operation_not_supported.patch \
67 file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \ 67 file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \
68 file://0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch \ 68 file://0038-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch \
69 file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \
70 file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \
71 file://0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch \
72 file://0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch \
73" 69"
74SRC_URI[sha256sum] = "b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c" 70SRC_URI[sha256sum] = "64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344"
75 71
76S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}" 72S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
77# For dev release snapshotting 73# For dev release snapshotting
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_10.2.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_10.3.bb
index bf53c5cd78..bf53c5cd78 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian_10.2.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian_10.3.bb
diff --git a/meta/recipes-devtools/gcc/gcc-cross_10.2.bb b/meta/recipes-devtools/gcc/gcc-cross_10.3.bb
index b43cca0c52..b43cca0c52 100644
--- a/meta/recipes-devtools/gcc/gcc-cross_10.2.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross_10.3.bb
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_10.2.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_10.3.bb
index 40a6c4feff..40a6c4feff 100644
--- a/meta/recipes-devtools/gcc/gcc-crosssdk_10.2.bb
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk_10.3.bb
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_10.2.bb b/meta/recipes-devtools/gcc/gcc-runtime_10.3.bb
index dd430b57eb..dd430b57eb 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime_10.2.bb
+++ b/meta/recipes-devtools/gcc/gcc-runtime_10.3.bb
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_10.2.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_10.3.bb
index f3c7058114..f3c7058114 100644
--- a/meta/recipes-devtools/gcc/gcc-sanitizers_10.2.bb
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers_10.3.bb
diff --git a/meta/recipes-devtools/gcc/gcc-source_10.2.bb b/meta/recipes-devtools/gcc/gcc-source_10.3.bb
index b890fa33ea..b890fa33ea 100644
--- a/meta/recipes-devtools/gcc/gcc-source_10.2.bb
+++ b/meta/recipes-devtools/gcc/gcc-source_10.3.bb
diff --git a/meta/recipes-devtools/gcc/gcc/0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch b/meta/recipes-devtools/gcc/gcc/0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch
deleted file mode 100644
index c060accd99..0000000000
--- a/meta/recipes-devtools/gcc/gcc/0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch
+++ /dev/null
@@ -1,66 +0,0 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From fd2ec4542fd2975e6d3f2f1c1a2639945a84f9e1 Mon Sep 17 00:00:00 2001
5From: Jakub Jelinek <jakub@redhat.com>
6Date: Mon, 3 Aug 2020 22:55:28 +0200
7Subject: [PATCH] aarch64: Fix up __aarch64_cas16_acq_rel fallback
8
9As mentioned in the PR, the fallback path when LSE is unavailable writes
10incorrect registers to the memory if the previous content compares equal
11to x0, x1 - it writes copy of x0, x1 from the start of function, but it
12should write x2, x3.
13
142020-08-03 Jakub Jelinek <jakub@redhat.com>
15
16 PR target/96402
17 * config/aarch64/lse.S (__aarch64_cas16_acq_rel): Use x2, x3 instead
18 of x(tmp0), x(tmp1) in STXP arguments.
19
20 * gcc.target/aarch64/pr96402.c: New test.
21
22(cherry picked from commit 90b43856fdff7d96d93d22970eca8a86c56e0ddc)
23---
24 gcc/testsuite/gcc.target/aarch64/pr96402.c | 16 ++++++++++++++++
25 libgcc/config/aarch64/lse.S | 2 +-
26 2 files changed, 17 insertions(+), 1 deletion(-)
27 create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96402.c
28
29diff --git a/gcc/testsuite/gcc.target/aarch64/pr96402.c b/gcc/testsuite/gcc.target/aarch64/pr96402.c
30new file mode 100644
31index 00000000000..fa2dddfac15
32--- /dev/null
33+++ b/gcc/testsuite/gcc.target/aarch64/pr96402.c
34@@ -0,0 +1,16 @@
35+/* PR target/96402 */
36+/* { dg-do run { target int128 } } */
37+/* { dg-options "-moutline-atomics" } */
38+
39+int
40+main ()
41+{
42+ __int128 a = 0;
43+ __sync_val_compare_and_swap (&a, (__int128) 0, (__int128) 1);
44+ if (a != 1)
45+ __builtin_abort ();
46+ __sync_val_compare_and_swap (&a, (__int128) 1, (((__int128) 0xdeadbeeffeedbac1ULL) << 64) | 0xabadcafe00c0ffeeULL);
47+ if (a != ((((__int128) 0xdeadbeeffeedbac1ULL) << 64) | 0xabadcafe00c0ffeeULL))
48+ __builtin_abort ();
49+ return 0;
50+}
51diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S
52index 64691c601c1..c8fbfbce4fd 100644
53--- a/libgcc/config/aarch64/lse.S
54+++ b/libgcc/config/aarch64/lse.S
55@@ -203,7 +203,7 @@ STARTFN NAME(cas)
56 cmp x0, x(tmp0)
57 ccmp x1, x(tmp1), #0, eq
58 bne 1f
59- STXP w(tmp2), x(tmp0), x(tmp1), [x4]
60+ STXP w(tmp2), x2, x3, [x4]
61 cbnz w(tmp2), 0b
62 1: ret
63
64--
652.26.2
66
diff --git a/meta/recipes-devtools/gcc/gcc/0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch b/meta/recipes-devtools/gcc/gcc/0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch
deleted file mode 100644
index 73de4c7590..0000000000
--- a/meta/recipes-devtools/gcc/gcc/0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch
+++ /dev/null
@@ -1,202 +0,0 @@
1CVE: CVE-2020-13844
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From 1ff243934ac443b5f58cd02a5012ce58ecc31fb2 Mon Sep 17 00:00:00 2001
6From: Matthew Malcomson <matthew.malcomson@arm.com>
7Date: Thu, 9 Jul 2020 09:11:58 +0100
8Subject: [PATCH 1/3] aarch64: New Straight Line Speculation (SLS) mitigation
9 flags
10
11Here we introduce the flags that will be used for straight line speculation.
12
13The new flag introduced is `-mharden-sls=`.
14This flag can take arguments of `none`, `all`, or a comma seperated list of one
15or more of `retbr` or `blr`.
16`none` indicates no special mitigation of the straight line speculation
17vulnerability.
18`all` requests all mitigations currently implemented.
19`retbr` requests that the RET and BR instructions have a speculation barrier
20inserted after them.
21`blr` requests that BLR instructions are replaced by a BL to a function stub
22using a BR with a speculation barrier after it.
23
24Setting this on a per-function basis using attributes or the like is not
25enabled, but may be in the future.
26
27gcc/ChangeLog:
28
292020-06-02 Matthew Malcomson <matthew.malcomson@arm.com>
30
31 * config/aarch64/aarch64-protos.h (aarch64_harden_sls_retbr_p):
32 New.
33 (aarch64_harden_sls_blr_p): New.
34 * config/aarch64/aarch64.c (enum aarch64_sls_hardening_type):
35 New.
36 (aarch64_harden_sls_retbr_p): New.
37 (aarch64_harden_sls_blr_p): New.
38 (aarch64_validate_sls_mitigation): New.
39 (aarch64_override_options): Parse options for SLS mitigation.
40 * config/aarch64/aarch64.opt (-mharden-sls): New option.
41 * doc/invoke.texi: Document new option.
42---
43 gcc/config/aarch64/aarch64-protos.h | 3 ++
44 gcc/config/aarch64/aarch64.c | 76 +++++++++++++++++++++++++++++++++++++
45 gcc/config/aarch64/aarch64.opt | 4 ++
46 gcc/doc/invoke.texi | 12 ++++++
47 4 files changed, 95 insertions(+)
48
49diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
50index 723d9ba..eb5f4b4 100644
51--- a/gcc/config/aarch64/aarch64-protos.h
52+++ b/gcc/config/aarch64/aarch64-protos.h
53@@ -781,4 +781,7 @@ extern const atomic_ool_names aarch64_ool_ldeor_names;
54
55 tree aarch64_resolve_overloaded_builtin_general (location_t, tree, void *);
56
57+extern bool aarch64_harden_sls_retbr_p (void);
58+extern bool aarch64_harden_sls_blr_p (void);
59+
60 #endif /* GCC_AARCH64_PROTOS_H */
61diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
62index b86434a..437a9cf 100644
63--- a/gcc/config/aarch64/aarch64.c
64+++ b/gcc/config/aarch64/aarch64.c
65@@ -14494,6 +14494,79 @@ aarch64_validate_mcpu (const char *str, const struct processor **res,
66 return false;
67 }
68
69+/* Straight line speculation indicators. */
70+enum aarch64_sls_hardening_type
71+{
72+ SLS_NONE = 0,
73+ SLS_RETBR = 1,
74+ SLS_BLR = 2,
75+ SLS_ALL = 3,
76+};
77+static enum aarch64_sls_hardening_type aarch64_sls_hardening;
78+
79+/* Return whether we should mitigatate Straight Line Speculation for the RET
80+ and BR instructions. */
81+bool
82+aarch64_harden_sls_retbr_p (void)
83+{
84+ return aarch64_sls_hardening & SLS_RETBR;
85+}
86+
87+/* Return whether we should mitigatate Straight Line Speculation for the BLR
88+ instruction. */
89+bool
90+aarch64_harden_sls_blr_p (void)
91+{
92+ return aarch64_sls_hardening & SLS_BLR;
93+}
94+
95+/* As of yet we only allow setting these options globally, in the future we may
96+ allow setting them per function. */
97+static void
98+aarch64_validate_sls_mitigation (const char *const_str)
99+{
100+ char *token_save = NULL;
101+ char *str = NULL;
102+
103+ if (strcmp (const_str, "none") == 0)
104+ {
105+ aarch64_sls_hardening = SLS_NONE;
106+ return;
107+ }
108+ if (strcmp (const_str, "all") == 0)
109+ {
110+ aarch64_sls_hardening = SLS_ALL;
111+ return;
112+ }
113+
114+ char *str_root = xstrdup (const_str);
115+ str = strtok_r (str_root, ",", &token_save);
116+ if (!str)
117+ error ("invalid argument given to %<-mharden-sls=%>");
118+
119+ int temp = SLS_NONE;
120+ while (str)
121+ {
122+ if (strcmp (str, "blr") == 0)
123+ temp |= SLS_BLR;
124+ else if (strcmp (str, "retbr") == 0)
125+ temp |= SLS_RETBR;
126+ else if (strcmp (str, "none") == 0 || strcmp (str, "all") == 0)
127+ {
128+ error ("%<%s%> must be by itself for %<-mharden-sls=%>", str);
129+ break;
130+ }
131+ else
132+ {
133+ error ("invalid argument %<%s%> for %<-mharden-sls=%>", str);
134+ break;
135+ }
136+ str = strtok_r (NULL, ",", &token_save);
137+ }
138+ aarch64_sls_hardening = (aarch64_sls_hardening_type) temp;
139+ free (str_root);
140+}
141+
142 /* Parses CONST_STR for branch protection features specified in
143 aarch64_branch_protect_types, and set any global variables required. Returns
144 the parsing result and assigns LAST_STR to the last processed token from
145@@ -14738,6 +14811,9 @@ aarch64_override_options (void)
146 selected_arch = NULL;
147 selected_tune = NULL;
148
149+ if (aarch64_harden_sls_string)
150+ aarch64_validate_sls_mitigation (aarch64_harden_sls_string);
151+
152 if (aarch64_branch_protection_string)
153 aarch64_validate_mbranch_protection (aarch64_branch_protection_string);
154
155diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
156index d99d14c..5170361 100644
157--- a/gcc/config/aarch64/aarch64.opt
158+++ b/gcc/config/aarch64/aarch64.opt
159@@ -71,6 +71,10 @@ mgeneral-regs-only
160 Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Save
161 Generate code which uses only the general registers.
162
163+mharden-sls=
164+Target RejectNegative Joined Var(aarch64_harden_sls_string)
165+Generate code to mitigate against straight line speculation.
166+
167 mfix-cortex-a53-835769
168 Target Report Var(aarch64_fix_a53_err835769) Init(2) Save
169 Workaround for ARM Cortex-A53 Erratum number 835769.
170diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
171index a2794a6..bd5b77a 100644
172--- a/gcc/doc/invoke.texi
173+++ b/gcc/doc/invoke.texi
174@@ -696,6 +696,7 @@ Objective-C and Objective-C++ Dialects}.
175 -msign-return-address=@var{scope} @gol
176 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
177 +@var{b-key}]|@var{bti} @gol
178+-mharden-sls=@var{opts} @gol
179 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
180 -moverride=@var{string} -mverbose-cost-dump @gol
181 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
182@@ -17065,6 +17066,17 @@ functions. The optional argument @samp{b-key} can be used to sign the functions
183 with the B-key instead of the A-key.
184 @samp{bti} turns on branch target identification mechanism.
185
186+@item -mharden-sls=@var{opts}
187+@opindex mharden-sls
188+Enable compiler hardening against straight line speculation (SLS).
189+@var{opts} is a comma-separated list of the following options:
190+@table @samp
191+@item retbr
192+@item blr
193+@end table
194+In addition, @samp{-mharden-sls=all} enables all SLS hardening while
195+@samp{-mharden-sls=none} disables all SLS hardening.
196+
197 @item -msve-vector-bits=@var{bits}
198 @opindex msve-vector-bits
199 Specify the number of bits in an SVE vector register. This option only has
200--
2012.7.4
202
diff --git a/meta/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
index 82ae9f8d14..6beedacf66 100644
--- a/meta/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
+++ b/meta/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -1,4 +1,4 @@
1From f2a5dc3bc7e5727d6bf77e1c6e8a31a6f000883d Mon Sep 17 00:00:00 2001 1From 2b4a66cbe0bd52e77b37dbaee46e2605d3854412 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:37:11 +0400 3Date: Fri, 29 Mar 2013 08:37:11 +0400
4Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET 4Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
@@ -12,10 +12,10 @@ Upstream-Status: Inappropriate [embedded specific]
12 2 files changed, 2 insertions(+), 2 deletions(-) 12 2 files changed, 2 insertions(+), 2 deletions(-)
13 13
14diff --git a/configure b/configure 14diff --git a/configure b/configure
15index 4cc938ebb7d..226a64939d1 100755 15index f2ec106a86e..9350b0cf3ed 100755
16--- a/configure 16--- a/configure
17+++ b/configure 17+++ b/configure
18@@ -7722,7 +7722,7 @@ fi 18@@ -7723,7 +7723,7 @@ fi
19 # for target_alias and gcc doesn't manage it consistently. 19 # for target_alias and gcc doesn't manage it consistently.
20 target_configargs="--cache-file=./config.cache ${target_configargs}" 20 target_configargs="--cache-file=./config.cache ${target_configargs}"
21 21
@@ -25,10 +25,10 @@ index 4cc938ebb7d..226a64939d1 100755
25 *" newlib "*) 25 *" newlib "*)
26 case " $target_configargs " in 26 case " $target_configargs " in
27diff --git a/configure.ac b/configure.ac 27diff --git a/configure.ac b/configure.ac
28index c78d9cbea62..f024f4bac9b 100644 28index 115db3f402a..5ef61255710 100644
29--- a/configure.ac 29--- a/configure.ac
30+++ b/configure.ac 30+++ b/configure.ac
31@@ -3227,7 +3227,7 @@ fi 31@@ -3228,7 +3228,7 @@ fi
32 # for target_alias and gcc doesn't manage it consistently. 32 # for target_alias and gcc doesn't manage it consistently.
33 target_configargs="--cache-file=./config.cache ${target_configargs}" 33 target_configargs="--cache-file=./config.cache ${target_configargs}"
34 34
diff --git a/meta/recipes-devtools/gcc/gcc/0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch b/meta/recipes-devtools/gcc/gcc/0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch
deleted file mode 100644
index 823cc8b668..0000000000
--- a/meta/recipes-devtools/gcc/gcc/0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch
+++ /dev/null
@@ -1,607 +0,0 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From b1204d16e1ec96a4aa89e44de8990e2499ffdb22 Mon Sep 17 00:00:00 2001
5From: Matthew Malcomson <matthew.malcomson@arm.com>
6Date: Thu, 9 Jul 2020 09:11:59 +0100
7Subject: [PATCH 2/3] aarch64: Introduce SLS mitigation for RET and BR
8 instructions
9
10Instructions following RET or BR are not necessarily executed. In order
11to avoid speculation past RET and BR we can simply append a speculation
12barrier.
13
14Since these speculation barriers will not be architecturally executed,
15they are not expected to add a high performance penalty.
16
17The speculation barrier is to be SB when targeting architectures which
18have this enabled, and DSB SY + ISB otherwise.
19
20We add tests for each of the cases where such an instruction was seen.
21
22This is implemented by modifying each machine description pattern that
23emits either a RET or a BR instruction. We choose not to use something
24like `TARGET_ASM_FUNCTION_EPILOGUE` since it does not affect the
25`indirect_jump`, `jump`, `sibcall_insn` and `sibcall_value_insn`
26patterns and we find it preferable to implement the functionality in the
27same way for every pattern.
28
29There is one particular case which is slightly tricky. The
30implementation of TARGET_ASM_TRAMPOLINE_TEMPLATE uses a BR which needs
31to be mitigated against. The trampoline template is used *once* per
32compilation unit, and the TRAMPOLINE_SIZE is exposed to the user via the
33builtin macro __LIBGCC_TRAMPOLINE_SIZE__.
34In the future we may implement function specific attributes to turn on
35and off hardening on a per-function basis.
36The fixed nature of the trampoline described above implies it will be
37safer to ensure this speculation barrier is always used.
38
39Testing:
40 Bootstrap and regtest done on aarch64-none-linux
41 Used a temporary hack(1) to use these options on every test in the
42 testsuite and a script to check that the output never emitted an
43 unmitigated RET or BR.
44
451) Temporary hack was a change to the testsuite to always use
46`-save-temps` and run a script on the assembly output of those
47compilations which produced one to ensure every RET or BR is immediately
48followed by a speculation barrier.
49
50gcc/ChangeLog:
51
52 * config/aarch64/aarch64-protos.h (aarch64_sls_barrier): New.
53 * config/aarch64/aarch64.c (aarch64_output_casesi): Emit
54 speculation barrier after BR instruction if needs be.
55 (aarch64_trampoline_init): Handle ptr_mode value & adjust size
56 of code copied.
57 (aarch64_sls_barrier): New.
58 (aarch64_asm_trampoline_template): Add needed barriers.
59 * config/aarch64/aarch64.h (AARCH64_ISA_SB): New.
60 (TARGET_SB): New.
61 (TRAMPOLINE_SIZE): Account for barrier.
62 * config/aarch64/aarch64.md (indirect_jump, *casesi_dispatch,
63 simple_return, *do_return, *sibcall_insn, *sibcall_value_insn):
64 Emit barrier if needs be, also account for possible barrier using
65 "sls_length" attribute.
66 (sls_length): New attribute.
67 (length): Determine default using any non-default sls_length
68 value.
69
70gcc/testsuite/ChangeLog:
71
72 * gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c: New test.
73 * gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c:
74 New test.
75 * gcc.target/aarch64/sls-mitigation/sls-mitigation.exp: New file.
76 * lib/target-supports.exp (check_effective_target_aarch64_asm_sb_ok):
77 New proc.
78---
79 gcc/config/aarch64/aarch64-protos.h | 1 +
80 gcc/config/aarch64/aarch64.c | 41 ++++++-
81 gcc/config/aarch64/aarch64.h | 10 +-
82 gcc/config/aarch64/aarch64.md | 76 +++++++++----
83 .../aarch64/sls-mitigation/sls-miti-retbr-pacret.c | 21 ++++
84 .../aarch64/sls-mitigation/sls-miti-retbr.c | 119 +++++++++++++++++++++
85 .../aarch64/sls-mitigation/sls-mitigation.exp | 73 +++++++++++++
86 gcc/testsuite/lib/target-supports.exp | 2 +-
87 8 files changed, 318 insertions(+), 25 deletions(-)
88 create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c
89 create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c
90 create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp
91
92diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
93index eb5f4b4..ee0ffde 100644
94--- a/gcc/config/aarch64/aarch64-protos.h
95+++ b/gcc/config/aarch64/aarch64-protos.h
96@@ -781,6 +781,7 @@ extern const atomic_ool_names aarch64_ool_ldeor_names;
97
98 tree aarch64_resolve_overloaded_builtin_general (location_t, tree, void *);
99
100+const char *aarch64_sls_barrier (int);
101 extern bool aarch64_harden_sls_retbr_p (void);
102 extern bool aarch64_harden_sls_blr_p (void);
103
104diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
105index 437a9cf..44e3d1f 100644
106--- a/gcc/config/aarch64/aarch64.c
107+++ b/gcc/config/aarch64/aarch64.c
108@@ -10852,8 +10852,8 @@ aarch64_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
109 static void
110 aarch64_asm_trampoline_template (FILE *f)
111 {
112- int offset1 = 16;
113- int offset2 = 20;
114+ int offset1 = 24;
115+ int offset2 = 28;
116
117 if (aarch64_bti_enabled ())
118 {
119@@ -10876,6 +10876,17 @@ aarch64_asm_trampoline_template (FILE *f)
120 }
121 asm_fprintf (f, "\tbr\t%s\n", reg_names [IP1_REGNUM]);
122
123+ /* We always emit a speculation barrier.
124+ This is because the same trampoline template is used for every nested
125+ function. Since nested functions are not particularly common or
126+ performant we don't worry too much about the extra instructions to copy
127+ around.
128+ This is not yet a problem, since we have not yet implemented function
129+ specific attributes to choose between hardening against straight line
130+ speculation or not, but such function specific attributes are likely to
131+ happen in the future. */
132+ asm_fprintf (f, "\tdsb\tsy\n\tisb\n");
133+
134 /* The trampoline needs an extra padding instruction. In case if BTI is
135 enabled the padding instruction is replaced by the BTI instruction at
136 the beginning. */
137@@ -10890,10 +10901,14 @@ static void
138 aarch64_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
139 {
140 rtx fnaddr, mem, a_tramp;
141- const int tramp_code_sz = 16;
142+ const int tramp_code_sz = 24;
143
144 /* Don't need to copy the trailing D-words, we fill those in below. */
145- emit_block_move (m_tramp, assemble_trampoline_template (),
146+ /* We create our own memory address in Pmode so that `emit_block_move` can
147+ use parts of the backend which expect Pmode addresses. */
148+ rtx temp = convert_memory_address (Pmode, XEXP (m_tramp, 0));
149+ emit_block_move (gen_rtx_MEM (BLKmode, temp),
150+ assemble_trampoline_template (),
151 GEN_INT (tramp_code_sz), BLOCK_OP_NORMAL);
152 mem = adjust_address (m_tramp, ptr_mode, tramp_code_sz);
153 fnaddr = XEXP (DECL_RTL (fndecl), 0);
154@@ -11084,6 +11099,8 @@ aarch64_output_casesi (rtx *operands)
155 output_asm_insn (buf, operands);
156 output_asm_insn (patterns[index][1], operands);
157 output_asm_insn ("br\t%3", operands);
158+ output_asm_insn (aarch64_sls_barrier (aarch64_harden_sls_retbr_p ()),
159+ operands);
160 assemble_label (asm_out_file, label);
161 return "";
162 }
163@@ -22924,6 +22941,22 @@ aarch64_file_end_indicate_exec_stack ()
164 #undef GNU_PROPERTY_AARCH64_FEATURE_1_BTI
165 #undef GNU_PROPERTY_AARCH64_FEATURE_1_AND
166
167+/* Helper function for straight line speculation.
168+ Return what barrier should be emitted for straight line speculation
169+ mitigation.
170+ When not mitigating against straight line speculation this function returns
171+ an empty string.
172+ When mitigating against straight line speculation, use:
173+ * SB when the v8.5-A SB extension is enabled.
174+ * DSB+ISB otherwise. */
175+const char *
176+aarch64_sls_barrier (int mitigation_required)
177+{
178+ return mitigation_required
179+ ? (TARGET_SB ? "sb" : "dsb\tsy\n\tisb")
180+ : "";
181+}
182+
183 /* Target-specific selftests. */
184
185 #if CHECKING_P
186diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
187index 1ce23c6..c21015f 100644
188--- a/gcc/config/aarch64/aarch64.h
189+++ b/gcc/config/aarch64/aarch64.h
190@@ -281,6 +281,7 @@ extern unsigned aarch64_architecture_version;
191 #define AARCH64_ISA_F32MM (aarch64_isa_flags & AARCH64_FL_F32MM)
192 #define AARCH64_ISA_F64MM (aarch64_isa_flags & AARCH64_FL_F64MM)
193 #define AARCH64_ISA_BF16 (aarch64_isa_flags & AARCH64_FL_BF16)
194+#define AARCH64_ISA_SB (aarch64_isa_flags & AARCH64_FL_SB)
195
196 /* Crypto is an optional extension to AdvSIMD. */
197 #define TARGET_CRYPTO (TARGET_SIMD && AARCH64_ISA_CRYPTO)
198@@ -378,6 +379,9 @@ extern unsigned aarch64_architecture_version;
199 #define TARGET_FIX_ERR_A53_835769_DEFAULT 1
200 #endif
201
202+/* SB instruction is enabled through +sb. */
203+#define TARGET_SB (AARCH64_ISA_SB)
204+
205 /* Apply the workaround for Cortex-A53 erratum 835769. */
206 #define TARGET_FIX_ERR_A53_835769 \
207 ((aarch64_fix_a53_err835769 == 2) \
208@@ -1058,8 +1062,10 @@ typedef struct
209
210 #define RETURN_ADDR_RTX aarch64_return_addr
211
212-/* BTI c + 3 insns + 2 pointer-sized entries. */
213-#define TRAMPOLINE_SIZE (TARGET_ILP32 ? 24 : 32)
214+/* BTI c + 3 insns
215+ + sls barrier of DSB + ISB.
216+ + 2 pointer-sized entries. */
217+#define TRAMPOLINE_SIZE (24 + (TARGET_ILP32 ? 8 : 16))
218
219 /* Trampolines contain dwords, so must be dword aligned. */
220 #define TRAMPOLINE_ALIGNMENT 64
221diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
222index 8c8be3c..dda04ee 100644
223--- a/gcc/config/aarch64/aarch64.md
224+++ b/gcc/config/aarch64/aarch64.md
225@@ -407,10 +407,25 @@
226 ;; Attribute that specifies whether the alternative uses MOVPRFX.
227 (define_attr "movprfx" "no,yes" (const_string "no"))
228
229+;; Attribute to specify that an alternative has the length of a single
230+;; instruction plus a speculation barrier.
231+(define_attr "sls_length" "none,retbr,casesi" (const_string "none"))
232+
233 (define_attr "length" ""
234 (cond [(eq_attr "movprfx" "yes")
235 (const_int 8)
236- ] (const_int 4)))
237+
238+ (eq_attr "sls_length" "retbr")
239+ (cond [(match_test "!aarch64_harden_sls_retbr_p ()") (const_int 4)
240+ (match_test "TARGET_SB") (const_int 8)]
241+ (const_int 12))
242+
243+ (eq_attr "sls_length" "casesi")
244+ (cond [(match_test "!aarch64_harden_sls_retbr_p ()") (const_int 16)
245+ (match_test "TARGET_SB") (const_int 20)]
246+ (const_int 24))
247+ ]
248+ (const_int 4)))
249
250 ;; Strictly for compatibility with AArch32 in pipeline models, since AArch64 has
251 ;; no predicated insns.
252@@ -447,8 +462,12 @@
253 (define_insn "indirect_jump"
254 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
255 ""
256- "br\\t%0"
257- [(set_attr "type" "branch")]
258+ {
259+ output_asm_insn ("br\\t%0", operands);
260+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ());
261+ }
262+ [(set_attr "type" "branch")
263+ (set_attr "sls_length" "retbr")]
264 )
265
266 (define_insn "jump"
267@@ -765,7 +784,7 @@
268 "*
269 return aarch64_output_casesi (operands);
270 "
271- [(set_attr "length" "16")
272+ [(set_attr "sls_length" "casesi")
273 (set_attr "type" "branch")]
274 )
275
276@@ -844,18 +863,23 @@
277 [(return)]
278 ""
279 {
280+ const char *ret = NULL;
281 if (aarch64_return_address_signing_enabled ()
282 && TARGET_ARMV8_3
283 && !crtl->calls_eh_return)
284 {
285 if (aarch64_ra_sign_key == AARCH64_KEY_B)
286- return "retab";
287+ ret = "retab";
288 else
289- return "retaa";
290+ ret = "retaa";
291 }
292- return "ret";
293+ else
294+ ret = "ret";
295+ output_asm_insn (ret, operands);
296+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ());
297 }
298- [(set_attr "type" "branch")]
299+ [(set_attr "type" "branch")
300+ (set_attr "sls_length" "retbr")]
301 )
302
303 (define_expand "return"
304@@ -867,8 +891,12 @@
305 (define_insn "simple_return"
306 [(simple_return)]
307 ""
308- "ret"
309- [(set_attr "type" "branch")]
310+ {
311+ output_asm_insn ("ret", operands);
312+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ());
313+ }
314+ [(set_attr "type" "branch")
315+ (set_attr "sls_length" "retbr")]
316 )
317
318 (define_insn "*cb<optab><mode>1"
319@@ -1066,10 +1094,16 @@
320 (unspec:DI [(match_operand:DI 2 "const_int_operand")] UNSPEC_CALLEE_ABI)
321 (return)]
322 "SIBLING_CALL_P (insn)"
323- "@
324- br\\t%0
325- b\\t%c0"
326- [(set_attr "type" "branch, branch")]
327+ {
328+ if (which_alternative == 0)
329+ {
330+ output_asm_insn ("br\\t%0", operands);
331+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ());
332+ }
333+ return "b\\t%c0";
334+ }
335+ [(set_attr "type" "branch, branch")
336+ (set_attr "sls_length" "retbr,none")]
337 )
338
339 (define_insn "*sibcall_value_insn"
340@@ -1080,10 +1114,16 @@
341 (unspec:DI [(match_operand:DI 3 "const_int_operand")] UNSPEC_CALLEE_ABI)
342 (return)]
343 "SIBLING_CALL_P (insn)"
344- "@
345- br\\t%1
346- b\\t%c1"
347- [(set_attr "type" "branch, branch")]
348+ {
349+ if (which_alternative == 0)
350+ {
351+ output_asm_insn ("br\\t%1", operands);
352+ return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ());
353+ }
354+ return "b\\t%c1";
355+ }
356+ [(set_attr "type" "branch, branch")
357+ (set_attr "sls_length" "retbr,none")]
358 )
359
360 ;; Call subroutine returning any type.
361diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c
362new file mode 100644
363index 0000000..fa1887a
364--- /dev/null
365+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c
366@@ -0,0 +1,21 @@
367+/* Avoid ILP32 since pacret is only available for LP64 */
368+/* { dg-do compile { target { ! ilp32 } } } */
369+/* { dg-additional-options "-mharden-sls=retbr -mbranch-protection=pac-ret -march=armv8.3-a" } */
370+
371+/* Testing the do_return pattern for retaa and retab. */
372+long retbr_subcall(void);
373+long retbr_do_return_retaa(void)
374+{
375+ return retbr_subcall()+1;
376+}
377+
378+__attribute__((target("branch-protection=pac-ret+b-key")))
379+long retbr_do_return_retab(void)
380+{
381+ return retbr_subcall()+1;
382+}
383+
384+/* Ensure there are no BR or RET instructions which are not directly followed
385+ by a speculation barrier. */
386+/* { dg-final { scan-assembler-not {\t(br|ret|retaa|retab)\tx[0-9][0-9]?\n\t(?!dsb\tsy\n\tisb)} } } */
387+/* { dg-final { scan-assembler-not {ret\t} } } */
388diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c
389new file mode 100644
390index 0000000..76b8d03
391--- /dev/null
392+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr.c
393@@ -0,0 +1,119 @@
394+/* We ensure that -Wpedantic is off since it complains about the trampolines
395+ we explicitly want to test. */
396+/* { dg-additional-options "-mharden-sls=retbr -Wno-pedantic " } */
397+/*
398+ Ensure that the SLS hardening of RET and BR leaves no unprotected RET/BR
399+ instructions.
400+ */
401+typedef int (foo) (int, int);
402+typedef void (bar) (int, int);
403+struct sls_testclass {
404+ foo *x;
405+ bar *y;
406+ int left;
407+ int right;
408+};
409+
410+int
411+retbr_sibcall_value_insn (struct sls_testclass x)
412+{
413+ return x.x(x.left, x.right);
414+}
415+
416+void
417+retbr_sibcall_insn (struct sls_testclass x)
418+{
419+ x.y(x.left, x.right);
420+}
421+
422+/* Aim to test two different returns.
423+ One that introduces a tail call in the middle of the function, and one that
424+ has a normal return. */
425+int
426+retbr_multiple_returns (struct sls_testclass x)
427+{
428+ int temp;
429+ if (x.left % 10)
430+ return x.x(x.left, 100);
431+ else if (x.right % 20)
432+ {
433+ return x.x(x.left * x.right, 100);
434+ }
435+ temp = x.left % x.right;
436+ temp *= 100;
437+ temp /= 2;
438+ return temp % 3;
439+}
440+
441+void
442+retbr_multiple_returns_void (struct sls_testclass x)
443+{
444+ if (x.left % 10)
445+ {
446+ x.y(x.left, 100);
447+ }
448+ else if (x.right % 20)
449+ {
450+ x.y(x.left * x.right, 100);
451+ }
452+ return;
453+}
454+
455+/* Testing the casesi jump via register. */
456+__attribute__ ((optimize ("Os")))
457+int
458+retbr_casesi_dispatch (struct sls_testclass x)
459+{
460+ switch (x.left)
461+ {
462+ case -5:
463+ return -2;
464+ case -3:
465+ return -1;
466+ case 0:
467+ return 0;
468+ case 3:
469+ return 1;
470+ case 5:
471+ break;
472+ default:
473+ __builtin_unreachable ();
474+ }
475+ return x.right;
476+}
477+
478+/* Testing the BR in trampolines is mitigated against. */
479+void f1 (void *);
480+void f3 (void *, void (*)(void *));
481+void f2 (void *);
482+
483+int
484+retbr_trampolines (void *a, int b)
485+{
486+ if (!b)
487+ {
488+ f1 (a);
489+ return 1;
490+ }
491+ if (b)
492+ {
493+ void retbr_tramp_internal (void *c)
494+ {
495+ if (c == a)
496+ f2 (c);
497+ }
498+ f3 (a, retbr_tramp_internal);
499+ }
500+ return 0;
501+}
502+
503+/* Testing the indirect_jump pattern. */
504+void
505+retbr_indirect_jump (int *buf)
506+{
507+ __builtin_longjmp(buf, 1);
508+}
509+
510+/* Ensure there are no BR or RET instructions which are not directly followed
511+ by a speculation barrier. */
512+/* { dg-final { scan-assembler-not {\t(br|ret|retaa|retab)\tx[0-9][0-9]?\n\t(?!dsb\tsy\n\tisb|sb)} } } */
513diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp
514new file mode 100644
515index 0000000..8122503
516--- /dev/null
517+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp
518@@ -0,0 +1,73 @@
519+# Regression driver for SLS mitigation on AArch64.
520+# Copyright (C) 2020 Free Software Foundation, Inc.
521+# Contributed by ARM Ltd.
522+#
523+# This file is part of GCC.
524+#
525+# GCC is free software; you can redistribute it and/or modify it
526+# under the terms of the GNU General Public License as published by
527+# the Free Software Foundation; either version 3, or (at your option)
528+# any later version.
529+#
530+# GCC is distributed in the hope that it will be useful, but
531+# WITHOUT ANY WARRANTY; without even the implied warranty of
532+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
533+# General Public License for more details.
534+#
535+# You should have received a copy of the GNU General Public License
536+# along with GCC; see the file COPYING3. If not see
537+# <http://www.gnu.org/licenses/>. */
538+
539+# Exit immediately if this isn't an AArch64 target.
540+if {![istarget aarch64*-*-*] } then {
541+ return
542+}
543+
544+# Load support procs.
545+load_lib gcc-dg.exp
546+load_lib torture-options.exp
547+
548+# If a testcase doesn't have special options, use these.
549+global DEFAULT_CFLAGS
550+if ![info exists DEFAULT_CFLAGS] then {
551+ set DEFAULT_CFLAGS " "
552+}
553+
554+# Initialize `dg'.
555+dg-init
556+torture-init
557+
558+# Use different architectures as well as the normal optimisation options.
559+# (i.e. use both SB and DSB+ISB barriers).
560+
561+set save-dg-do-what-default ${dg-do-what-default}
562+# Main loop.
563+# Run with torture tests (i.e. a bunch of different optimisation levels) just
564+# to increase test coverage.
565+set dg-do-what-default assemble
566+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
567+ "-save-temps" $DEFAULT_CFLAGS
568+
569+# Run the same tests but this time with SB extension.
570+# Since not all supported assemblers will support that extension we decide
571+# whether to assemble or just compile based on whether the extension is
572+# supported for the available assembler.
573+
574+set templist {}
575+foreach x $DG_TORTURE_OPTIONS {
576+ lappend templist "$x -march=armv8.3-a+sb "
577+ lappend templist "$x -march=armv8-a+sb "
578+}
579+set-torture-options $templist
580+if { [check_effective_target_aarch64_asm_sb_ok] } {
581+ set dg-do-what-default assemble
582+} else {
583+ set dg-do-what-default compile
584+}
585+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
586+ "-save-temps" $DEFAULT_CFLAGS
587+set dg-do-what-default ${save-dg-do-what-default}
588+
589+# All done.
590+torture-finish
591+dg-finish
592diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
593index 8a186dd..9d2e093 100644
594--- a/gcc/testsuite/lib/target-supports.exp
595+++ b/gcc/testsuite/lib/target-supports.exp
596@@ -9432,7 +9432,7 @@ proc check_effective_target_aarch64_tiny { } {
597 # various architecture extensions via the .arch_extension pseudo-op.
598
599 foreach { aarch64_ext } { "fp" "simd" "crypto" "crc" "lse" "dotprod" "sve"
600- "i8mm" "f32mm" "f64mm" "bf16" } {
601+ "i8mm" "f32mm" "f64mm" "bf16" "sb" } {
602 eval [string map [list FUNC $aarch64_ext] {
603 proc check_effective_target_aarch64_asm_FUNC_ok { } {
604 if { [istarget aarch64*-*-*] } {
605--
6062.7.4
607
diff --git a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
index 697bdc8219..c96f170196 100644
--- a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
+++ b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
@@ -1,4 +1,4 @@
1From 74cc21f474402cf3578e37e1d7a1a22bbd070f6a Mon Sep 17 00:00:00 2001 1From a4fd05ff8e8ed7252d7b302891ac842cbb190c41 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:59:00 +0400 3Date: Fri, 29 Mar 2013 08:59:00 +0400
4Subject: [PATCH] gcc: poison-system-directories 4Subject: [PATCH] gcc: poison-system-directories
@@ -27,7 +27,7 @@ Upstream-Status: Pending
27 7 files changed, 86 insertions(+), 2 deletions(-) 27 7 files changed, 86 insertions(+), 2 deletions(-)
28 28
29diff --git a/gcc/common.opt b/gcc/common.opt 29diff --git a/gcc/common.opt b/gcc/common.opt
30index 3ec7743ea..d3c3e51dc 100644 30index ec5235c3a41..ca942863064 100644
31--- a/gcc/common.opt 31--- a/gcc/common.opt
32+++ b/gcc/common.opt 32+++ b/gcc/common.opt
33@@ -682,6 +682,10 @@ Wreturn-local-addr 33@@ -682,6 +682,10 @@ Wreturn-local-addr
@@ -42,7 +42,7 @@ index 3ec7743ea..d3c3e51dc 100644
42 Common Var(warn_shadow) Warning 42 Common Var(warn_shadow) Warning
43 Warn when one variable shadows another. Same as -Wshadow=global. 43 Warn when one variable shadows another. Same as -Wshadow=global.
44diff --git a/gcc/config.in b/gcc/config.in 44diff --git a/gcc/config.in b/gcc/config.in
45index 364eba477..7d2c3bbf1 100644 45index 364eba47737..7d2c3bbf1a3 100644
46--- a/gcc/config.in 46--- a/gcc/config.in
47+++ b/gcc/config.in 47+++ b/gcc/config.in
48@@ -224,6 +224,16 @@ 48@@ -224,6 +224,16 @@
@@ -63,7 +63,7 @@ index 364eba477..7d2c3bbf1 100644
63 optimizer and back end) to be checked for dynamic type safety at runtime. 63 optimizer and back end) to be checked for dynamic type safety at runtime.
64 This is quite expensive. */ 64 This is quite expensive. */
65diff --git a/gcc/configure b/gcc/configure 65diff --git a/gcc/configure b/gcc/configure
66index 2a9d646b4..a848792f2 100755 66index 8fe9c91fd7c..8976850dff6 100755
67--- a/gcc/configure 67--- a/gcc/configure
68+++ b/gcc/configure 68+++ b/gcc/configure
69@@ -1010,6 +1010,7 @@ with_system_zlib 69@@ -1010,6 +1010,7 @@ with_system_zlib
@@ -83,7 +83,7 @@ index 2a9d646b4..a848792f2 100755
83 --enable-plugin enable plugin support 83 --enable-plugin enable plugin support
84 --enable-host-shared build host code as shared libraries 84 --enable-host-shared build host code as shared libraries
85 --disable-libquadmath-support 85 --disable-libquadmath-support
86@@ -30280,6 +30283,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then : 86@@ -30276,6 +30279,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
87 fi 87 fi
88 88
89 89
@@ -107,10 +107,10 @@ index 2a9d646b4..a848792f2 100755
107 107
108 108
109diff --git a/gcc/configure.ac b/gcc/configure.ac 109diff --git a/gcc/configure.ac b/gcc/configure.ac
110index 51cce36ce..66ffde305 100644 110index 84dceb8074a..13eace6cfc6 100644
111--- a/gcc/configure.ac 111--- a/gcc/configure.ac
112+++ b/gcc/configure.ac 112+++ b/gcc/configure.ac
113@@ -6614,6 +6614,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs, 113@@ -6608,6 +6608,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
114 [specify that runtime libraries should be 114 [specify that runtime libraries should be
115 installed in a compiler-specific directory])]) 115 installed in a compiler-specific directory])])
116 116
@@ -134,10 +134,10 @@ index 51cce36ce..66ffde305 100644
134 AC_SUBST(subdirs) 134 AC_SUBST(subdirs)
135 AC_SUBST(srcdir) 135 AC_SUBST(srcdir)
136diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi 136diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
137index d929eb109..aa5ff88b1 100644 137index eabeec944e7..cd31b522e42 100644
138--- a/gcc/doc/invoke.texi 138--- a/gcc/doc/invoke.texi
139+++ b/gcc/doc/invoke.texi 139+++ b/gcc/doc/invoke.texi
140@@ -351,6 +351,7 @@ Objective-C and Objective-C++ Dialects}. 140@@ -348,6 +348,7 @@ Objective-C and Objective-C++ Dialects}.
141 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol 141 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
142 -Wparentheses -Wno-pedantic-ms-format @gol 142 -Wparentheses -Wno-pedantic-ms-format @gol
143 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol 143 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
@@ -145,7 +145,7 @@ index d929eb109..aa5ff88b1 100644
145 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol 145 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
146 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol 146 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
147 -Wno-scalar-storage-order -Wsequence-point @gol 147 -Wno-scalar-storage-order -Wsequence-point @gol
148@@ -6928,6 +6929,14 @@ made up of data only and thus requires no special treatment. But, for 148@@ -6926,6 +6927,14 @@ made up of data only and thus requires no special treatment. But, for
149 most targets, it is made up of code and thus requires the stack to be 149 most targets, it is made up of code and thus requires the stack to be
150 made executable in order for the program to work properly. 150 made executable in order for the program to work properly.
151 151
@@ -161,10 +161,10 @@ index d929eb109..aa5ff88b1 100644
161 @opindex Wfloat-equal 161 @opindex Wfloat-equal
162 @opindex Wno-float-equal 162 @opindex Wno-float-equal
163diff --git a/gcc/gcc.c b/gcc/gcc.c 163diff --git a/gcc/gcc.c b/gcc/gcc.c
164index 49c9c6c17..24a92bf27 100644 164index 9f790db0daf..f379f71da3d 100644
165--- a/gcc/gcc.c 165--- a/gcc/gcc.c
166+++ b/gcc/gcc.c 166+++ b/gcc/gcc.c
167@@ -1044,6 +1044,8 @@ proper position among the other output files. */ 167@@ -1041,6 +1041,8 @@ proper position among the other output files. */
168 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ 168 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
169 "%X %{o*} %{e*} %{N} %{n} %{r}\ 169 "%X %{o*} %{e*} %{N} %{n} %{r}\
170 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ 170 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
@@ -173,7 +173,7 @@ index 49c9c6c17..24a92bf27 100644
173 %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ 173 %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
174 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ 174 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
175 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ 175 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
176@@ -1138,8 +1140,11 @@ static const char *cpp_unique_options = 176@@ -1134,8 +1136,11 @@ static const char *cpp_unique_options =
177 static const char *cpp_options = 177 static const char *cpp_options =
178 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ 178 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
179 %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\ 179 %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
@@ -188,7 +188,7 @@ index 49c9c6c17..24a92bf27 100644
188 /* This contains cpp options which are not passed when the preprocessor 188 /* This contains cpp options which are not passed when the preprocessor
189 output will be used by another program. */ 189 output will be used by another program. */
190diff --git a/gcc/incpath.c b/gcc/incpath.c 190diff --git a/gcc/incpath.c b/gcc/incpath.c
191index 94eaba7b1..bfad4ebe3 100644 191index 8a2bda00f80..9098ab044ab 100644
192--- a/gcc/incpath.c 192--- a/gcc/incpath.c
193+++ b/gcc/incpath.c 193+++ b/gcc/incpath.c
194@@ -26,6 +26,7 @@ 194@@ -26,6 +26,7 @@
@@ -226,6 +226,3 @@ index 94eaba7b1..bfad4ebe3 100644
226 } 226 }
227 227
228 /* Use given -I paths for #include "..." but not #include <...>, and 228 /* Use given -I paths for #include "..." but not #include <...>, and
229--
2302.25.1
231
diff --git a/meta/recipes-devtools/gcc/gcc/0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch b/meta/recipes-devtools/gcc/gcc/0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch
deleted file mode 100644
index 716a367172..0000000000
--- a/meta/recipes-devtools/gcc/gcc/0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch
+++ /dev/null
@@ -1,658 +0,0 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From a5e7efc40ed841934c1d913f39476afa17d8e5f7 Mon Sep 17 00:00:00 2001
5From: Matthew Malcomson <matthew.malcomson@arm.com>
6Date: Thu, 9 Jul 2020 09:11:59 +0100
7Subject: [PATCH 3/3] aarch64: Mitigate SLS for BLR instruction
8
9This patch introduces the mitigation for Straight Line Speculation past
10the BLR instruction.
11
12This mitigation replaces BLR instructions with a BL to a stub which uses
13a BR to jump to the original value. These function stubs are then
14appended with a speculation barrier to ensure no straight line
15speculation happens after these jumps.
16
17When optimising for speed we use a set of stubs for each function since
18this should help the branch predictor make more accurate predictions
19about where a stub should branch.
20
21When optimising for size we use one set of stubs for all functions.
22This set of stubs can have human readable names, and we are using
23`__call_indirect_x<N>` for register x<N>.
24
25When BTI branch protection is enabled the BLR instruction can jump to a
26`BTI c` instruction using any register, while the BR instruction can
27only jump to a `BTI c` instruction using the x16 or x17 registers.
28Hence, in order to ensure this transformation is safe we mov the value
29of the original register into x16 and use x16 for the BR.
30
31As an example when optimising for size:
32a
33 BLR x0
34instruction would get transformed to something like
35 BL __call_indirect_x0
36where __call_indirect_x0 labels a thunk that contains
37__call_indirect_x0:
38 MOV X16, X0
39 BR X16
40 <speculation barrier>
41
42The first version of this patch used local symbols specific to a
43compilation unit to try and avoid relocations.
44This was mistaken since functions coming from the same compilation unit
45can still be in different sections, and the assembler will insert
46relocations at jumps between sections.
47
48On any relocation the linker is permitted to emit a veneer to handle
49jumps between symbols that are very far apart. The registers x16 and
50x17 may be clobbered by these veneers.
51Hence the function stubs cannot rely on the values of x16 and x17 being
52the same as just before the function stub is called.
53
54Similar can be said for the hot/cold partitioning of single functions,
55so function-local stubs have the same restriction.
56
57This updated version of the patch never emits function stubs for x16 and
58x17, and instead forces other registers to be used.
59
60Given the above, there is now no benefit to local symbols (since they
61are not enough to avoid dealing with linker intricacies). This patch
62now uses global symbols with hidden visibility each stored in their own
63COMDAT section. This means stubs can be shared between compilation
64units while still avoiding the PLT indirection.
65
66This patch also removes the `__call_indirect_x30` stub (and
67function-local equivalent) which would simply jump back to the original
68location.
69
70The function-local stubs are emitted to the assembly output file in one
71chunk, which means we need not add the speculation barrier directly
72after each one.
73This is because we know for certain that the instructions directly after
74the BR in all but the last function stub will be from another one of
75these stubs and hence will not contain a speculation gadget.
76Instead we add a speculation barrier at the end of the sequence of
77stubs.
78
79The global stubs are emitted in COMDAT/.linkonce sections by
80themselves so that the linker can remove duplicates from multiple object
81files. This means they are not emitted in one chunk, and each one must
82include the speculation barrier.
83
84Another difference is that since the global stubs are shared across
85compilation units we do not know that all functions will be targeting an
86architecture supporting the SB instruction.
87Rather than provide multiple stubs for each architecture, we provide a
88stub that will work for all architectures -- using the DSB+ISB barrier.
89
90This mitigation does not apply for BLR instructions in the following
91places:
92- Some accesses to thread-local variables use a code sequence with a BLR
93 instruction. This code sequence is part of the binary interface between
94 compiler and linker. If this BLR instruction needs to be mitigated, it'd
95 probably be best to do so in the linker. It seems that the code sequence
96 for thread-local variable access is unlikely to lead to a Spectre Revalation
97 Gadget.
98- PLT stubs are produced by the linker and each contain a BLR instruction.
99 It seems that at most only after the last PLT stub a Spectre Revalation
100 Gadget might appear.
101
102Testing:
103 Bootstrap and regtest on AArch64
104 (with BOOT_CFLAGS="-mharden-sls=retbr,blr")
105 Used a temporary hack(1) in gcc-dg.exp to use these options on every
106 test in the testsuite, a slight modification to emit the speculation
107 barrier after every function stub, and a script to check that the
108 output never emitted a BLR, or unmitigated BR or RET instruction.
109 Similar on an aarch64-none-elf cross-compiler.
110
1111) Temporary hack emitted a speculation barrier at the end of every stub
112function, and used a script to ensure that:
113 a) Every RET or BR is immediately followed by a speculation barrier.
114 b) No BLR instruction is emitted by compiler.
115
116gcc/ChangeLog:
117
118 * config/aarch64/aarch64-protos.h (aarch64_indirect_call_asm):
119 New declaration.
120 * config/aarch64/aarch64.c (aarch64_regno_regclass): Handle new
121 stub registers class.
122 (aarch64_class_max_nregs): Likewise.
123 (aarch64_register_move_cost): Likewise.
124 (aarch64_sls_shared_thunks): Global array to store stub labels.
125 (aarch64_sls_emit_function_stub): New.
126 (aarch64_create_blr_label): New.
127 (aarch64_sls_emit_blr_function_thunks): New.
128 (aarch64_sls_emit_shared_blr_thunks): New.
129 (aarch64_asm_file_end): New.
130 (aarch64_indirect_call_asm): New.
131 (TARGET_ASM_FILE_END): Use aarch64_asm_file_end.
132 (TARGET_ASM_FUNCTION_EPILOGUE): Use
133 aarch64_sls_emit_blr_function_thunks.
134 * config/aarch64/aarch64.h (STB_REGNUM_P): New.
135 (enum reg_class): Add STUB_REGS class.
136 (machine_function): Introduce `call_via` array for
137 function-local stub labels.
138 * config/aarch64/aarch64.md (*call_insn, *call_value_insn): Use
139 aarch64_indirect_call_asm to emit code when hardening BLR
140 instructions.
141 * config/aarch64/constraints.md (Ucr): New constraint
142 representing registers for indirect calls. Is GENERAL_REGS
143 usually, and STUB_REGS when hardening BLR instruction against
144 SLS.
145 * config/aarch64/predicates.md (aarch64_general_reg): STUB_REGS class
146 is also a general register.
147
148gcc/testsuite/ChangeLog:
149
150 * gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c: New test.
151 * gcc.target/aarch64/sls-mitigation/sls-miti-blr.c: New test.
152---
153 gcc/config/aarch64/aarch64-protos.h | 1 +
154 gcc/config/aarch64/aarch64.c | 225 ++++++++++++++++++++-
155 gcc/config/aarch64/aarch64.h | 15 ++
156 gcc/config/aarch64/aarch64.md | 11 +-
157 gcc/config/aarch64/constraints.md | 9 +
158 gcc/config/aarch64/predicates.md | 3 +-
159 .../aarch64/sls-mitigation/sls-miti-blr-bti.c | 40 ++++
160 .../aarch64/sls-mitigation/sls-miti-blr.c | 33 +++
161 8 files changed, 328 insertions(+), 9 deletions(-)
162 create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c
163 create mode 100644 gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c
164
165diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
166index ee0ffde..839f801 100644
167--- a/gcc/config/aarch64/aarch64-protos.h
168+++ b/gcc/config/aarch64/aarch64-protos.h
169@@ -782,6 +782,7 @@ extern const atomic_ool_names aarch64_ool_ldeor_names;
170 tree aarch64_resolve_overloaded_builtin_general (location_t, tree, void *);
171
172 const char *aarch64_sls_barrier (int);
173+const char *aarch64_indirect_call_asm (rtx);
174 extern bool aarch64_harden_sls_retbr_p (void);
175 extern bool aarch64_harden_sls_blr_p (void);
176
177diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
178index 2389d49..0f7bba3 100644
179--- a/gcc/config/aarch64/aarch64.c
180+++ b/gcc/config/aarch64/aarch64.c
181@@ -10605,6 +10605,9 @@ aarch64_label_mentioned_p (rtx x)
182 enum reg_class
183 aarch64_regno_regclass (unsigned regno)
184 {
185+ if (STUB_REGNUM_P (regno))
186+ return STUB_REGS;
187+
188 if (GP_REGNUM_P (regno))
189 return GENERAL_REGS;
190
191@@ -10939,6 +10942,7 @@ aarch64_class_max_nregs (reg_class_t regclass, machine_mode mode)
192 unsigned int nregs, vec_flags;
193 switch (regclass)
194 {
195+ case STUB_REGS:
196 case TAILCALL_ADDR_REGS:
197 case POINTER_REGS:
198 case GENERAL_REGS:
199@@ -13155,10 +13159,12 @@ aarch64_register_move_cost (machine_mode mode,
200 = aarch64_tune_params.regmove_cost;
201
202 /* Caller save and pointer regs are equivalent to GENERAL_REGS. */
203- if (to == TAILCALL_ADDR_REGS || to == POINTER_REGS)
204+ if (to == TAILCALL_ADDR_REGS || to == POINTER_REGS
205+ || to == STUB_REGS)
206 to = GENERAL_REGS;
207
208- if (from == TAILCALL_ADDR_REGS || from == POINTER_REGS)
209+ if (from == TAILCALL_ADDR_REGS || from == POINTER_REGS
210+ || from == STUB_REGS)
211 from = GENERAL_REGS;
212
213 /* Make RDFFR very expensive. In particular, if we know that the FFR
214@@ -22957,6 +22963,215 @@ aarch64_sls_barrier (int mitigation_required)
215 : "";
216 }
217
218+static GTY (()) tree aarch64_sls_shared_thunks[30];
219+static GTY (()) bool aarch64_sls_shared_thunks_needed = false;
220+const char *indirect_symbol_names[30] = {
221+ "__call_indirect_x0",
222+ "__call_indirect_x1",
223+ "__call_indirect_x2",
224+ "__call_indirect_x3",
225+ "__call_indirect_x4",
226+ "__call_indirect_x5",
227+ "__call_indirect_x6",
228+ "__call_indirect_x7",
229+ "__call_indirect_x8",
230+ "__call_indirect_x9",
231+ "__call_indirect_x10",
232+ "__call_indirect_x11",
233+ "__call_indirect_x12",
234+ "__call_indirect_x13",
235+ "__call_indirect_x14",
236+ "__call_indirect_x15",
237+ "", /* "__call_indirect_x16", */
238+ "", /* "__call_indirect_x17", */
239+ "__call_indirect_x18",
240+ "__call_indirect_x19",
241+ "__call_indirect_x20",
242+ "__call_indirect_x21",
243+ "__call_indirect_x22",
244+ "__call_indirect_x23",
245+ "__call_indirect_x24",
246+ "__call_indirect_x25",
247+ "__call_indirect_x26",
248+ "__call_indirect_x27",
249+ "__call_indirect_x28",
250+ "__call_indirect_x29",
251+};
252+
253+/* Function to create a BLR thunk. This thunk is used to mitigate straight
254+ line speculation. Instead of a simple BLR that can be speculated past,
255+ we emit a BL to this thunk, and this thunk contains a BR to the relevant
256+ register. These thunks have the relevant speculation barries put after
257+ their indirect branch so that speculation is blocked.
258+
259+ We use such a thunk so the speculation barriers are kept off the
260+ architecturally executed path in order to reduce the performance overhead.
261+
262+ When optimizing for size we use stubs shared by the linked object.
263+ When optimizing for performance we emit stubs for each function in the hope
264+ that the branch predictor can better train on jumps specific for a given
265+ function. */
266+rtx
267+aarch64_sls_create_blr_label (int regnum)
268+{
269+ gcc_assert (STUB_REGNUM_P (regnum));
270+ if (optimize_function_for_size_p (cfun))
271+ {
272+ /* For the thunks shared between different functions in this compilation
273+ unit we use a named symbol -- this is just for users to more easily
274+ understand the generated assembly. */
275+ aarch64_sls_shared_thunks_needed = true;
276+ const char *thunk_name = indirect_symbol_names[regnum];
277+ if (aarch64_sls_shared_thunks[regnum] == NULL)
278+ {
279+ /* Build a decl representing this function stub and record it for
280+ later. We build a decl here so we can use the GCC machinery for
281+ handling sections automatically (through `get_named_section` and
282+ `make_decl_one_only`). That saves us a lot of trouble handling
283+ the specifics of different output file formats. */
284+ tree decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
285+ get_identifier (thunk_name),
286+ build_function_type_list (void_type_node,
287+ NULL_TREE));
288+ DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL,
289+ NULL_TREE, void_type_node);
290+ TREE_PUBLIC (decl) = 1;
291+ TREE_STATIC (decl) = 1;
292+ DECL_IGNORED_P (decl) = 1;
293+ DECL_ARTIFICIAL (decl) = 1;
294+ make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
295+ resolve_unique_section (decl, 0, false);
296+ aarch64_sls_shared_thunks[regnum] = decl;
297+ }
298+
299+ return gen_rtx_SYMBOL_REF (Pmode, thunk_name);
300+ }
301+
302+ if (cfun->machine->call_via[regnum] == NULL)
303+ cfun->machine->call_via[regnum]
304+ = gen_rtx_LABEL_REF (Pmode, gen_label_rtx ());
305+ return cfun->machine->call_via[regnum];
306+}
307+
308+/* Helper function for aarch64_sls_emit_blr_function_thunks and
309+ aarch64_sls_emit_shared_blr_thunks below. */
310+static void
311+aarch64_sls_emit_function_stub (FILE *out_file, int regnum)
312+{
313+ /* Save in x16 and branch to that function so this transformation does
314+ not prevent jumping to `BTI c` instructions. */
315+ asm_fprintf (out_file, "\tmov\tx16, x%d\n", regnum);
316+ asm_fprintf (out_file, "\tbr\tx16\n");
317+}
318+
319+/* Emit all BLR stubs for this particular function.
320+ Here we emit all the BLR stubs needed for the current function. Since we
321+ emit these stubs in a consecutive block we know there will be no speculation
322+ gadgets between each stub, and hence we only emit a speculation barrier at
323+ the end of the stub sequences.
324+
325+ This is called in the TARGET_ASM_FUNCTION_EPILOGUE hook. */
326+void
327+aarch64_sls_emit_blr_function_thunks (FILE *out_file)
328+{
329+ if (! aarch64_harden_sls_blr_p ())
330+ return;
331+
332+ bool any_functions_emitted = false;
333+ /* We must save and restore the current function section since this assembly
334+ is emitted at the end of the function. This means it can be emitted *just
335+ after* the cold section of a function. That cold part would be emitted in
336+ a different section. That switch would trigger a `.cfi_endproc` directive
337+ to be emitted in the original section and a `.cfi_startproc` directive to
338+ be emitted in the new section. Switching to the original section without
339+ restoring would mean that the `.cfi_endproc` emitted as a function ends
340+ would happen in a different section -- leaving an unmatched
341+ `.cfi_startproc` in the cold text section and an unmatched `.cfi_endproc`
342+ in the standard text section. */
343+ section *save_text_section = in_section;
344+ switch_to_section (function_section (current_function_decl));
345+ for (int regnum = 0; regnum < 30; ++regnum)
346+ {
347+ rtx specu_label = cfun->machine->call_via[regnum];
348+ if (specu_label == NULL)
349+ continue;
350+
351+ targetm.asm_out.print_operand (out_file, specu_label, 0);
352+ asm_fprintf (out_file, ":\n");
353+ aarch64_sls_emit_function_stub (out_file, regnum);
354+ any_functions_emitted = true;
355+ }
356+ if (any_functions_emitted)
357+ /* Can use the SB if needs be here, since this stub will only be used
358+ by the current function, and hence for the current target. */
359+ asm_fprintf (out_file, "\t%s\n", aarch64_sls_barrier (true));
360+ switch_to_section (save_text_section);
361+}
362+
363+/* Emit shared BLR stubs for the current compilation unit.
364+ Over the course of compiling this unit we may have converted some BLR
365+ instructions to a BL to a shared stub function. This is where we emit those
366+ stub functions.
367+ This function is for the stubs shared between different functions in this
368+ compilation unit. We share when optimizing for size instead of speed.
369+
370+ This function is called through the TARGET_ASM_FILE_END hook. */
371+void
372+aarch64_sls_emit_shared_blr_thunks (FILE *out_file)
373+{
374+ if (! aarch64_sls_shared_thunks_needed)
375+ return;
376+
377+ for (int regnum = 0; regnum < 30; ++regnum)
378+ {
379+ tree decl = aarch64_sls_shared_thunks[regnum];
380+ if (!decl)
381+ continue;
382+
383+ const char *name = indirect_symbol_names[regnum];
384+ switch_to_section (get_named_section (decl, NULL, 0));
385+ ASM_OUTPUT_ALIGN (out_file, 2);
386+ targetm.asm_out.globalize_label (out_file, name);
387+ /* Only emits if the compiler is configured for an assembler that can
388+ handle visibility directives. */
389+ targetm.asm_out.assemble_visibility (decl, VISIBILITY_HIDDEN);
390+ ASM_OUTPUT_TYPE_DIRECTIVE (out_file, name, "function");
391+ ASM_OUTPUT_LABEL (out_file, name);
392+ aarch64_sls_emit_function_stub (out_file, regnum);
393+ /* Use the most conservative target to ensure it can always be used by any
394+ function in the translation unit. */
395+ asm_fprintf (out_file, "\tdsb\tsy\n\tisb\n");
396+ ASM_DECLARE_FUNCTION_SIZE (out_file, name, decl);
397+ }
398+}
399+
400+/* Implement TARGET_ASM_FILE_END. */
401+void
402+aarch64_asm_file_end ()
403+{
404+ aarch64_sls_emit_shared_blr_thunks (asm_out_file);
405+ /* Since this function will be called for the ASM_FILE_END hook, we ensure
406+ that what would be called otherwise (e.g. `file_end_indicate_exec_stack`
407+ for FreeBSD) still gets called. */
408+#ifdef TARGET_ASM_FILE_END
409+ TARGET_ASM_FILE_END ();
410+#endif
411+}
412+
413+const char *
414+aarch64_indirect_call_asm (rtx addr)
415+{
416+ gcc_assert (REG_P (addr));
417+ if (aarch64_harden_sls_blr_p ())
418+ {
419+ rtx stub_label = aarch64_sls_create_blr_label (REGNO (addr));
420+ output_asm_insn ("bl\t%0", &stub_label);
421+ }
422+ else
423+ output_asm_insn ("blr\t%0", &addr);
424+ return "";
425+}
426+
427 /* Target-specific selftests. */
428
429 #if CHECKING_P
430@@ -23507,6 +23722,12 @@ aarch64_libgcc_floating_mode_supported_p
431 #undef TARGET_MD_ASM_ADJUST
432 #define TARGET_MD_ASM_ADJUST arm_md_asm_adjust
433
434+#undef TARGET_ASM_FILE_END
435+#define TARGET_ASM_FILE_END aarch64_asm_file_end
436+
437+#undef TARGET_ASM_FUNCTION_EPILOGUE
438+#define TARGET_ASM_FUNCTION_EPILOGUE aarch64_sls_emit_blr_function_thunks
439+
440 struct gcc_target targetm = TARGET_INITIALIZER;
441
442 #include "gt-aarch64.h"
443diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
444index 8e0fc37..7331450 100644
445--- a/gcc/config/aarch64/aarch64.h
446+++ b/gcc/config/aarch64/aarch64.h
447@@ -643,6 +643,16 @@ extern unsigned aarch64_architecture_version;
448 #define GP_REGNUM_P(REGNO) \
449 (((unsigned) (REGNO - R0_REGNUM)) <= (R30_REGNUM - R0_REGNUM))
450
451+/* Registers known to be preserved over a BL instruction. This consists of the
452+ GENERAL_REGS without x16, x17, and x30. The x30 register is changed by the
453+ BL instruction itself, while the x16 and x17 registers may be used by
454+ veneers which can be inserted by the linker. */
455+#define STUB_REGNUM_P(REGNO) \
456+ (GP_REGNUM_P (REGNO) \
457+ && (REGNO) != R16_REGNUM \
458+ && (REGNO) != R17_REGNUM \
459+ && (REGNO) != R30_REGNUM) \
460+
461 #define FP_REGNUM_P(REGNO) \
462 (((unsigned) (REGNO - V0_REGNUM)) <= (V31_REGNUM - V0_REGNUM))
463
464@@ -667,6 +677,7 @@ enum reg_class
465 {
466 NO_REGS,
467 TAILCALL_ADDR_REGS,
468+ STUB_REGS,
469 GENERAL_REGS,
470 STACK_REG,
471 POINTER_REGS,
472@@ -689,6 +700,7 @@ enum reg_class
473 { \
474 "NO_REGS", \
475 "TAILCALL_ADDR_REGS", \
476+ "STUB_REGS", \
477 "GENERAL_REGS", \
478 "STACK_REG", \
479 "POINTER_REGS", \
480@@ -708,6 +720,7 @@ enum reg_class
481 { \
482 { 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
483 { 0x00030000, 0x00000000, 0x00000000 }, /* TAILCALL_ADDR_REGS */\
484+ { 0x3ffcffff, 0x00000000, 0x00000000 }, /* STUB_REGS */ \
485 { 0x7fffffff, 0x00000000, 0x00000003 }, /* GENERAL_REGS */ \
486 { 0x80000000, 0x00000000, 0x00000000 }, /* STACK_REG */ \
487 { 0xffffffff, 0x00000000, 0x00000003 }, /* POINTER_REGS */ \
488@@ -862,6 +875,8 @@ typedef struct GTY (()) machine_function
489 struct aarch64_frame frame;
490 /* One entry for each hard register. */
491 bool reg_is_wrapped_separately[LAST_SAVED_REGNUM];
492+ /* One entry for each general purpose register. */
493+ rtx call_via[SP_REGNUM];
494 bool label_is_assembled;
495 } machine_function;
496 #endif
497diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
498index dda04ee..43da754 100644
499--- a/gcc/config/aarch64/aarch64.md
500+++ b/gcc/config/aarch64/aarch64.md
501@@ -1022,16 +1022,15 @@
502 )
503
504 (define_insn "*call_insn"
505- [(call (mem:DI (match_operand:DI 0 "aarch64_call_insn_operand" "r, Usf"))
506+ [(call (mem:DI (match_operand:DI 0 "aarch64_call_insn_operand" "Ucr, Usf"))
507 (match_operand 1 "" ""))
508 (unspec:DI [(match_operand:DI 2 "const_int_operand")] UNSPEC_CALLEE_ABI)
509 (clobber (reg:DI LR_REGNUM))]
510 ""
511 "@
512- blr\\t%0
513+ * return aarch64_indirect_call_asm (operands[0]);
514 bl\\t%c0"
515- [(set_attr "type" "call, call")]
516-)
517+ [(set_attr "type" "call, call")])
518
519 (define_expand "call_value"
520 [(parallel
521@@ -1050,13 +1049,13 @@
522
523 (define_insn "*call_value_insn"
524 [(set (match_operand 0 "" "")
525- (call (mem:DI (match_operand:DI 1 "aarch64_call_insn_operand" "r, Usf"))
526+ (call (mem:DI (match_operand:DI 1 "aarch64_call_insn_operand" "Ucr, Usf"))
527 (match_operand 2 "" "")))
528 (unspec:DI [(match_operand:DI 3 "const_int_operand")] UNSPEC_CALLEE_ABI)
529 (clobber (reg:DI LR_REGNUM))]
530 ""
531 "@
532- blr\\t%1
533+ * return aarch64_indirect_call_asm (operands[1]);
534 bl\\t%c1"
535 [(set_attr "type" "call, call")]
536 )
537diff --git a/gcc/config/aarch64/constraints.md b/gcc/config/aarch64/constraints.md
538index d993268..8cc6f50 100644
539--- a/gcc/config/aarch64/constraints.md
540+++ b/gcc/config/aarch64/constraints.md
541@@ -24,6 +24,15 @@
542 (define_register_constraint "Ucs" "TAILCALL_ADDR_REGS"
543 "@internal Registers suitable for an indirect tail call")
544
545+(define_register_constraint "Ucr"
546+ "aarch64_harden_sls_blr_p () ? STUB_REGS : GENERAL_REGS"
547+ "@internal Registers to be used for an indirect call.
548+ This is usually the general registers, but when we are hardening against
549+ Straight Line Speculation we disallow x16, x17, and x30 so we can use
550+ indirection stubs. These indirection stubs cannot use the above registers
551+ since they will be reached by a BL that may have to go through a linker
552+ veneer.")
553+
554 (define_register_constraint "w" "FP_REGS"
555 "Floating point and SIMD vector registers.")
556
557diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md
558index 215fcec..1754b1e 100644
559--- a/gcc/config/aarch64/predicates.md
560+++ b/gcc/config/aarch64/predicates.md
561@@ -32,7 +32,8 @@
562
563 (define_predicate "aarch64_general_reg"
564 (and (match_operand 0 "register_operand")
565- (match_test "REGNO_REG_CLASS (REGNO (op)) == GENERAL_REGS")))
566+ (match_test "REGNO_REG_CLASS (REGNO (op)) == STUB_REGS
567+ || REGNO_REG_CLASS (REGNO (op)) == GENERAL_REGS")))
568
569 ;; Return true if OP a (const_int 0) operand.
570 (define_predicate "const0_operand"
571diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c
572new file mode 100644
573index 0000000..b1fb754
574--- /dev/null
575+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr-bti.c
576@@ -0,0 +1,40 @@
577+/* { dg-do compile } */
578+/* { dg-additional-options "-mharden-sls=blr -mbranch-protection=bti" } */
579+/*
580+ Ensure that the SLS hardening of BLR leaves no BLR instructions.
581+ Here we also check that there are no BR instructions with anything except an
582+ x16 or x17 register. This is because a `BTI c` instruction can be branched
583+ to using a BLR instruction using any register, but can only be branched to
584+ with a BR using an x16 or x17 register.
585+ */
586+typedef int (foo) (int, int);
587+typedef void (bar) (int, int);
588+struct sls_testclass {
589+ foo *x;
590+ bar *y;
591+ int left;
592+ int right;
593+};
594+
595+/* We test both RTL patterns for a call which returns a value and a call which
596+ does not. */
597+int blr_call_value (struct sls_testclass x)
598+{
599+ int retval = x.x(x.left, x.right);
600+ if (retval % 10)
601+ return 100;
602+ return 9;
603+}
604+
605+int blr_call (struct sls_testclass x)
606+{
607+ x.y(x.left, x.right);
608+ if (x.left % 10)
609+ return 100;
610+ return 9;
611+}
612+
613+/* { dg-final { scan-assembler-not {\tblr\t} } } */
614+/* { dg-final { scan-assembler-not {\tbr\tx(?!16|17)} } } */
615+/* { dg-final { scan-assembler {\tbr\tx(16|17)} } } */
616+
617diff --git a/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c
618new file mode 100644
619index 0000000..88bafff
620--- /dev/null
621+++ b/gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-blr.c
622@@ -0,0 +1,33 @@
623+/* { dg-additional-options "-mharden-sls=blr -save-temps" } */
624+/* Ensure that the SLS hardening of BLR leaves no BLR instructions.
625+ We only test that all BLR instructions have been removed, not that the
626+ resulting code makes sense. */
627+typedef int (foo) (int, int);
628+typedef void (bar) (int, int);
629+struct sls_testclass {
630+ foo *x;
631+ bar *y;
632+ int left;
633+ int right;
634+};
635+
636+/* We test both RTL patterns for a call which returns a value and a call which
637+ does not. */
638+int blr_call_value (struct sls_testclass x)
639+{
640+ int retval = x.x(x.left, x.right);
641+ if (retval % 10)
642+ return 100;
643+ return 9;
644+}
645+
646+int blr_call (struct sls_testclass x)
647+{
648+ x.y(x.left, x.right);
649+ if (x.left % 10)
650+ return 100;
651+ return 9;
652+}
653+
654+/* { dg-final { scan-assembler-not {\tblr\t} } } */
655+/* { dg-final { scan-assembler {\tbr\tx[0-9][0-9]?} } } */
656--
6572.7.4
658
diff --git a/meta/recipes-devtools/gcc/gcc/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
index 27237feb5a..39b616e82e 100644
--- a/meta/recipes-devtools/gcc/gcc/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
+++ b/meta/recipes-devtools/gcc/gcc/0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
@@ -1,4 +1,4 @@
1From 6e3395c0bc933bdc3242d1dead4896d0aa4e11a8 Mon Sep 17 00:00:00 2001 1From 860a8a2ec653e3c65bc5440f181b459dfe56c8a0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:08:31 +0400 3Date: Fri, 29 Mar 2013 09:08:31 +0400
4Subject: [PATCH] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET 4Subject: [PATCH] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET
@@ -26,10 +26,10 @@ Upstream-Status: Pending
26 1 file changed, 32 insertions(+) 26 1 file changed, 32 insertions(+)
27 27
28diff --git a/configure b/configure 28diff --git a/configure b/configure
29index 226a64939d1..b31dc137fc9 100755 29index 9350b0cf3ed..8ed565c51b3 100755
30--- a/configure 30--- a/configure
31+++ b/configure 31+++ b/configure
32@@ -6971,6 +6971,38 @@ fi 32@@ -6972,6 +6972,38 @@ fi
33 33
34 34
35 35
diff --git a/meta/recipes-devtools/gcc/gcc/0004-64-bit-multilib-hack.patch b/meta/recipes-devtools/gcc/gcc/0004-64-bit-multilib-hack.patch
index 7c751bef65..04d8bdf331 100644
--- a/meta/recipes-devtools/gcc/gcc/0004-64-bit-multilib-hack.patch
+++ b/meta/recipes-devtools/gcc/gcc/0004-64-bit-multilib-hack.patch
@@ -1,4 +1,4 @@
1From 85a7c5aeb82ed61e6ef6d8e061b9da9e6a4a652c Mon Sep 17 00:00:00 2001 1From d166c36206b276f769e175f39cf44b33c98bd153 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:10:06 +0400 3Date: Fri, 29 Mar 2013 09:10:06 +0400
4Subject: [PATCH] 64-bit multilib hack. 4Subject: [PATCH] 64-bit multilib hack.
diff --git a/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch
index 4020c9e3cf..9f5b96eb63 100644
--- a/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch
+++ b/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch
@@ -1,4 +1,4 @@
1From 6ddfb0bfcd1eea71acd37ab06f7a4510b9f1d12b Mon Sep 17 00:00:00 2001 1From dcbfaf57a213e3beaafb0561b007c61501961f03 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:12:56 +0400 3Date: Fri, 29 Mar 2013 09:12:56 +0400
4Subject: [PATCH] optional libstdc 4Subject: [PATCH] optional libstdc
@@ -52,7 +52,7 @@ index 0ab63bcd211..7b081e9e4f0 100644
52 library = -1; 52 library = -1;
53 break; 53 break;
54diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi 54diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
55index f12d8d12150..cf6cb428e7d 100644 55index cd31b522e42..1f14df48bda 100644
56--- a/gcc/doc/invoke.texi 56--- a/gcc/doc/invoke.texi
57+++ b/gcc/doc/invoke.texi 57+++ b/gcc/doc/invoke.texi
58@@ -230,6 +230,9 @@ in the following sections. 58@@ -230,6 +230,9 @@ in the following sections.
@@ -65,7 +65,7 @@ index f12d8d12150..cf6cb428e7d 100644
65 -fext-numeric-literals @gol 65 -fext-numeric-literals @gol
66 -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol 66 -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol
67 -Wno-class-conversion -Wclass-memaccess @gol 67 -Wno-class-conversion -Wclass-memaccess @gol
68@@ -599,7 +602,7 @@ Objective-C and Objective-C++ Dialects}. 68@@ -600,7 +603,7 @@ Objective-C and Objective-C++ Dialects}.
69 -pie -pthread -r -rdynamic @gol 69 -pie -pthread -r -rdynamic @gol
70 -s -static -static-pie -static-libgcc -static-libstdc++ @gol 70 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
71 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol 71 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
@@ -74,7 +74,7 @@ index f12d8d12150..cf6cb428e7d 100644
74 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 74 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
75 -u @var{symbol} -z @var{keyword}} 75 -u @var{symbol} -z @var{keyword}}
76 76
77@@ -14407,6 +14410,33 @@ Specify that the program entry point is @var{entry}. The argument is 77@@ -14468,6 +14471,33 @@ Specify that the program entry point is @var{entry}. The argument is
78 interpreted by the linker; the GNU linker accepts either a symbol name 78 interpreted by the linker; the GNU linker accepts either a symbol name
79 or an address. 79 or an address.
80 80
@@ -109,7 +109,7 @@ index f12d8d12150..cf6cb428e7d 100644
109 @opindex pie 109 @opindex pie
110 Produce a dynamically linked position independent executable on targets 110 Produce a dynamically linked position independent executable on targets
111diff --git a/gcc/gcc.c b/gcc/gcc.c 111diff --git a/gcc/gcc.c b/gcc/gcc.c
112index b2200c5185a..f8be58ce0a6 100644 112index f379f71da3d..1ee962acfaa 100644
113--- a/gcc/gcc.c 113--- a/gcc/gcc.c
114+++ b/gcc/gcc.c 114+++ b/gcc/gcc.c
115@@ -1051,6 +1051,7 @@ proper position among the other output files. */ 115@@ -1051,6 +1051,7 @@ proper position among the other output files. */
diff --git a/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch
index 9fbbe80703..7e43284c17 100644
--- a/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch
+++ b/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch
@@ -1,4 +1,4 @@
1From a6c90d3a9c5010b4aa7cc30467cf81ca7e0f430e Mon Sep 17 00:00:00 2001 1From a03125f58038c89637445fdfbb6c38d2b276633e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:16:28 +0400 3Date: Fri, 29 Mar 2013 09:16:28 +0400
4Subject: [PATCH] COLLECT_GCC_OPTIONS 4Subject: [PATCH] COLLECT_GCC_OPTIONS
@@ -14,10 +14,10 @@ Upstream-Status: Pending
14 1 file changed, 9 insertions(+) 14 1 file changed, 9 insertions(+)
15 15
16diff --git a/gcc/gcc.c b/gcc/gcc.c 16diff --git a/gcc/gcc.c b/gcc/gcc.c
17index f8be58ce0a6..48b0f9dde81 100644 17index 1ee962acfaa..39b1635651a 100644
18--- a/gcc/gcc.c 18--- a/gcc/gcc.c
19+++ b/gcc/gcc.c 19+++ b/gcc/gcc.c
20@@ -4806,6 +4806,15 @@ set_collect_gcc_options (void) 20@@ -4809,6 +4809,15 @@ set_collect_gcc_options (void)
21 sizeof ("COLLECT_GCC_OPTIONS=") - 1); 21 sizeof ("COLLECT_GCC_OPTIONS=") - 1);
22 22
23 first_time = TRUE; 23 first_time = TRUE;
diff --git a/meta/recipes-devtools/gcc/gcc/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
index a764bdd0f4..c7693a8b77 100644
--- a/meta/recipes-devtools/gcc/gcc/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
+++ b/meta/recipes-devtools/gcc/gcc/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -1,4 +1,4 @@
1From 5670d4489f119d2da661734895ac0be99b606d1b Mon Sep 17 00:00:00 2001 1From 938b65c6ba6cb4af24285f288126fe65b3e1fa9e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:17:25 +0400 3Date: Fri, 29 Mar 2013 09:17:25 +0400
4Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B} 4Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}
@@ -26,7 +26,7 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
26 4 files changed, 7 insertions(+), 7 deletions(-) 26 4 files changed, 7 insertions(+), 7 deletions(-)
27 27
28diff --git a/gcc/Makefile.in b/gcc/Makefile.in 28diff --git a/gcc/Makefile.in b/gcc/Makefile.in
29index 543b477ff18..a67d2cc18d6 100644 29index 646db219460..501a5f16d9f 100644
30--- a/gcc/Makefile.in 30--- a/gcc/Makefile.in
31+++ b/gcc/Makefile.in 31+++ b/gcc/Makefile.in
32@@ -540,7 +540,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ 32@@ -540,7 +540,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
@@ -39,10 +39,10 @@ index 543b477ff18..a67d2cc18d6 100644
39 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@ 39 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
40 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@ 40 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
41diff --git a/gcc/configure b/gcc/configure 41diff --git a/gcc/configure b/gcc/configure
42index 8de766a942c..b26e8fc7fee 100755 42index 8976850dff6..4d903cf40e8 100755
43--- a/gcc/configure 43--- a/gcc/configure
44+++ b/gcc/configure 44+++ b/gcc/configure
45@@ -12705,8 +12705,8 @@ for f in $tm_file; do 45@@ -12710,8 +12710,8 @@ for f in $tm_file; do
46 tm_include_list="${tm_include_list} $f" 46 tm_include_list="${tm_include_list} $f"
47 ;; 47 ;;
48 defaults.h ) 48 defaults.h )
@@ -54,10 +54,10 @@ index 8de766a942c..b26e8fc7fee 100755
54 * ) 54 * )
55 tm_file_list="${tm_file_list} \$(srcdir)/config/$f" 55 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
56diff --git a/gcc/configure.ac b/gcc/configure.ac 56diff --git a/gcc/configure.ac b/gcc/configure.ac
57index 8bfd6feb780..26fa46802c7 100644 57index 13eace6cfc6..07aacfee055 100644
58--- a/gcc/configure.ac 58--- a/gcc/configure.ac
59+++ b/gcc/configure.ac 59+++ b/gcc/configure.ac
60@@ -2138,8 +2138,8 @@ for f in $tm_file; do 60@@ -2143,8 +2143,8 @@ for f in $tm_file; do
61 tm_include_list="${tm_include_list} $f" 61 tm_include_list="${tm_include_list} $f"
62 ;; 62 ;;
63 defaults.h ) 63 defaults.h )
diff --git a/meta/recipes-devtools/gcc/gcc/0008-fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc/0008-fortran-cross-compile-hack.patch
index 714db3bef5..707066291f 100644
--- a/meta/recipes-devtools/gcc/gcc/0008-fortran-cross-compile-hack.patch
+++ b/meta/recipes-devtools/gcc/gcc/0008-fortran-cross-compile-hack.patch
@@ -1,4 +1,4 @@
1From f05062625e7a4751be723595a2f7a4b7fbeff311 Mon Sep 17 00:00:00 2001 1From 660bf2b932273e2cde495f31cc031bb084572862 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:20:01 +0400 3Date: Fri, 29 Mar 2013 09:20:01 +0400
4Subject: [PATCH] fortran cross-compile hack. 4Subject: [PATCH] fortran cross-compile hack.
@@ -16,10 +16,10 @@ Upstream-Status: Inappropriate [embedded specific]
16 2 files changed, 2 insertions(+), 2 deletions(-) 16 2 files changed, 2 insertions(+), 2 deletions(-)
17 17
18diff --git a/libgfortran/configure b/libgfortran/configure 18diff --git a/libgfortran/configure b/libgfortran/configure
19index b4cf854ddb3..e8e0ac3b1cf 100755 19index 1b4a8b10609..d7ab18fc9f9 100755
20--- a/libgfortran/configure 20--- a/libgfortran/configure
21+++ b/libgfortran/configure 21+++ b/libgfortran/configure
22@@ -13090,7 +13090,7 @@ esac 22@@ -13092,7 +13092,7 @@ esac
23 23
24 # We need gfortran to compile parts of the library 24 # We need gfortran to compile parts of the library
25 #AC_PROG_FC(gfortran) 25 #AC_PROG_FC(gfortran)
diff --git a/meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch
index 8ad6853d81..3f6b69a3cc 100644
--- a/meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch
+++ b/meta/recipes-devtools/gcc/gcc/0009-cpp-honor-sysroot.patch
@@ -1,4 +1,4 @@
1From 1d76de7f1f5c99f1fa1a4b14aedad3d702e4e136 Mon Sep 17 00:00:00 2001 1From 303cc9292cc0a1bd7bae994dd1e86197fb94068d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:22:00 +0400 3Date: Fri, 29 Mar 2013 09:22:00 +0400
4Subject: [PATCH] cpp: honor sysroot. 4Subject: [PATCH] cpp: honor sysroot.
@@ -37,10 +37,10 @@ index 0ad4a33b93e..16c744f4f90 100644
37+ " cc1plus -fpreprocessed %i %I %(cc1_options) %2" 37+ " cc1plus -fpreprocessed %i %I %(cc1_options) %2"
38 " %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, 38 " %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
39diff --git a/gcc/gcc.c b/gcc/gcc.c 39diff --git a/gcc/gcc.c b/gcc/gcc.c
40index 48b0f9dde81..c87f603955f 100644 40index 39b1635651a..e2e0bcee9b2 100644
41--- a/gcc/gcc.c 41--- a/gcc/gcc.c
42+++ b/gcc/gcc.c 42+++ b/gcc/gcc.c
43@@ -1348,7 +1348,7 @@ static const struct compiler default_compilers[] = 43@@ -1351,7 +1351,7 @@ static const struct compiler default_compilers[] =
44 %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0}, 44 %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
45 {".i", "@cpp-output", 0, 0, 0}, 45 {".i", "@cpp-output", 0, 0, 0},
46 {"@cpp-output", 46 {"@cpp-output",
diff --git a/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch b/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch
index 625e2d8709..1aa29e6ac5 100644
--- a/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch
+++ b/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch
@@ -1,4 +1,4 @@
1From 4fad4433c96bc9d0d9d124f9674fb3389f6f426e Mon Sep 17 00:00:00 2001 1From b75e8fb1cc1607077a113de40ae0d16ad273f05a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:23:08 +0400 3Date: Fri, 29 Mar 2013 09:23:08 +0400
4Subject: [PATCH] MIPS64: Default to N64 ABI 4Subject: [PATCH] MIPS64: Default to N64 ABI
@@ -14,10 +14,10 @@ Upstream-Status: Inappropriate [OE config specific]
14 1 file changed, 5 insertions(+), 5 deletions(-) 14 1 file changed, 5 insertions(+), 5 deletions(-)
15 15
16diff --git a/gcc/config.gcc b/gcc/config.gcc 16diff --git a/gcc/config.gcc b/gcc/config.gcc
17index cf1a87e2efd..37c4221a39f 100644 17index 6fcdd771d4c..feafcadfcac 100644
18--- a/gcc/config.gcc 18--- a/gcc/config.gcc
19+++ b/gcc/config.gcc 19+++ b/gcc/config.gcc
20@@ -2511,29 +2511,29 @@ mips*-*-linux*) # Linux MIPS, either endian. 20@@ -2542,29 +2542,29 @@ mips*-*-linux*) # Linux MIPS, either endian.
21 default_mips_arch=mips32 21 default_mips_arch=mips32
22 ;; 22 ;;
23 mips64el-st-linux-gnu) 23 mips64el-st-linux-gnu)
diff --git a/meta/recipes-devtools/gcc/gcc/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta/recipes-devtools/gcc/gcc/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
index e357976330..ee34836ea0 100644
--- a/meta/recipes-devtools/gcc/gcc/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
+++ b/meta/recipes-devtools/gcc/gcc/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -1,4 +1,4 @@
1From 8fc016a53c22c19feccbfa13ebdf19090dc67058 Mon Sep 17 00:00:00 2001 1From 438b8d40f6060c0d62b474b2ae970241f9635f6b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:24:50 +0400 3Date: Fri, 29 Mar 2013 09:24:50 +0400
4Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER 4Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
@@ -167,7 +167,7 @@ index 4afef7c228c..01997330741 100644
167 #define MUSL_ABI_SUFFIX \ 167 #define MUSL_ABI_SUFFIX \
168 "%{mabi=ilp32:-sf}" \ 168 "%{mabi=ilp32:-sf}" \
169diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h 169diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
170index 34776c8421e..967c1c43c63 100644 170index 2ded3301282..80969a8fd89 100644
171--- a/gcc/config/rs6000/linux64.h 171--- a/gcc/config/rs6000/linux64.h
172+++ b/gcc/config/rs6000/linux64.h 172+++ b/gcc/config/rs6000/linux64.h
173@@ -419,24 +419,19 @@ extern int dot_symbols; 173@@ -419,24 +419,19 @@ extern int dot_symbols;
@@ -214,10 +214,10 @@ index c1d0441d488..81373eb8336 100644
214 #undef SUBTARGET_LINK_EMUL_SUFFIX 214 #undef SUBTARGET_LINK_EMUL_SUFFIX
215 #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}" 215 #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
216diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h 216diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
217index 81201e67a2f..8b6fc577594 100644 217index 63853e60c03..31219e9892c 100644
218--- a/gcc/config/sparc/linux.h 218--- a/gcc/config/sparc/linux.h
219+++ b/gcc/config/sparc/linux.h 219+++ b/gcc/config/sparc/linux.h
220@@ -84,7 +84,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); 220@@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
221 When the -shared link option is used a final link is not being 221 When the -shared link option is used a final link is not being
222 done. */ 222 done. */
223 223
@@ -227,10 +227,10 @@ index 81201e67a2f..8b6fc577594 100644
227 #undef LINK_SPEC 227 #undef LINK_SPEC
228 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ 228 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
229diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h 229diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
230index a1a0efd8f28..85d1084afc2 100644 230index 19ce84d7adb..0d9cc752931 100644
231--- a/gcc/config/sparc/linux64.h 231--- a/gcc/config/sparc/linux64.h
232+++ b/gcc/config/sparc/linux64.h 232+++ b/gcc/config/sparc/linux64.h
233@@ -84,8 +84,8 @@ along with GCC; see the file COPYING3. If not see 233@@ -78,8 +78,8 @@ along with GCC; see the file COPYING3. If not see
234 When the -shared link option is used a final link is not being 234 When the -shared link option is used a final link is not being
235 done. */ 235 done. */
236 236
diff --git a/meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch b/meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch
index 88e1715b5c..ad2df92192 100644
--- a/meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch
+++ b/meta/recipes-devtools/gcc/gcc/0012-gcc-Fix-argument-list-too-long-error.patch
@@ -1,4 +1,4 @@
1From a22d1264049d29b90663cf5667049ae6f9b7a5ce Mon Sep 17 00:00:00 2001 1From cc2aac0b93f2f22a5fd0ecd80743e88d4e244597 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:26:37 +0400 3Date: Fri, 29 Mar 2013 09:26:37 +0400
4Subject: [PATCH] gcc: Fix argument list too long error. 4Subject: [PATCH] gcc: Fix argument list too long error.
@@ -22,17 +22,18 @@ fix. Add the sort to the original gcc code, leaving the tr+sort to fix the origi
22issue but include the new files too as reported by Zhuang <qiuguang.zqg@alibaba-inc.com> 22issue but include the new files too as reported by Zhuang <qiuguang.zqg@alibaba-inc.com>
23 23
24Upstream-Status: Pending 24Upstream-Status: Pending
25Signed-off-by: Khem Raj <raj.khem@gmail.com>
25--- 26---
26 gcc/Makefile.in | 2 +- 27 gcc/Makefile.in | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-) 28 1 file changed, 1 insertion(+), 1 deletion(-)
28 29
29diff --git a/gcc/Makefile.in b/gcc/Makefile.in 30diff --git a/gcc/Makefile.in b/gcc/Makefile.in
30index a67d2cc18d6..480c9366418 100644 31index 501a5f16d9f..674f1057aaf 100644
31--- a/gcc/Makefile.in 32--- a/gcc/Makefile.in
32+++ b/gcc/Makefile.in 33+++ b/gcc/Makefile.in
33@@ -3606,7 +3606,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype 34@@ -3609,7 +3609,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
34 # We keep the directory structure for files in config or c-family and .def 35 # We keep the directory structure for files in config, common/config or
35 # files. All other files are flattened to a single directory. 36 # c-family and .def files. All other files are flattened to a single directory.
36 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir) 37 $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
37- headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \ 38- headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
38+ headers=`echo $(sort $(PLUGIN_HEADERS)) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \ 39+ headers=`echo $(sort $(PLUGIN_HEADERS)) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
diff --git a/meta/recipes-devtools/gcc/gcc/0013-Disable-sdt.patch b/meta/recipes-devtools/gcc/gcc/0013-Disable-sdt.patch
index 207cdb57af..b93ae837ac 100644
--- a/meta/recipes-devtools/gcc/gcc/0013-Disable-sdt.patch
+++ b/meta/recipes-devtools/gcc/gcc/0013-Disable-sdt.patch
@@ -1,4 +1,4 @@
1From fa47586935a18ecfc2ad5586802e326e21741b7b Mon Sep 17 00:00:00 2001 1From d87eef0037d15f363b2614bac531626b87189d4f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:28:10 +0400 3Date: Fri, 29 Mar 2013 09:28:10 +0400
4Subject: [PATCH] Disable sdt. 4Subject: [PATCH] Disable sdt.
@@ -25,10 +25,10 @@ Upstream-Status: Inappropriate [hack]
25 4 files changed, 19 insertions(+), 19 deletions(-) 25 4 files changed, 19 insertions(+), 19 deletions(-)
26 26
27diff --git a/gcc/configure b/gcc/configure 27diff --git a/gcc/configure b/gcc/configure
28index b26e8fc7fee..6080f86145e 100755 28index 4d903cf40e8..156090550c2 100755
29--- a/gcc/configure 29--- a/gcc/configure
30+++ b/gcc/configure 30+++ b/gcc/configure
31@@ -29789,12 +29789,12 @@ fi 31@@ -29830,12 +29830,12 @@ fi
32 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5 32 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
33 $as_echo_n "checking sys/sdt.h in the target C library... " >&6; } 33 $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
34 have_sys_sdt_h=no 34 have_sys_sdt_h=no
@@ -48,10 +48,10 @@ index b26e8fc7fee..6080f86145e 100755
48 $as_echo "$have_sys_sdt_h" >&6; } 48 $as_echo "$have_sys_sdt_h" >&6; }
49 49
50diff --git a/gcc/configure.ac b/gcc/configure.ac 50diff --git a/gcc/configure.ac b/gcc/configure.ac
51index 26fa46802c7..42be5252778 100644 51index 07aacfee055..f31a43e7dd3 100644
52--- a/gcc/configure.ac 52--- a/gcc/configure.ac
53+++ b/gcc/configure.ac 53+++ b/gcc/configure.ac
54@@ -6190,15 +6190,15 @@ fi 54@@ -6203,15 +6203,15 @@ fi
55 AC_SUBST([enable_default_ssp]) 55 AC_SUBST([enable_default_ssp])
56 56
57 # Test for <sys/sdt.h> on the target. 57 # Test for <sys/sdt.h> on the target.
@@ -77,10 +77,10 @@ index 26fa46802c7..42be5252778 100644
77 # Check if TFmode long double should be used by default or not. 77 # Check if TFmode long double should be used by default or not.
78 # Some glibc targets used DFmode long double, but with glibc 2.4 78 # Some glibc targets used DFmode long double, but with glibc 2.4
79diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure 79diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
80index 9f9c5a2419a..71ed13b815b 100755 80index 766a0a8d504..ba59088a722 100755
81--- a/libstdc++-v3/configure 81--- a/libstdc++-v3/configure
82+++ b/libstdc++-v3/configure 82+++ b/libstdc++-v3/configure
83@@ -22615,11 +22615,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' 83@@ -21986,11 +21986,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
84 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' 84 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
85 ac_compiler_gnu=$ac_cv_c_compiler_gnu 85 ac_compiler_gnu=$ac_cv_c_compiler_gnu
86 86
@@ -96,10 +96,10 @@ index 9f9c5a2419a..71ed13b815b 100755
96 $as_echo "$glibcxx_cv_sys_sdt_h" >&6; } 96 $as_echo "$glibcxx_cv_sys_sdt_h" >&6; }
97 97
98diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac 98diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
99index 699e55fd829..5c7a7bda439 100644 99index 07cf05b6856..dd5f26957d5 100644
100--- a/libstdc++-v3/configure.ac 100--- a/libstdc++-v3/configure.ac
101+++ b/libstdc++-v3/configure.ac 101+++ b/libstdc++-v3/configure.ac
102@@ -241,7 +241,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN 102@@ -240,7 +240,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
103 GLIBCXX_CHECK_SC_NPROC_ONLN 103 GLIBCXX_CHECK_SC_NPROC_ONLN
104 GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP 104 GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
105 GLIBCXX_CHECK_SYSCTL_HW_NCPU 105 GLIBCXX_CHECK_SYSCTL_HW_NCPU
diff --git a/meta/recipes-devtools/gcc/gcc/0014-libtool.patch b/meta/recipes-devtools/gcc/gcc/0014-libtool.patch
index f4e70c3b18..3da3261bfe 100644
--- a/meta/recipes-devtools/gcc/gcc/0014-libtool.patch
+++ b/meta/recipes-devtools/gcc/gcc/0014-libtool.patch
@@ -1,4 +1,4 @@
1From 6ecd478881468934444ff85611fd43f7033b1e81 Mon Sep 17 00:00:00 2001 1From d1584292b3a199dc6318f7508fd0c74ec4169a21 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:29:11 +0400 3Date: Fri, 29 Mar 2013 09:29:11 +0400
4Subject: [PATCH] libtool 4Subject: [PATCH] libtool
diff --git a/meta/recipes-devtools/gcc/gcc/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta/recipes-devtools/gcc/gcc/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
index bc2674abcc..e08e44cc04 100644
--- a/meta/recipes-devtools/gcc/gcc/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
+++ b/meta/recipes-devtools/gcc/gcc/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -1,4 +1,4 @@
1From de4427fa49c07dc651ee6ceaf5c5078700ca3b08 Mon Sep 17 00:00:00 2001 1From b7a96ff62cc0daa3a789c720d30e2edaabbafe5d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:30:32 +0400 3Date: Fri, 29 Mar 2013 09:30:32 +0400
4Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI. 4Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI.
diff --git a/meta/recipes-devtools/gcc/gcc/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta/recipes-devtools/gcc/gcc/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
index 1dc4bb859a..d86da6517f 100644
--- a/meta/recipes-devtools/gcc/gcc/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
+++ b/meta/recipes-devtools/gcc/gcc/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -1,4 +1,4 @@
1From 6b363c2c1c089ee900efa6013aefba1003840a37 Mon Sep 17 00:00:00 2001 1From 187e962aed3b3f39a96eb4419a7fa23e88634efb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:33:04 +0400 3Date: Fri, 29 Mar 2013 09:33:04 +0400
4Subject: [PATCH] Use the multilib config files from ${B} instead of using the 4Subject: [PATCH] Use the multilib config files from ${B} instead of using the
@@ -18,10 +18,10 @@ Upstream-Status: Inappropriate [configuration]
18 2 files changed, 36 insertions(+), 8 deletions(-) 18 2 files changed, 36 insertions(+), 8 deletions(-)
19 19
20diff --git a/gcc/configure b/gcc/configure 20diff --git a/gcc/configure b/gcc/configure
21index 6080f86145e..825a9652329 100755 21index 156090550c2..fde89ad8e89 100755
22--- a/gcc/configure 22--- a/gcc/configure
23+++ b/gcc/configure 23+++ b/gcc/configure
24@@ -12685,10 +12685,20 @@ done 24@@ -12690,10 +12690,20 @@ done
25 tmake_file_= 25 tmake_file_=
26 for f in ${tmake_file} 26 for f in ${tmake_file}
27 do 27 do
@@ -46,7 +46,7 @@ index 6080f86145e..825a9652329 100755
46 done 46 done
47 tmake_file="${tmake_file_}${omp_device_property_tmake_file}" 47 tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
48 48
49@@ -12699,6 +12709,10 @@ tm_file_list="options.h" 49@@ -12704,6 +12714,10 @@ tm_file_list="options.h"
50 tm_include_list="options.h insn-constants.h" 50 tm_include_list="options.h insn-constants.h"
51 for f in $tm_file; do 51 for f in $tm_file; do
52 case $f in 52 case $f in
@@ -58,10 +58,10 @@ index 6080f86145e..825a9652329 100755
58 f=`echo $f | sed 's/^..//'` 58 f=`echo $f | sed 's/^..//'`
59 tm_file_list="${tm_file_list} $f" 59 tm_file_list="${tm_file_list} $f"
60diff --git a/gcc/configure.ac b/gcc/configure.ac 60diff --git a/gcc/configure.ac b/gcc/configure.ac
61index 42be5252778..6099eb3251f 100644 61index f31a43e7dd3..cad69549a01 100644
62--- a/gcc/configure.ac 62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac 63+++ b/gcc/configure.ac
64@@ -2118,10 +2118,20 @@ done 64@@ -2123,10 +2123,20 @@ done
65 tmake_file_= 65 tmake_file_=
66 for f in ${tmake_file} 66 for f in ${tmake_file}
67 do 67 do
@@ -86,7 +86,7 @@ index 42be5252778..6099eb3251f 100644
86 done 86 done
87 tmake_file="${tmake_file_}${omp_device_property_tmake_file}" 87 tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
88 88
89@@ -2132,6 +2142,10 @@ tm_file_list="options.h" 89@@ -2137,6 +2147,10 @@ tm_file_list="options.h"
90 tm_include_list="options.h insn-constants.h" 90 tm_include_list="options.h insn-constants.h"
91 for f in $tm_file; do 91 for f in $tm_file; do
92 case $f in 92 case $f in
diff --git a/meta/recipes-devtools/gcc/gcc/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta/recipes-devtools/gcc/gcc/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
index 05f12847e9..55eb44e326 100644
--- a/meta/recipes-devtools/gcc/gcc/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
+++ b/meta/recipes-devtools/gcc/gcc/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
@@ -1,4 +1,4 @@
1From 08752c2f1d21553301bee5757c453c6a36cbe03c Mon Sep 17 00:00:00 2001 1From 6211545ca5aa4a5bfb7c4dfcfdb9db7e5511b40e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 09:39:38 +0000 3Date: Fri, 20 Feb 2015 09:39:38 +0000
4Subject: [PATCH] Avoid using libdir from .la which usually points to a host 4Subject: [PATCH] Avoid using libdir from .la which usually points to a host
diff --git a/meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch b/meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch
index 886a1221d3..5f28e868e2 100644
--- a/meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch
+++ b/meta/recipes-devtools/gcc/gcc/0018-export-CPP.patch
@@ -1,4 +1,4 @@
1From 5c3d66378c7ff60ca11a875aa4aa6f8a8529d43a Mon Sep 17 00:00:00 2001 1From 9d8512e3efa0d125714bafb907734a0c095b84ce Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 09:40:59 +0000 3Date: Fri, 20 Feb 2015 09:40:59 +0000
4Subject: [PATCH] export CPP 4Subject: [PATCH] export CPP
diff --git a/meta/recipes-devtools/gcc/gcc/0019-Ensure-target-gcc-headers-can-be-included.patch b/meta/recipes-devtools/gcc/gcc/0019-Ensure-target-gcc-headers-can-be-included.patch
index 2797b2c22d..9e9f2874db 100644
--- a/meta/recipes-devtools/gcc/gcc/0019-Ensure-target-gcc-headers-can-be-included.patch
+++ b/meta/recipes-devtools/gcc/gcc/0019-Ensure-target-gcc-headers-can-be-included.patch
@@ -1,4 +1,4 @@
1From 378b752c5d9a3dba4e58cdadf8b4b4f34ea99a76 Mon Sep 17 00:00:00 2001 1From 468604663f799d3d80d0db760f03ba32678801aa Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 10:25:11 +0000 3Date: Fri, 20 Feb 2015 10:25:11 +0000
4Subject: [PATCH] Ensure target gcc headers can be included 4Subject: [PATCH] Ensure target gcc headers can be included
@@ -21,7 +21,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
21 2 files changed, 6 insertions(+) 21 2 files changed, 6 insertions(+)
22 22
23diff --git a/gcc/Makefile.in b/gcc/Makefile.in 23diff --git a/gcc/Makefile.in b/gcc/Makefile.in
24index 480c9366418..011c7ac2db6 100644 24index 674f1057aaf..087bf3f1137 100644
25--- a/gcc/Makefile.in 25--- a/gcc/Makefile.in
26+++ b/gcc/Makefile.in 26+++ b/gcc/Makefile.in
27@@ -618,6 +618,7 @@ libexecdir = @libexecdir@ 27@@ -618,6 +618,7 @@ libexecdir = @libexecdir@
@@ -32,7 +32,7 @@ index 480c9366418..011c7ac2db6 100644
32 # Directory in which the compiler finds executables 32 # Directory in which the compiler finds executables
33 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix) 33 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
34 # Directory in which all plugin resources are installed 34 # Directory in which all plugin resources are installed
35@@ -2946,6 +2947,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\" 35@@ -2948,6 +2949,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
36 36
37 PREPROCESSOR_DEFINES = \ 37 PREPROCESSOR_DEFINES = \
38 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ 38 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
diff --git a/meta/recipes-devtools/gcc/gcc/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta/recipes-devtools/gcc/gcc/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch
index c3baf8b451..ce838ebcdb 100644
--- a/meta/recipes-devtools/gcc/gcc/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch
+++ b/meta/recipes-devtools/gcc/gcc/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch
@@ -1,4 +1,4 @@
1From 870e805d705d99d9b9d7dbd09727f9c1d2ad9c1d Mon Sep 17 00:00:00 2001 1From dbdf19800e24571603b0baee1734a58ff2cf2974 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 3 Mar 2015 08:21:19 +0000 3Date: Tue, 3 Mar 2015 08:21:19 +0000
4Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix 4Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix
diff --git a/meta/recipes-devtools/gcc/gcc/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch b/meta/recipes-devtools/gcc/gcc/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
index abee48669d..58327209d4 100644
--- a/meta/recipes-devtools/gcc/gcc/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
+++ b/meta/recipes-devtools/gcc/gcc/0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
@@ -1,4 +1,4 @@
1From aba42de763a619355471efd1573561b0cbf51162 Mon Sep 17 00:00:00 2001 1From 7c019b932f06bdce624b4739fba75dacff794076 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 28 Apr 2015 23:15:27 -0700 3Date: Tue, 28 Apr 2015 23:15:27 -0700
4Subject: [PATCH] Use SYSTEMLIBS_DIR replacement instead of hardcoding 4Subject: [PATCH] Use SYSTEMLIBS_DIR replacement instead of hardcoding
diff --git a/meta/recipes-devtools/gcc/gcc/0022-aarch64-Add-support-for-musl-ldso.patch b/meta/recipes-devtools/gcc/gcc/0022-aarch64-Add-support-for-musl-ldso.patch
index c55b66d4ba..851f8ed063 100644
--- a/meta/recipes-devtools/gcc/gcc/0022-aarch64-Add-support-for-musl-ldso.patch
+++ b/meta/recipes-devtools/gcc/gcc/0022-aarch64-Add-support-for-musl-ldso.patch
@@ -1,4 +1,4 @@
1From d63820a78d92f302410358293546f01c7ad17bd8 Mon Sep 17 00:00:00 2001 1From ce93292090b1a8cb0b0b0061ec09243936bf9bcf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 28 Apr 2015 23:18:39 -0700 3Date: Tue, 28 Apr 2015 23:18:39 -0700
4Subject: [PATCH] aarch64: Add support for musl ldso 4Subject: [PATCH] aarch64: Add support for musl ldso
diff --git a/meta/recipes-devtools/gcc/gcc/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta/recipes-devtools/gcc/gcc/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch
index 80c4d2292c..d981b37658 100644
--- a/meta/recipes-devtools/gcc/gcc/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch
+++ b/meta/recipes-devtools/gcc/gcc/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch
@@ -1,4 +1,4 @@
1From 3474e16ad4ea8cf4e0e330568e3bc9039e723dce Mon Sep 17 00:00:00 2001 1From cc298bd514d32cea58bfbdbda503d710355e97b4 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com> 2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Sun, 5 Jul 2015 20:25:18 -0700 3Date: Sun, 5 Jul 2015 20:25:18 -0700
4Subject: [PATCH] libcc1: fix libcc1's install path and rpath 4Subject: [PATCH] libcc1: fix libcc1's install path and rpath
@@ -20,10 +20,10 @@ Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
20 2 files changed, 4 insertions(+), 4 deletions(-) 20 2 files changed, 4 insertions(+), 4 deletions(-)
21 21
22diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am 22diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
23index c005b0dad4a..ec31d35b7b9 100644 23index fe7b64cbc6f..bdd0617049b 100644
24--- a/libcc1/Makefile.am 24--- a/libcc1/Makefile.am
25+++ b/libcc1/Makefile.am 25+++ b/libcc1/Makefile.am
26@@ -37,8 +37,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ 26@@ -40,8 +40,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
27 $(Wc)$(libiberty_normal))) 27 $(Wc)$(libiberty_normal)))
28 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty)) 28 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
29 29
@@ -35,10 +35,10 @@ index c005b0dad4a..ec31d35b7b9 100644
35 if ENABLE_PLUGIN 35 if ENABLE_PLUGIN
36 plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la 36 plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
37diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in 37diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
38index 7104b649026..2103c477468 100644 38index 2def836cb06..98e12a9d369 100644
39--- a/libcc1/Makefile.in 39--- a/libcc1/Makefile.in
40+++ b/libcc1/Makefile.in 40+++ b/libcc1/Makefile.in
41@@ -393,8 +393,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ 41@@ -394,8 +394,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
42 $(Wc)$(libiberty_normal))) 42 $(Wc)$(libiberty_normal)))
43 43
44 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty)) 44 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
diff --git a/meta/recipes-devtools/gcc/gcc/0024-handle-sysroot-support-for-nativesdk-gcc.patch b/meta/recipes-devtools/gcc/gcc/0024-handle-sysroot-support-for-nativesdk-gcc.patch
index dc3e6da65a..6c75c0f2bf 100644
--- a/meta/recipes-devtools/gcc/gcc/0024-handle-sysroot-support-for-nativesdk-gcc.patch
+++ b/meta/recipes-devtools/gcc/gcc/0024-handle-sysroot-support-for-nativesdk-gcc.patch
@@ -1,4 +1,4 @@
1From 702daf2e9cb97337e0e594fcd435b1b61a917d14 Mon Sep 17 00:00:00 2001 1From 2966f3c43382fa4f79cbac761232dae2e92e7012 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:39:54 +0000 3Date: Mon, 7 Dec 2015 23:39:54 +0000
4Subject: [PATCH] handle sysroot support for nativesdk-gcc 4Subject: [PATCH] handle sysroot support for nativesdk-gcc
@@ -41,7 +41,7 @@ Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
41 6 files changed, 70 insertions(+), 48 deletions(-) 41 6 files changed, 70 insertions(+), 48 deletions(-)
42 42
43diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c 43diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
44index 58ba0948e79..806bbcfb7a5 100644 44index c51d6d34726..aa7507df2cf 100644
45--- a/gcc/c-family/c-opts.c 45--- a/gcc/c-family/c-opts.c
46+++ b/gcc/c-family/c-opts.c 46+++ b/gcc/c-family/c-opts.c
47@@ -1409,8 +1409,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain) 47@@ -1409,8 +1409,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain)
@@ -214,7 +214,7 @@ index a681264f75e..5e10a2fa140 100644
214 subdirectory of the actual installation. */ 214 subdirectory of the actual installation. */
215 extern const char *gcc_exec_prefix; 215 extern const char *gcc_exec_prefix;
216diff --git a/gcc/gcc.c b/gcc/gcc.c 216diff --git a/gcc/gcc.c b/gcc/gcc.c
217index c87f603955f..535d5c3bb65 100644 217index e2e0bcee9b2..912c2febf94 100644
218--- a/gcc/gcc.c 218--- a/gcc/gcc.c
219+++ b/gcc/gcc.c 219+++ b/gcc/gcc.c
220@@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL; 220@@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL;
@@ -234,7 +234,7 @@ index c87f603955f..535d5c3bb65 100644
234 %S process STARTFILE_SPEC as a spec. A capital S is actually used here. 234 %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
235 %E process ENDFILE_SPEC as a spec. A capital E is actually used here. 235 %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
236 %C process CPP_SPEC as a spec. 236 %C process CPP_SPEC as a spec.
237@@ -1499,10 +1502,10 @@ static const char *gcc_libexec_prefix; 237@@ -1502,10 +1505,10 @@ static const char *gcc_libexec_prefix;
238 gcc_exec_prefix is set because, in that case, we know where the 238 gcc_exec_prefix is set because, in that case, we know where the
239 compiler has been installed, and use paths relative to that 239 compiler has been installed, and use paths relative to that
240 location instead. */ 240 location instead. */
@@ -249,7 +249,7 @@ index c87f603955f..535d5c3bb65 100644
249 249
250 /* For native compilers, these are well-known paths containing 250 /* For native compilers, these are well-known paths containing
251 components that may be provided by the system. For cross 251 components that may be provided by the system. For cross
252@@ -1510,9 +1513,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; 252@@ -1513,9 +1516,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
253 static const char *md_exec_prefix = MD_EXEC_PREFIX; 253 static const char *md_exec_prefix = MD_EXEC_PREFIX;
254 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; 254 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
255 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; 255 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
@@ -261,7 +261,7 @@ index c87f603955f..535d5c3bb65 100644
261 = STANDARD_STARTFILE_PREFIX_2; 261 = STANDARD_STARTFILE_PREFIX_2;
262 262
263 /* A relative path to be used in finding the location of tools 263 /* A relative path to be used in finding the location of tools
264@@ -5952,6 +5955,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) 264@@ -5955,6 +5958,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
265 } 265 }
266 break; 266 break;
267 267
@@ -344,6 +344,3 @@ index 1a403e535bd..c26d07bde12 100644
344 344
345 /* We used to strip trailing DIR_SEPARATORs here, but that can 345 /* We used to strip trailing DIR_SEPARATORs here, but that can
346 sometimes yield a result with no separator when one was coded 346 sometimes yield a result with no separator when one was coded
347--
3482.29.2
349
diff --git a/meta/recipes-devtools/gcc/gcc/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta/recipes-devtools/gcc/gcc/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch
index abf1f8491f..e8b52daf25 100644
--- a/meta/recipes-devtools/gcc/gcc/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch
+++ b/meta/recipes-devtools/gcc/gcc/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch
@@ -1,4 +1,4 @@
1From 9c0c73ee48dbee2aad57f4dcdad1b7b74e77b944 Mon Sep 17 00:00:00 2001 1From 5fdf6a0e959c26512c795bf904b35348f749406c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:41:45 +0000 3Date: Mon, 7 Dec 2015 23:41:45 +0000
4Subject: [PATCH] Search target sysroot gcc version specific dirs with 4Subject: [PATCH] Search target sysroot gcc version specific dirs with
@@ -51,10 +51,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
51 1 file changed, 28 insertions(+), 1 deletion(-) 51 1 file changed, 28 insertions(+), 1 deletion(-)
52 52
53diff --git a/gcc/gcc.c b/gcc/gcc.c 53diff --git a/gcc/gcc.c b/gcc/gcc.c
54index 535d5c3bb65..04647ae812d 100644 54index 912c2febf94..24a92bf27f9 100644
55--- a/gcc/gcc.c 55--- a/gcc/gcc.c
56+++ b/gcc/gcc.c 56+++ b/gcc/gcc.c
57@@ -2616,7 +2616,7 @@ for_each_path (const struct path_prefix *paths, 57@@ -2619,7 +2619,7 @@ for_each_path (const struct path_prefix *paths,
58 if (path == NULL) 58 if (path == NULL)
59 { 59 {
60 len = paths->max_len + extra_space + 1; 60 len = paths->max_len + extra_space + 1;
@@ -63,7 +63,7 @@ index 535d5c3bb65..04647ae812d 100644
63 path = XNEWVEC (char, len); 63 path = XNEWVEC (char, len);
64 } 64 }
65 65
66@@ -2628,6 +2628,33 @@ for_each_path (const struct path_prefix *paths, 66@@ -2631,6 +2631,33 @@ for_each_path (const struct path_prefix *paths,
67 /* Look first in MACHINE/VERSION subdirectory. */ 67 /* Look first in MACHINE/VERSION subdirectory. */
68 if (!skip_multi_dir) 68 if (!skip_multi_dir)
69 { 69 {
diff --git a/meta/recipes-devtools/gcc/gcc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch b/meta/recipes-devtools/gcc/gcc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch
index 97bf2f3a73..0356baac5c 100644
--- a/meta/recipes-devtools/gcc/gcc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch
+++ b/meta/recipes-devtools/gcc/gcc/0026-Fix-various-_FOR_BUILD-and-related-variables.patch
@@ -1,4 +1,4 @@
1From 3a003af8804dda90fdf4862eca5f66cb12faaf02 Mon Sep 17 00:00:00 2001 1From b647a62ddbbb7fbc58aa865cd2d34539677eb107 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:42:45 +0000 3Date: Mon, 7 Dec 2015 23:42:45 +0000
4Subject: [PATCH] Fix various _FOR_BUILD and related variables 4Subject: [PATCH] Fix various _FOR_BUILD and related variables
@@ -94,7 +94,7 @@ index efed1511750..778beb705b4 100644
94 CFLAGS="$(CFLAGS)"; export CFLAGS; \ 94 CFLAGS="$(CFLAGS)"; export CFLAGS; \
95 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ 95 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
96diff --git a/gcc/Makefile.in b/gcc/Makefile.in 96diff --git a/gcc/Makefile.in b/gcc/Makefile.in
97index 011c7ac2db6..2f1165f7b5e 100644 97index 087bf3f1137..272d521a276 100644
98--- a/gcc/Makefile.in 98--- a/gcc/Makefile.in
99+++ b/gcc/Makefile.in 99+++ b/gcc/Makefile.in
100@@ -805,7 +805,7 @@ BUILD_LDFLAGS=@BUILD_LDFLAGS@ 100@@ -805,7 +805,7 @@ BUILD_LDFLAGS=@BUILD_LDFLAGS@
@@ -107,10 +107,10 @@ index 011c7ac2db6..2f1165f7b5e 100644
107 # Actual name to use when installing a native compiler. 107 # Actual name to use when installing a native compiler.
108 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)') 108 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
109diff --git a/gcc/configure b/gcc/configure 109diff --git a/gcc/configure b/gcc/configure
110index 825a9652329..ff46cf58960 100755 110index fde89ad8e89..e042e992419 100755
111--- a/gcc/configure 111--- a/gcc/configure
112+++ b/gcc/configure 112+++ b/gcc/configure
113@@ -12314,7 +12314,7 @@ else 113@@ -12319,7 +12319,7 @@ else
114 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ 114 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
115 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ 115 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
116 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ 116 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
@@ -120,10 +120,10 @@ index 825a9652329..ff46cf58960 100755
120 --enable-languages=${enable_languages-all} \ 120 --enable-languages=${enable_languages-all} \
121 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \ 121 ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
122diff --git a/gcc/configure.ac b/gcc/configure.ac 122diff --git a/gcc/configure.ac b/gcc/configure.ac
123index 6099eb3251f..b3c345b61dc 100644 123index cad69549a01..8e35c9be7f9 100644
124--- a/gcc/configure.ac 124--- a/gcc/configure.ac
125+++ b/gcc/configure.ac 125+++ b/gcc/configure.ac
126@@ -1898,7 +1898,7 @@ else 126@@ -1903,7 +1903,7 @@ else
127 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ 127 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
128 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ 128 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
129 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ 129 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
diff --git a/meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
index 3cd75b7183..47de3c354c 100644
--- a/meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
+++ b/meta/recipes-devtools/gcc/gcc/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
@@ -1,4 +1,4 @@
1From 4e53d0ae70af85af0e112a48a3e4dfe4c39f4a8d Mon Sep 17 00:00:00 2001 1From f7a6ddd3fb612393595f6e959e99d48c26f4d14f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 2 Feb 2016 10:26:10 -0800 3Date: Tue, 2 Feb 2016 10:26:10 -0800
4Subject: [PATCH] nios2: Define MUSL_DYNAMIC_LINKER 4Subject: [PATCH] nios2: Define MUSL_DYNAMIC_LINKER
diff --git a/meta/recipes-devtools/gcc/gcc/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta/recipes-devtools/gcc/gcc/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
index 2a6769a82e..cd409a894c 100644
--- a/meta/recipes-devtools/gcc/gcc/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
+++ b/meta/recipes-devtools/gcc/gcc/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
@@ -1,4 +1,4 @@
1From 5db0404eb770ac477fd99d444226bcf021067584 Mon Sep 17 00:00:00 2001 1From 0bb86e4d2ab0bb44bab37a005f971cf94046ff0d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 27 Jun 2017 18:10:54 -0700 3Date: Tue, 27 Jun 2017 18:10:54 -0700
4Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets 4Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets
@@ -62,7 +62,7 @@ index b7026fcbee7..dd54d6c393e 100644
62 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \ 62 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
63 %{!static-pie: \ 63 %{!static-pie: \
64diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h 64diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
65index 967c1c43c63..dc5e4d97975 100644 65index 80969a8fd89..97a78ae945c 100644
66--- a/gcc/config/rs6000/linux64.h 66--- a/gcc/config/rs6000/linux64.h
67+++ b/gcc/config/rs6000/linux64.h 67+++ b/gcc/config/rs6000/linux64.h
68@@ -452,6 +452,16 @@ extern int dot_symbols; 68@@ -452,6 +452,16 @@ extern int dot_symbols;
diff --git a/meta/recipes-devtools/gcc/gcc/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch b/meta/recipes-devtools/gcc/gcc/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
index 767cba0380..9342329ecf 100644
--- a/meta/recipes-devtools/gcc/gcc/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
+++ b/meta/recipes-devtools/gcc/gcc/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
@@ -1,4 +1,4 @@
1From fbc926dbf6a47fa623b9c94cd9b09a0e90448fdc Mon Sep 17 00:00:00 2001 1From 61b000792f32d4ca9b4b4498ebb7fd5d1deed710 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 4 May 2016 21:11:34 -0700 3Date: Wed, 4 May 2016 21:11:34 -0700
4Subject: [PATCH] Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS 4Subject: [PATCH] Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS
diff --git a/meta/recipes-devtools/gcc/gcc/0030-sync-gcc-stddef.h-with-musl.patch b/meta/recipes-devtools/gcc/gcc/0030-sync-gcc-stddef.h-with-musl.patch
index 4f18907a1d..ffbf6b97ab 100644
--- a/meta/recipes-devtools/gcc/gcc/0030-sync-gcc-stddef.h-with-musl.patch
+++ b/meta/recipes-devtools/gcc/gcc/0030-sync-gcc-stddef.h-with-musl.patch
@@ -1,4 +1,4 @@
1From 24dc04dc8d69e3bf61322615b3ef18e02ccd311e Mon Sep 17 00:00:00 2001 1From 92f588c68008176e7f6f1b3d534670bddedae783 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 3 Feb 2017 12:56:00 -0800 3Date: Fri, 3 Feb 2017 12:56:00 -0800
4Subject: [PATCH] sync gcc stddef.h with musl 4Subject: [PATCH] sync gcc stddef.h with musl
diff --git a/meta/recipes-devtools/gcc/gcc/0031-fix-segmentation-fault-in-precompiled-header-generat.patch b/meta/recipes-devtools/gcc/gcc/0031-fix-segmentation-fault-in-precompiled-header-generat.patch
index 702279af0e..0b93a055c2 100644
--- a/meta/recipes-devtools/gcc/gcc/0031-fix-segmentation-fault-in-precompiled-header-generat.patch
+++ b/meta/recipes-devtools/gcc/gcc/0031-fix-segmentation-fault-in-precompiled-header-generat.patch
@@ -1,4 +1,4 @@
1From 27b8ba5555ada2dab076988529bfb84d00a4b901 Mon Sep 17 00:00:00 2001 1From d3b25e66c7f9c86b5da0fd3e9e6236e0b59dc934 Mon Sep 17 00:00:00 2001
2From: Juro Bystricky <juro.bystricky@intel.com> 2From: Juro Bystricky <juro.bystricky@intel.com>
3Date: Mon, 19 Mar 2018 22:31:20 -0700 3Date: Mon, 19 Mar 2018 22:31:20 -0700
4Subject: [PATCH] fix segmentation fault in precompiled header generation 4Subject: [PATCH] fix segmentation fault in precompiled header generation
@@ -19,7 +19,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
19 1 file changed, 21 insertions(+), 5 deletions(-) 19 1 file changed, 21 insertions(+), 5 deletions(-)
20 20
21diff --git a/libcpp/lex.c b/libcpp/lex.c 21diff --git a/libcpp/lex.c b/libcpp/lex.c
22index 56ac3a1dd73..73a951148b3 100644 22index 665297af776..0ac5d67ddf0 100644
23--- a/libcpp/lex.c 23--- a/libcpp/lex.c
24+++ b/libcpp/lex.c 24+++ b/libcpp/lex.c
25@@ -3311,11 +3311,27 @@ cpp_spell_token (cpp_reader *pfile, const cpp_token *token, 25@@ -3311,11 +3311,27 @@ cpp_spell_token (cpp_reader *pfile, const cpp_token *token,
diff --git a/meta/recipes-devtools/gcc/gcc/0032-Fix-for-testsuite-failure.patch b/meta/recipes-devtools/gcc/gcc/0032-Fix-for-testsuite-failure.patch
index 0a0767b441..515c1d8186 100644
--- a/meta/recipes-devtools/gcc/gcc/0032-Fix-for-testsuite-failure.patch
+++ b/meta/recipes-devtools/gcc/gcc/0032-Fix-for-testsuite-failure.patch
@@ -1,4 +1,4 @@
1From 2512aacf023c679d86d8f40caff4f6ff412b32ff Mon Sep 17 00:00:00 2001 1From a3beed38a5eaa122c375451adafd78289512ac5f Mon Sep 17 00:00:00 2001
2From: RAGHUNATH LOLUR <raghunath.lolur@kpit.com> 2From: RAGHUNATH LOLUR <raghunath.lolur@kpit.com>
3Date: Wed, 6 Dec 2017 22:52:26 -0800 3Date: Wed, 6 Dec 2017 22:52:26 -0800
4Subject: [PATCH] Fix for testsuite failure 4Subject: [PATCH] Fix for testsuite failure
diff --git a/meta/recipes-devtools/gcc/gcc/0033-Re-introduce-spe-commandline-options.patch b/meta/recipes-devtools/gcc/gcc/0033-Re-introduce-spe-commandline-options.patch
index ba7c2b8fd5..8a8eda89b1 100644
--- a/meta/recipes-devtools/gcc/gcc/0033-Re-introduce-spe-commandline-options.patch
+++ b/meta/recipes-devtools/gcc/gcc/0033-Re-introduce-spe-commandline-options.patch
@@ -1,4 +1,4 @@
1From 3fc06241ce37e2e4b3ed21ace28d347eb511448d Mon Sep 17 00:00:00 2001 1From c1675b1dbc8b662eadaaa8ebf5bbfc783b7ecc75 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 6 Jun 2018 12:10:22 -0700 3Date: Wed, 6 Jun 2018 12:10:22 -0700
4Subject: [PATCH] Re-introduce spe commandline options 4Subject: [PATCH] Re-introduce spe commandline options
@@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 1 file changed, 12 insertions(+) 14 1 file changed, 12 insertions(+)
15 15
16diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt 16diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
17index f95b8279270..0e52d51409d 100644 17index 4e3792bcefa..edfa4f7de48 100644
18--- a/gcc/config/rs6000/rs6000.opt 18--- a/gcc/config/rs6000/rs6000.opt
19+++ b/gcc/config/rs6000/rs6000.opt 19+++ b/gcc/config/rs6000/rs6000.opt
20@@ -344,6 +344,18 @@ mdebug= 20@@ -344,6 +344,18 @@ mdebug=
@@ -33,6 +33,6 @@ index f95b8279270..0e52d51409d 100644
33+Target RejectNegative Var(rs6000_spe_abi, 0) 33+Target RejectNegative Var(rs6000_spe_abi, 0)
34+Do not use the SPE ABI extensions. 34+Do not use the SPE ABI extensions.
35+ 35+
36 ; Altivec ABI
36 mabi=altivec 37 mabi=altivec
37 Target RejectNegative Var(rs6000_altivec_abi) Save 38 Target RejectNegative Var(rs6000_altivec_abi) Save
38 Use the AltiVec ABI extensions.
diff --git a/meta/recipes-devtools/gcc/gcc/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta/recipes-devtools/gcc/gcc/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
index 4ce9dc6def..7dd334494d 100644
--- a/meta/recipes-devtools/gcc/gcc/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
+++ b/meta/recipes-devtools/gcc/gcc/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
@@ -1,4 +1,4 @@
1From b42ff59c3fe2967d37815c8db72a47b9b7f585b4 Mon Sep 17 00:00:00 2001 1From 0c8d6cd3a5de6cdb832fdba4ec39d029432e76e6 Mon Sep 17 00:00:00 2001
2From: Szabolcs Nagy <nsz@port70.net> 2From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000 3Date: Sat, 24 Oct 2015 20:09:53 +0000
4Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of 4Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
@@ -39,10 +39,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
39 3 files changed, 6 insertions(+), 6 deletions(-) 39 3 files changed, 6 insertions(+), 6 deletions(-)
40 40
41diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c 41diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
42index 48f00c5fcfc..468f5f71fac 100644 42index 47d52550e5e..9cb8cc7950e 100644
43--- a/gcc/config/i386/i386-expand.c 43--- a/gcc/config/i386/i386-expand.c
44+++ b/gcc/config/i386/i386-expand.c 44+++ b/gcc/config/i386/i386-expand.c
45@@ -10941,10 +10941,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, 45@@ -10976,10 +10976,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
46 { 46 {
47 case IX86_BUILTIN_CPU_INIT: 47 case IX86_BUILTIN_CPU_INIT:
48 { 48 {
@@ -56,10 +56,10 @@ index 48f00c5fcfc..468f5f71fac 100644
56 return expand_expr (call_expr, target, mode, EXPAND_NORMAL); 56 return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
57 } 57 }
58diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c 58diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
59index 00322c58622..f42bbb8af98 100644 59index 83301a1445f..89fdc7eb587 100644
60--- a/libgcc/config/i386/cpuinfo.c 60--- a/libgcc/config/i386/cpuinfo.c
61+++ b/libgcc/config/i386/cpuinfo.c 61+++ b/libgcc/config/i386/cpuinfo.c
62@@ -508,7 +508,7 @@ __cpu_indicator_init (void) 62@@ -516,7 +516,7 @@ __cpu_indicator_init (void)
63 return 0; 63 return 0;
64 } 64 }
65 65
diff --git a/meta/recipes-devtools/gcc/gcc/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch b/meta/recipes-devtools/gcc/gcc/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
index dd1bf6dedc..b746f17e4e 100644
--- a/meta/recipes-devtools/gcc/gcc/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
+++ b/meta/recipes-devtools/gcc/gcc/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
@@ -1,4 +1,4 @@
1From 0395060a7dcf98c5f5a65103f6aaa71d6b862259 Mon Sep 17 00:00:00 2001 1From febc910933faf6868805546e0df4a8452a82c225 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org> 2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Tue, 10 Mar 2020 08:26:53 -0700 3Date: Tue, 10 Mar 2020 08:26:53 -0700
4Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining 4Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining
@@ -48,7 +48,7 @@ index 981577481af..d5700fff401 100644
48 POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos)); 48 POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
49 POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos)); 49 POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
50diff --git a/gcc/genmodes.c b/gcc/genmodes.c 50diff --git a/gcc/genmodes.c b/gcc/genmodes.c
51index bd78310ea24..dbd02c51a4c 100644 51index 21e5f536976..a22f65a232f 100644
52--- a/gcc/genmodes.c 52--- a/gcc/genmodes.c
53+++ b/gcc/genmodes.c 53+++ b/gcc/genmodes.c
54@@ -430,7 +430,7 @@ complete_all_modes (void) 54@@ -430,7 +430,7 @@ complete_all_modes (void)
diff --git a/meta/recipes-devtools/gcc/gcc/0036-mingw32-Enable-operation_not_supported.patch b/meta/recipes-devtools/gcc/gcc/0036-mingw32-Enable-operation_not_supported.patch
index de82a3a539..f2d6e30a07 100644
--- a/meta/recipes-devtools/gcc/gcc/0036-mingw32-Enable-operation_not_supported.patch
+++ b/meta/recipes-devtools/gcc/gcc/0036-mingw32-Enable-operation_not_supported.patch
@@ -1,4 +1,4 @@
1From 6f87a095f0e696bec07a50df789c9db8bdbca43d Mon Sep 17 00:00:00 2001 1From 6d9d080ce16de2fda138a8aac579e531bd64221d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 12 May 2020 10:39:09 -0700 3Date: Tue, 12 May 2020 10:39:09 -0700
4Subject: [PATCH] mingw32: Enable operation_not_supported 4Subject: [PATCH] mingw32: Enable operation_not_supported
@@ -12,15 +12,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
12 1 file changed, 1 insertion(+), 1 deletion(-) 12 1 file changed, 1 insertion(+), 1 deletion(-)
13 13
14diff --git a/libstdc++-v3/config/os/mingw32/error_constants.h b/libstdc++-v3/config/os/mingw32/error_constants.h 14diff --git a/libstdc++-v3/config/os/mingw32/error_constants.h b/libstdc++-v3/config/os/mingw32/error_constants.h
15index 68ac72a78fb..71cd5815b81 100644 15index 2222c5227c4..35290eabfa7 100644
16--- a/libstdc++-v3/config/os/mingw32/error_constants.h 16--- a/libstdc++-v3/config/os/mingw32/error_constants.h
17+++ b/libstdc++-v3/config/os/mingw32/error_constants.h 17+++ b/libstdc++-v3/config/os/mingw32/error_constants.h
18@@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 18@@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
19 #ifdef _GLIBCXX_HAVE_EPERM 19 #ifdef EPERM
20 operation_not_permitted = EPERM, 20 operation_not_permitted = EPERM,
21 #endif 21 #endif
22-// operation_not_supported = EOPNOTSUPP, 22-// operation_not_supported = EOPNOTSUPP,
23+ operation_not_supported = EOPNOTSUPP, 23+ operation_not_supported = EOPNOTSUPP,
24 #ifdef _GLIBCXX_HAVE_EWOULDBLOCK 24 #ifdef EWOULDBLOCK
25 operation_would_block = EWOULDBLOCK, 25 operation_would_block = EWOULDBLOCK,
26 #endif 26 #endif
diff --git a/meta/recipes-devtools/gcc/gcc/0037-libatomic-Do-not-enforce-march-on-aarch64.patch b/meta/recipes-devtools/gcc/gcc/0037-libatomic-Do-not-enforce-march-on-aarch64.patch
index 3946acea11..a55fbffb2c 100644
--- a/meta/recipes-devtools/gcc/gcc/0037-libatomic-Do-not-enforce-march-on-aarch64.patch
+++ b/meta/recipes-devtools/gcc/gcc/0037-libatomic-Do-not-enforce-march-on-aarch64.patch
@@ -1,4 +1,4 @@
1From 38d262bfe7c0c894c364dc6e4dc7971e78a73974 Mon Sep 17 00:00:00 2001 1From f572efe2cee2d580007beb4540925965365ceeb9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 13 May 2020 15:10:38 -0700 3Date: Wed, 13 May 2020 15:10:38 -0700
4Subject: [PATCH] libatomic: Do not enforce march on aarch64 4Subject: [PATCH] libatomic: Do not enforce march on aarch64
diff --git a/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch b/meta/recipes-devtools/gcc/gcc/0038-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch
index addecb4bd8..65c3e398fe 100644
--- a/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch
+++ b/meta/recipes-devtools/gcc/gcc/0038-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch
@@ -1,4 +1,4 @@
1From 2824d2418605e092899117e77bc8ebf332321807 Mon Sep 17 00:00:00 2001 1From eb5a17c7b8ed676d83ce4dd0e9623e2ee0191f91 Mon Sep 17 00:00:00 2001
2From: Jakub Jelinek <jakub@redhat.com> 2From: Jakub Jelinek <jakub@redhat.com>
3Date: Fri, 15 Jan 2021 13:12:59 +0100 3Date: Fri, 15 Jan 2021 13:12:59 +0100
4Subject: [PATCH] libatomic, libgomp, libitc: Fix bootstrap [PR70454] 4Subject: [PATCH] libatomic, libgomp, libitc: Fix bootstrap [PR70454]
@@ -28,6 +28,7 @@ libitm/
28 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. 28 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
29 29
30Upstream-Status: Backport [master post 10.x release] 30Upstream-Status: Backport [master post 10.x release]
31Signed-off-by: Khem Raj <raj.khem@gmail.com>
31--- 32---
32 libatomic/configure.tgt | 56 +++++++++++++++++++++++------------------ 33 libatomic/configure.tgt | 56 +++++++++++++++++++++++------------------
33 libgomp/configure.tgt | 35 +++++++++++--------------- 34 libgomp/configure.tgt | 35 +++++++++++---------------
@@ -35,7 +36,7 @@ Upstream-Status: Backport [master post 10.x release]
35 3 files changed, 64 insertions(+), 64 deletions(-) 36 3 files changed, 64 insertions(+), 64 deletions(-)
36 37
37diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt 38diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
38index 5dd0926d20..6ea082a29b 100644 39index 5dd0926d207..6ea082a29bc 100644
39--- a/libatomic/configure.tgt 40--- a/libatomic/configure.tgt
40+++ b/libatomic/configure.tgt 41+++ b/libatomic/configure.tgt
41@@ -81,32 +81,40 @@ case "${target_cpu}" in 42@@ -81,32 +81,40 @@ case "${target_cpu}" in
@@ -104,7 +105,7 @@ index 5dd0926d20..6ea082a29b 100644
104 105
105 *) ARCH="${target_cpu}" ;; 106 *) ARCH="${target_cpu}" ;;
106diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt 107diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
107index 4790a31e39..761ef2a7db 100644 108index 4790a31e394..761ef2a7db2 100644
108--- a/libgomp/configure.tgt 109--- a/libgomp/configure.tgt
109+++ b/libgomp/configure.tgt 110+++ b/libgomp/configure.tgt
110@@ -70,28 +70,23 @@ if test x$enable_linux_futex = xyes; then 111@@ -70,28 +70,23 @@ if test x$enable_linux_futex = xyes; then
@@ -152,10 +153,10 @@ index 4790a31e39..761ef2a7db 100644
152 153
153 # Note that sparcv7 and sparcv8 is not included here. We need cas. 154 # Note that sparcv7 and sparcv8 is not included here. We need cas.
154diff --git a/libitm/configure.tgt b/libitm/configure.tgt 155diff --git a/libitm/configure.tgt b/libitm/configure.tgt
155index 04109160e9..ca62bac627 100644 156index d1beb5c9ec8..608462e184e 100644
156--- a/libitm/configure.tgt 157--- a/libitm/configure.tgt
157+++ b/libitm/configure.tgt 158+++ b/libitm/configure.tgt
158@@ -58,16 +58,23 @@ case "${target_cpu}" in 159@@ -59,16 +59,23 @@ case "${target_cpu}" in
159 160
160 arm*) ARCH=arm ;; 161 arm*) ARCH=arm ;;
161 162
@@ -189,7 +190,7 @@ index 04109160e9..ca62bac627 100644
189 XCFLAGS="${XCFLAGS} -mrtm" 190 XCFLAGS="${XCFLAGS} -mrtm"
190 ARCH=x86 191 ARCH=x86
191 ;; 192 ;;
192@@ -102,16 +109,6 @@ case "${target_cpu}" in 193@@ -103,16 +110,6 @@ case "${target_cpu}" in
193 ARCH=sparc 194 ARCH=sparc
194 ;; 195 ;;
195 196
diff --git a/meta/recipes-devtools/gcc/gcc_10.2.bb b/meta/recipes-devtools/gcc/gcc_10.3.bb
index 7d93590588..7d93590588 100644
--- a/meta/recipes-devtools/gcc/gcc_10.2.bb
+++ b/meta/recipes-devtools/gcc/gcc_10.3.bb
diff --git a/meta/recipes-devtools/gcc/libgcc-initial_10.2.bb b/meta/recipes-devtools/gcc/libgcc-initial_10.3.bb
index 0c698c26ec..0c698c26ec 100644
--- a/meta/recipes-devtools/gcc/libgcc-initial_10.2.bb
+++ b/meta/recipes-devtools/gcc/libgcc-initial_10.3.bb
diff --git a/meta/recipes-devtools/gcc/libgcc_10.2.bb b/meta/recipes-devtools/gcc/libgcc_10.3.bb
index ea210a1130..ea210a1130 100644
--- a/meta/recipes-devtools/gcc/libgcc_10.2.bb
+++ b/meta/recipes-devtools/gcc/libgcc_10.3.bb
diff --git a/meta/recipes-devtools/gcc/libgfortran_10.2.bb b/meta/recipes-devtools/gcc/libgfortran_10.3.bb
index 71dd8b4bdc..71dd8b4bdc 100644
--- a/meta/recipes-devtools/gcc/libgfortran_10.2.bb
+++ b/meta/recipes-devtools/gcc/libgfortran_10.3.bb