[07/12] provide default for MASK_RETURN_ADDR
diff mbox

Message ID 1429622658-9034-8-git-send-email-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org April 21, 2015, 1:24 p.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* defaults.h (MASK_RETURN_ADDR): New definition.
	* except.c (expand_builtin_extract_return_addr): Remove ifdef
	MASK_RETURN_ADDR.
---
 gcc/defaults.h | 4 ++++
 gcc/except.c   | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

Jeff Law April 21, 2015, 1:31 p.m. UTC | #1
On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* defaults.h (MASK_RETURN_ADDR): New definition.
> 	* except.c (expand_builtin_extract_return_addr): Remove ifdef
> 	MASK_RETURN_ADDR.
OK.
jeff

Patch
diff mbox

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 767901a..843d7e2 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -388,6 +388,10 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define RETURN_ADDR_OFFSET 0
 #endif
 
+#ifndef MASK_RETURN_ADDR
+#define MASK_RETURN_ADDR NULL_RTX
+#endif
+
 /* If we have named section and we support weak symbols, then use the
    .jcr section for recording java classes which need to be registered
    at program start-up time.  */
diff --git a/gcc/except.c b/gcc/except.c
index c98163d..5b24006 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2184,9 +2184,9 @@  expand_builtin_extract_return_addr (tree addr_tree)
     }
 
   /* First mask out any unwanted bits.  */
-#ifdef MASK_RETURN_ADDR
-  expand_and (Pmode, addr, MASK_RETURN_ADDR, addr);
-#endif
+  rtx mask = MASK_RETURN_ADDR;
+  if (mask)
+    expand_and (Pmode, addr, mask, addr);
 
   /* Then adjust to find the real return address.  */
   if (RETURN_ADDR_OFFSET)