config/ChangeLog:

        * picflag.m4: Add rx fdpic option.

libgcc/ChangeLog:
        * config.host (rx-*-linux*): Fix overwrite in tmake_file.
        (rx-*-linux*): Add unwind_header.
        * config/rx/rx-abi,h: Remove prefix '_' in standard ELF ABI.
        * config/rx/unwind-linux.h: New.
        * configure: Regenerate.

Signed-off-by: Yoshinori Sato <[email protected]>
---
 config/picflag.m4               |  4 ++++
 libgcc/config.host              |  3 ++-
 libgcc/config/rx/rx-abi.h       |  7 ++++++-
 libgcc/config/rx/unwind-linux.h | 24 ++++++++++++++++++++++++
 libgcc/configure                | 14 +++++++++-----
 5 files changed, 45 insertions(+), 7 deletions(-)
 create mode 100644 libgcc/config/rx/unwind-linux.h

diff --git a/config/picflag.m4 b/config/picflag.m4
index 3f3ac744c96..96d2ad9dc33 100644
--- a/config/picflag.m4
+++ b/config/picflag.m4
@@ -66,6 +66,10 @@ case "${$2}" in
     sh*-*-netbsd*)
        $1=-fpic
        ;;
+    rx-*-linux*)
+        $1=-mfdpic
+       ;;
+
     # Default to -fPIC unless specified otherwise.
     *)
        $1=-fPIC
diff --git a/libgcc/config.host b/libgcc/config.host
index 82ea1772f51..d90de34d0a7 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1379,8 +1379,9 @@ rx-*-elf)
        tm_file="$tm_file rx/rx-abi.h rx/rx-lib.h"
        ;;
 rx-*-linux*)
-       tmake_file="rx/t-rx t-fdpbit"
+       tmake_file="${tmake_file} rx/t-rx t-fdpbit"
        tm_file="$tm_file rx/rx-lib.h"
+       unwind_header=config/rx/unwind-linux.h
        ;;
 s390-*-linux*)
        tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux 
s390/32/t-floattodi t-stack s390/t-stack-s390"
diff --git a/libgcc/config/rx/rx-abi.h b/libgcc/config/rx/rx-abi.h
index ca14503d1c8..7d3c991f60e 100644
--- a/libgcc/config/rx/rx-abi.h
+++ b/libgcc/config/rx/rx-abi.h
@@ -22,11 +22,16 @@
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#if defined(__RX_GCC_ABI__) || defined(__RX_ABI__)
 /* Make __COM_<RX_NAME> an alias for __<GCC_NAME>.  */
 #define RENAME_LIBRARY(GCC_NAME, RX_NAME)              \
   __asm__ (".globl\t__COM_" #RX_NAME "\n"              \
           ".set\t__COM_" #RX_NAME ", ___" #GCC_NAME "\n");
-
+#else
+#define RENAME_LIBRARY(GCC_NAME, RX_NAME)              \
+  __asm__ (".globl\t__COM_" #RX_NAME "\n"              \
+          ".set\t__COM_" #RX_NAME ", __" #GCC_NAME "\n");
+#endif
 
 /* The long-long aliases...  */
 
diff --git a/libgcc/config/rx/unwind-linux.h b/libgcc/config/rx/unwind-linux.h
new file mode 100644
index 00000000000..7128d0eeee0
--- /dev/null
+++ b/libgcc/config/rx/unwind-linux.h
@@ -0,0 +1,24 @@
+/* Header file for the Renesas RX unwinder */
+
+#ifndef UNWIND_RX_H
+#define UNWIND_RX_H
+
+#include "unwind-generic.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+  static inline _Unwind_Ptr _Unwind_gnu_Find_got (_Unwind_Ptr ptr)
+{
+    _Unwind_Ptr res;
+
+    __asm volatile ("mov r13, %0":"=r" (res));
+    return res;
+}
+
+#ifdef __cplusplus
+}   /* extern "C" */
+#endif
+
+#endif
diff --git a/libgcc/configure b/libgcc/configure
index d5e80d227ff..74675448bfd 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -2430,6 +2430,10 @@ case "${host}" in
     sh*-*-netbsd*)
        PICFLAG=-fpic
        ;;
+    rx-*-linux*)
+        PICFLAG=-mfdpic
+       ;;
+
     # Default to -fPIC unless specified otherwise.
     *)
        PICFLAG=-fPIC
@@ -4220,7 +4224,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4266,7 +4270,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4290,7 +4294,7 @@ rm -f core conftest.err conftest.$ac_objext 
conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4335,7 +4339,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4359,7 +4363,7 @@ rm -f core conftest.err conftest.$ac_objext 
conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
-- 
2.47.3

Reply via email to