[06/12] provide default for RETURN_ADDR_OFFSET
diff mbox

Message ID 1429622658-9034-7-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 (RETURN_ADDR_OFFSET): New definition.
	* except.c (expand_builtin_extract_return_addr): Remove ifdef
	RETURN_ADDR_OFFSET.
	(expand_builtin_frob_return_addr): Likewise.
---
 gcc/defaults.h |  5 +++++
 gcc/except.c   | 14 +++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

Comments

Jeff Law April 21, 2015, 1:32 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 (RETURN_ADDR_OFFSET): New definition.
> 	* except.c (expand_builtin_extract_return_addr): Remove ifdef
> 	RETURN_ADDR_OFFSET.
> 	(expand_builtin_frob_return_addr): Likewise.
OK.
jeff

Patch
diff mbox

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 911c2f8..767901a 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -383,6 +383,11 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM
 #endif
 
+/* Offset between the eh handler address and entry in eh tables.  */
+#ifndef RETURN_ADDR_OFFSET
+#define RETURN_ADDR_OFFSET 0
+#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 7573c88..c98163d 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2189,9 +2189,8 @@  expand_builtin_extract_return_addr (tree addr_tree)
 #endif
 
   /* Then adjust to find the real return address.  */
-#if defined (RETURN_ADDR_OFFSET)
-  addr = plus_constant (Pmode, addr, RETURN_ADDR_OFFSET);
-#endif
+  if (RETURN_ADDR_OFFSET)
+    addr = plus_constant (Pmode, addr, RETURN_ADDR_OFFSET);
 
   return addr;
 }
@@ -2207,10 +2206,11 @@  expand_builtin_frob_return_addr (tree addr_tree)
 
   addr = convert_memory_address (Pmode, addr);
 
-#ifdef RETURN_ADDR_OFFSET
-  addr = force_reg (Pmode, addr);
-  addr = plus_constant (Pmode, addr, -RETURN_ADDR_OFFSET);
-#endif
+  if (RETURN_ADDR_OFFSET)
+    {
+      addr = force_reg (Pmode, addr);
+      addr = plus_constant (Pmode, addr, -RETURN_ADDR_OFFSET);
+    }
 
   return addr;
 }