commit:     7bd9679989239cba83bb0c632bd2f0909b03d1b8
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 12 23:20:12 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Sep 12 23:20:12 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7bd96799

6/7/8 branches: add 101_all_x32-fix-eh-return-address.patch

Pick upstream fix for x32 exception handler: """
x86: Always update EH return address in word_mode

On x86, return address is always popped in word_mode.  eh_return needs
to put EH return address in word_mode on stack.
"""

Reported-by: camper
Bug: https://bugs.gentoo.org/664016
Bug: https://gcc.gnu.org/PR87014
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 .../gentoo/101_all_x32-fix-eh-return-address.patch | 37 ++++++++++++++++++++++
 6.4.0/gentoo/README.history                        |  2 ++
 .../gentoo/99_all_x32-fix-eh-return-address.patch  | 37 ++++++++++++++++++++++
 7.3.0/gentoo/README.history                        |  1 +
 .../gentoo/101_all_x32-fix-eh-return-address.patch | 37 ++++++++++++++++++++++
 8.2.0/gentoo/README.history                        |  2 ++
 6 files changed, 116 insertions(+)

diff --git a/6.4.0/gentoo/101_all_x32-fix-eh-return-address.patch 
b/6.4.0/gentoo/101_all_x32-fix-eh-return-address.patch
new file mode 100644
index 0000000..c74a087
--- /dev/null
+++ b/6.4.0/gentoo/101_all_x32-fix-eh-return-address.patch
@@ -0,0 +1,37 @@
+Bug: https://bugs.gentoo.org/664016
+
+From 2a8e2ab2e9e11b679616d80285296ac77ad0920f Mon Sep 17 00:00:00 2001
+From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Mon, 20 Aug 2018 19:14:04 +0000
+Subject: [PATCH] x86: Always update EH return address in word_mode
+
+On x86, return address is always popped in word_mode.  eh_return needs
+to put EH return address in word_mode on stack.
+
+gcc/
+
+       PR target/87014
+       * config/i386/i386.md (eh_return): Always update EH return
+       address in word_mode.
+
+gcc/testsuite/
+
+       PR target/87014
+       * g++.dg/torture/pr87014.C: New file.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263672 
138bc75d-0d04-0410-961f-82ee72b054a4
+--- a/gcc/config/i386/i386.md
++++ b/gcc/config/i386/i386.md
+@@ -13612,7 +13612,10 @@
+      stack address we wish to restore.  */
+   tmp = gen_rtx_PLUS (Pmode, arg_pointer_rtx, sa);
+   tmp = plus_constant (Pmode, tmp, -UNITS_PER_WORD);
+-  tmp = gen_rtx_MEM (Pmode, tmp);
++  /* Return address is always in word_mode.  */
++  tmp = gen_rtx_MEM (word_mode, tmp);
++  if (GET_MODE (ra) != word_mode)
++    ra = convert_to_mode (word_mode, ra, 1);
+   emit_move_insn (tmp, ra);
+ 
+   emit_jump_insn (gen_eh_return_internal ());

diff --git a/6.4.0/gentoo/README.history b/6.4.0/gentoo/README.history
index 2c676a4..2294b26 100644
--- a/6.4.0/gentoo/README.history
+++ b/6.4.0/gentoo/README.history
@@ -1,3 +1,5 @@
+1.7            TODO
+       + 101_all_x32-fix-eh-return-address.patch
 1.6            18 Aug 2018
        + 100_all_isl-include.patch
 1.5            17 Aug 2018

diff --git a/7.3.0/gentoo/99_all_x32-fix-eh-return-address.patch 
b/7.3.0/gentoo/99_all_x32-fix-eh-return-address.patch
new file mode 100644
index 0000000..c74a087
--- /dev/null
+++ b/7.3.0/gentoo/99_all_x32-fix-eh-return-address.patch
@@ -0,0 +1,37 @@
+Bug: https://bugs.gentoo.org/664016
+
+From 2a8e2ab2e9e11b679616d80285296ac77ad0920f Mon Sep 17 00:00:00 2001
+From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Mon, 20 Aug 2018 19:14:04 +0000
+Subject: [PATCH] x86: Always update EH return address in word_mode
+
+On x86, return address is always popped in word_mode.  eh_return needs
+to put EH return address in word_mode on stack.
+
+gcc/
+
+       PR target/87014
+       * config/i386/i386.md (eh_return): Always update EH return
+       address in word_mode.
+
+gcc/testsuite/
+
+       PR target/87014
+       * g++.dg/torture/pr87014.C: New file.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263672 
138bc75d-0d04-0410-961f-82ee72b054a4
+--- a/gcc/config/i386/i386.md
++++ b/gcc/config/i386/i386.md
+@@ -13612,7 +13612,10 @@
+      stack address we wish to restore.  */
+   tmp = gen_rtx_PLUS (Pmode, arg_pointer_rtx, sa);
+   tmp = plus_constant (Pmode, tmp, -UNITS_PER_WORD);
+-  tmp = gen_rtx_MEM (Pmode, tmp);
++  /* Return address is always in word_mode.  */
++  tmp = gen_rtx_MEM (word_mode, tmp);
++  if (GET_MODE (ra) != word_mode)
++    ra = convert_to_mode (word_mode, ra, 1);
+   emit_move_insn (tmp, ra);
+ 
+   emit_jump_insn (gen_eh_return_internal ());

diff --git a/7.3.0/gentoo/README.history b/7.3.0/gentoo/README.history
index 9eb4c76..7070e8f 100644
--- a/7.3.0/gentoo/README.history
+++ b/7.3.0/gentoo/README.history
@@ -1,5 +1,6 @@
 1.6            TODO
        + 98_all_msp430-partial-int.patch
+       + 99_all_x32-fix-eh-return-address.patch
 1.6            18 Aug 2018
        + 97_all_isl-include.patch
 1.5            17 Aug 2018

diff --git a/8.2.0/gentoo/101_all_x32-fix-eh-return-address.patch 
b/8.2.0/gentoo/101_all_x32-fix-eh-return-address.patch
new file mode 100644
index 0000000..c74a087
--- /dev/null
+++ b/8.2.0/gentoo/101_all_x32-fix-eh-return-address.patch
@@ -0,0 +1,37 @@
+Bug: https://bugs.gentoo.org/664016
+
+From 2a8e2ab2e9e11b679616d80285296ac77ad0920f Mon Sep 17 00:00:00 2001
+From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Mon, 20 Aug 2018 19:14:04 +0000
+Subject: [PATCH] x86: Always update EH return address in word_mode
+
+On x86, return address is always popped in word_mode.  eh_return needs
+to put EH return address in word_mode on stack.
+
+gcc/
+
+       PR target/87014
+       * config/i386/i386.md (eh_return): Always update EH return
+       address in word_mode.
+
+gcc/testsuite/
+
+       PR target/87014
+       * g++.dg/torture/pr87014.C: New file.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263672 
138bc75d-0d04-0410-961f-82ee72b054a4
+--- a/gcc/config/i386/i386.md
++++ b/gcc/config/i386/i386.md
+@@ -13612,7 +13612,10 @@
+      stack address we wish to restore.  */
+   tmp = gen_rtx_PLUS (Pmode, arg_pointer_rtx, sa);
+   tmp = plus_constant (Pmode, tmp, -UNITS_PER_WORD);
+-  tmp = gen_rtx_MEM (Pmode, tmp);
++  /* Return address is always in word_mode.  */
++  tmp = gen_rtx_MEM (word_mode, tmp);
++  if (GET_MODE (ra) != word_mode)
++    ra = convert_to_mode (word_mode, ra, 1);
+   emit_move_insn (tmp, ra);
+ 
+   emit_jump_insn (gen_eh_return_internal ());

diff --git a/8.2.0/gentoo/README.history b/8.2.0/gentoo/README.history
index 04f21ae..8daa563 100644
--- a/8.2.0/gentoo/README.history
+++ b/8.2.0/gentoo/README.history
@@ -1,3 +1,5 @@
+1.3            TODO
+       + 101_all_x32-fix-eh-return-address.patch
 1.2            12 Aug 2018
        - 100_all-isl-include.patch
        + 100_all_isl-include.patch

Reply via email to