summaryrefslogtreecommitdiff
path: root/system/gcc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-07-10 09:38:30 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-08-07 10:08:23 -0500
commit5e13df2e1a8362058709100923f21bcf48cdaa75 (patch)
treeb0759a532781dbd11f3f36902846613ca8d994db /system/gcc
parent2105a97d4afa5022375c9b366138049da5b0a6a2 (diff)
downloadpackages-5e13df2e1a8362058709100923f21bcf48cdaa75.tar.gz
packages-5e13df2e1a8362058709100923f21bcf48cdaa75.tar.bz2
packages-5e13df2e1a8362058709100923f21bcf48cdaa75.tar.xz
packages-5e13df2e1a8362058709100923f21bcf48cdaa75.zip
system/gcc: Fix libsan on ppc64 and i586 bug
Closes: #1217, #1218
Diffstat (limited to 'system/gcc')
-rw-r--r--system/gcc/101-pr115836.patch50
-rw-r--r--system/gcc/APKBUILD5
-rw-r--r--system/gcc/sanitation.patch14
3 files changed, 64 insertions, 5 deletions
diff --git a/system/gcc/101-pr115836.patch b/system/gcc/101-pr115836.patch
new file mode 100644
index 000000000..72c78f925
--- /dev/null
+++ b/system/gcc/101-pr115836.patch
@@ -0,0 +1,50 @@
+From: Uros Bizjak <ubizjak@gmail.com>
+Date: Wed, 10 Jul 2024 07:27:27 +0000 (+0200)
+Subject: middle-end: Fix stalled swapped condition code value [PR115836]
+X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=47a8b464d2dd9a586a9e15242c9825e39e1ecd4c;hp=efa30f619361b043616e624e57366a50982e11df
+
+middle-end: Fix stalled swapped condition code value [PR115836]
+
+emit_store_flag_1 calculates scode (swapped condition code) at the
+beginning of the function from the value of code variable. However,
+code variable may change before scode usage site, resulting in
+invalid stalled scode value.
+
+Move calculation of scode value just before its only usage site to
+avoid stalled scode value.
+
+ PR middle-end/115836
+
+gcc/ChangeLog:
+
+ * expmed.cc (emit_store_flag_1): Move calculation of
+ scode just before its only usage site.
+
+(cherry picked from commit 44933fdeb338e00c972e42224b9a83d3f8f6a757)
+---
+
+diff --git a/gcc/expmed.cc b/gcc/expmed.cc
+index 4ec035e4843b..19765311b954 100644
+--- a/gcc/expmed.cc
++++ b/gcc/expmed.cc
+@@ -5607,11 +5607,9 @@ emit_store_flag_1 (rtx target, enum rtx_code code, rtx op0, rtx op1,
+ enum insn_code icode;
+ machine_mode compare_mode;
+ enum mode_class mclass;
+- enum rtx_code scode;
+
+ if (unsignedp)
+ code = unsigned_condition (code);
+- scode = swap_condition (code);
+
+ /* If one operand is constant, make it the second one. Only do this
+ if the other operand is not constant as well. */
+@@ -5726,6 +5724,8 @@ emit_store_flag_1 (rtx target, enum rtx_code code, rtx op0, rtx op1,
+
+ if (GET_MODE_CLASS (mode) == MODE_FLOAT)
+ {
++ enum rtx_code scode = swap_condition (code);
++
+ tem = emit_cstore (target, icode, scode, mode, compare_mode,
+ unsignedp, op1, op0, normalizep, target_mode);
+ if (tem)
diff --git a/system/gcc/APKBUILD b/system/gcc/APKBUILD
index b349cf43d..4164de239 100644
--- a/system/gcc/APKBUILD
+++ b/system/gcc/APKBUILD
@@ -158,6 +158,8 @@ source="https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz
078_all_match.pd-CSE-the-dump-output-check.patch
092_all_riscv_PR109760-gstreamer.patch
+ 101-pr115836.patch
+
201-ada.patch
202-ibm-ldbl.patch
205-nopie.patch
@@ -585,6 +587,7 @@ ec0a6613a21bd8352b73f693ee6055e81e4ef056b8b2b9916aa075649477b0c3f855fcfb37aa5330
0d505f08842bd75c686b18f50bc988078dce07b69ef8b6caa53e5e3a93e39527ab16f1d32a7f1f132279c3ac430a10b4e1aad7fc0bc2b6560fc33a1b65f6c109 076_all_match.pd-don-t-emit-label-if-not-needed.patch
b3cb3cad951c518b399f4fd0d4be07089ca1abf7a3271aaac4c25d8cd34a9b6d2bd6fa68164cf7f3967813f019db8dcf0ae8746f94ac6a4b85209c4012a8936f 078_all_match.pd-CSE-the-dump-output-check.patch
ce44d0bfa646394114c6e77f70da26ac4879cb2198a3bc4108ce080b7a247d6c0b0213c02b9bacbcd0b477a8e22a831a7dae3691f4f0462eaddecb457cd9eee6 092_all_riscv_PR109760-gstreamer.patch
+eade22edbb70b57b06349bbf2f39def90bbe4e3eeb0d121dd2e07e1deaf73407e5247698d05660de67072672534461442b45e314d53daf691a10275f60fdc51c 101-pr115836.patch
ad971ebaa77907a26e4c268feb052d06b2df1530ed39b9c684a49bdf1024ad6b439bb8b28a957327635c83a97dcca3cee0875cfe9836f8fc3e06cdb137281e42 201-ada.patch
80748e1f6a287a0f645eecac54c5181156a20ab0facc826e5b1768fec87df9d4e9fd44362370dbbe5f78b25c3bba3a20a6acfbe6ce25ddd99bd6d085bfc6c112 202-ibm-ldbl.patch
ae30090390e3604e1e508edb36bc3a01283fe28657d63ae6d6238dd9f55cce587552c5a482425673aff0d0ccc9d99a649e24b552573e7b2ea29063fc5c0aa497 205-nopie.patch
@@ -606,6 +609,6 @@ dc03c7b660f0142aa16e78e4e50581c883f6632f4794131f1131e0dc8fd500ba5d6a0046a36dc621
fa59b0fb081d97f8f63506b8793699588a95c602b5d468140eb1e80456597e52e1cc45dc0b234ac8e60e2b0cd606d94d111c8b0ae64c0a2be1bc1b8a184ceb93 libgo-musl-1.2.3.patch
1860593584f629d24d5b6db14b0a3412e9f93449b663aaa4981301a0923db0159314905e694f27366fbfef72dce06636ab6df86862b7e9e9564847e03bee82c1 add-classic_table-support.patch
a09b3181002798d1b17b8374eba6bec18e67d4d4f30677311c330b599e231e97cf02c1b9b79c0829952f5027016e01146743b665b19558ed2693c60a567823fb gcc-5.4.0-locale.patch
-dba5fdaf253a44f4239151cff8bcfc676264f2fac535d05f82ac7d7e965e272b724067a364521da1eeca3cff1d499f6e1eafa483ff3b3c2ede9fcd90be368e36 sanitation.patch
+5b830a37130808ea7a27b030445362c3a9963e29166228fcc94ca6e92b6446a995c633f8062a4c3f8749b41e6562bdd3d14ef096d86049c68c037d083d59b5c2 sanitation.patch
ff6159633f04d26eadc79895dc24ccb46671a04fdc728cbbac86964a14ce17e2e51cd7668947dfe06b9168bb9b8575a80955012e5f51295ea02f4f3169e07541 match-split.patch
ee626cbe4bdda5b868980c86ca066d33167d06517db676e43d0719c4ad7d11e99b3a0151927f15c93ab89f6c76dd12bd48d402d25771fa3fd175273248824eda insn-split.patch"
diff --git a/system/gcc/sanitation.patch b/system/gcc/sanitation.patch
index 7dcdb0b65..861f5d08e 100644
--- a/system/gcc/sanitation.patch
+++ b/system/gcc/sanitation.patch
@@ -71,18 +71,24 @@
// Doesn't set sa_restorer if the caller did not set it, so use with caution
//(see below).
int internal_sigaction_norestorer(int signum, const void *act, void *oldact) {
-@@ -2173,11 +2170,11 @@
+@@ -2173,11 +2170,20 @@
*bp = ucontext->uc_mcontext.mc_frame[31];
# else
ucontext_t *ucontext = (ucontext_t*)context;
-- *pc = ucontext->uc_mcontext.regs->nip;
-- *sp = ucontext->uc_mcontext.regs->gpr[PT_R1];
++#ifdef __powerpc64__
+ *pc = ucontext->uc_mcontext.regs->nip;
+ *sp = ucontext->uc_mcontext.regs->gpr[PT_R1];
++#else
+ *pc = ucontext->uc_mcontext.gregs[PT_NIP];
+ *sp = ucontext->uc_mcontext.gregs[PT_R1];
++#endif
// The powerpc{,64}-linux ABIs do not specify r31 as the frame
// pointer, but GCC always uses r31 when we need a frame pointer.
-- *bp = ucontext->uc_mcontext.regs->gpr[PT_R31];
++#ifdef __powerpc64__
+ *bp = ucontext->uc_mcontext.regs->gpr[PT_R31];
++#else
+ *bp = ucontext->uc_mcontext.gregs[PT_R31];
++#endif
# endif
#elif defined(__sparc__)
#if defined(__arch64__) || defined(__sparcv9)