diff mbox series

RX: Add rx-*-linux target

Message ID 87v9y1e5pk.wl-ysato@users.sourceforge.jp
State New
Headers show
Series RX: Add rx-*-linux target | expand

Commit Message

Yoshinori Sato May 23, 2019, 12:05 p.m. UTC
I ported linux kernel to Renesas RX.

rx-*-elf target output a binary different from the standard ELF.
It has the same format as the Renesas compiler.

But the linux kernel requires the standard ELF format.
I want to define a rx-*-linux target so that I can generate
a standard ELF binary.

Comments

Jeff Law May 29, 2019, 6:27 p.m. UTC | #1
On 5/23/19 6:05 AM, Yoshinori Sato wrote:
> I ported linux kernel to Renesas RX.
> 
> rx-*-elf target output a binary different from the standard ELF.
> It has the same format as the Renesas compiler.
> 
> But the linux kernel requires the standard ELF format.
> I want to define a rx-*-linux target so that I can generate
> a standard ELF binary.
Presumably you're resubmitting after your assignment got recorded (I
think I saw that fly by recently).

I'll construct a ChangeLog and install this on the trunk.

Thanks,
Jeff
Jeff Law May 31, 2019, 12:16 a.m. UTC | #2
On 5/29/19 12:27 PM, Jeff Law wrote:
> On 5/23/19 6:05 AM, Yoshinori Sato wrote:
>> I ported linux kernel to Renesas RX.
>>
>> rx-*-elf target output a binary different from the standard ELF.
>> It has the same format as the Renesas compiler.
>>
>> But the linux kernel requires the standard ELF format.
>> I want to define a rx-*-linux target so that I can generate
>> a standard ELF binary.
> Presumably you're resubmitting after your assignment got recorded (I
> think I saw that fly by recently).
> 
> I'll construct a ChangeLog and install this on the trunk.
So this is causing libgcc to fail to build for rx-elf.  The problem is
the DF=SF #define.  I think you need so split that out so that it's only
used for rx-linux.

Jeff
Yoshinori Sato June 2, 2019, 11:26 a.m. UTC | #3
On Fri, 31 May 2019 09:16:18 +0900,
Jeff Law wrote:
> 
> On 5/29/19 12:27 PM, Jeff Law wrote:
> > On 5/23/19 6:05 AM, Yoshinori Sato wrote:
> >> I ported linux kernel to Renesas RX.
> >>
> >> rx-*-elf target output a binary different from the standard ELF.
> >> It has the same format as the Renesas compiler.
> >>
> >> But the linux kernel requires the standard ELF format.
> >> I want to define a rx-*-linux target so that I can generate
> >> a standard ELF binary.
> > Presumably you're resubmitting after your assignment got recorded (I
> > think I saw that fly by recently).
> > 
> > I'll construct a ChangeLog and install this on the trunk.
> So this is causing libgcc to fail to build for rx-elf.  The problem is
> the DF=SF #define.  I think you need so split that out so that it's only
> used for rx-linux.
> 
> Jeff

OK. fix it.
I tried build rx-elf target. it success.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 7122c8ed1c8..b547ab1d1cb 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2799,6 +2799,11 @@ rl78-*-elf*)
 rx-*-elf*)
 	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
 	tmake_file="${tmake_file} rx/t-rx"
+	extra_options="${extra_options} rx/elf.opt"
+	;;
+rx-*-linux*)
+	tm_file="elfos.h linux.h glibc-stdint.h rx/linux.h ../../libgcc/config/rx/rx-abi.h"
+	tmake_file="${tmake_file} rx/t-linux"
 	;;
 s390-*-linux*)
 	tm_file="s390/s390.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h s390/linux.h"
diff --git a/gcc/config/rx/elf.opt b/gcc/config/rx/elf.opt
new file mode 100644
index 00000000000..907e030df8e
--- /dev/null
+++ b/gcc/config/rx/elf.opt
@@ -0,0 +1,44 @@
+; Command line options for the Renesas RX port of GCC.
+; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+; Contributed by Red Hat.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+;---------------------------------------------------
+
+; elf target extra options
+
+msim
+Target
+Use the simulator runtime.
+
+;---------------------------------------------------
+
+mas100-syntax
+Target Mask(AS100_SYNTAX) Report
+Generate assembler output that is compatible with the Renesas AS100 assembler.  This may restrict some of the compiler's capabilities.  The default is to generate GAS compatable syntax.
+
+;---------------------------------------------------
+
+mint-register=
+Target RejectNegative Joined UInteger Var(rx_interrupt_registers) Init(0)
+Specifies the number of registers to reserve for interrupt handlers.
+
+;---------------------------------------------------
+
+msave-acc-in-interrupts
+Target Mask(SAVE_ACC_REGISTER)
+Specifies whether interrupt functions should save and restore the accumulator register.
diff --git a/gcc/config/rx/linux.h b/gcc/config/rx/linux.h
new file mode 100644
index 00000000000..df3fdd41092
--- /dev/null
+++ b/gcc/config/rx/linux.h
@@ -0,0 +1,231 @@
+/* GCC backend definitions for the rx-linux
+   Copyright (C) 2019 Yoshinori Sato
+   Based on rx.h
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3, or (at your
+   option) any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+
+#include "config/rx/rx.h"
+
+#undef TARGET_CPU_CPP_BUILTINS
+#define TARGET_CPU_CPP_BUILTINS()               \
+  do                                            \
+    {                                           \
+      builtin_define ("__RX__"); 		\
+      builtin_assert ("cpu=RX"); 		\
+      if (rx_cpu_type == RX610)			\
+        builtin_assert ("machine=RX610");	\
+     else					\
+        builtin_assert ("machine=RX600");	\
+						\
+      if (TARGET_BIG_ENDIAN_DATA)		\
+	builtin_define ("__RX_BIG_ENDIAN__");	\
+      else					\
+	builtin_define ("__RX_LITTLE_ENDIAN__");\
+						\
+      if (TARGET_64BIT_DOUBLES)			\
+	builtin_define ("__RX_64BIT_DOUBLES__");\
+      else					\
+	builtin_define ("__RX_32BIT_DOUBLES__");\
+						\
+      if (ALLOW_RX_FPU_INSNS)			\
+	builtin_define ("__RX_FPU_INSNS__");	\
+						\
+    }                                           \
+  while (0)
+
+#undef  CC1_SPEC
+#define CC1_SPEC "\
+  %{mcpu=rx200:%{fpu:%erx200 cpu does not have FPU hardware}}"
+
+#undef  ASM_SPEC
+#define ASM_SPEC "\
+%{mbig-endian-data:-mbig-endian-data} \
+%{m64bit-doubles:-m64bit-doubles} \
+%{!m64bit-doubles:-m32bit-doubles} \
+%{msmall-data-limit*:-msmall-data-limit} \
+%{mrelax:-relax} \
+"
+
+#undef DATA_SECTION_ASM_OP
+#define DATA_SECTION_ASM_OP	      			\
+   "\t.section .data,\"aw\",@progbits\n\t.p2align 2"
+
+#undef SDATA_SECTION_ASM_OP
+#define SDATA_SECTION_ASM_OP	      			\
+   "\t.section .data2,\"aw\",@progbits\n\t.p2align 1"
+
+#undef  READONLY_DATA_SECTION_ASM_OP
+#define READONLY_DATA_SECTION_ASM_OP  			\
+   "\t.section .rodata,\"a\",@progbits\n\t.p2align 2"
+
+#undef BSS_SECTION_ASM_OP
+#define BSS_SECTION_ASM_OP	      			\
+   "\t.section .bss\n\t.p2align 2"
+
+#undef SBSS_SECTION_ASM_OP
+#define SBSS_SECTION_ASM_OP	      			\
+   "\t.section .bss2\n\t.p2align 1"
+
+/* The following definitions are conditional depending upon whether the
+   compiler is being built or crtstuff.c is being compiled by the built
+   compiler.  */
+#undef TEXT_SECTION_ASM_OP
+#define TEXT_SECTION_ASM_OP	      \
+  "\t.section .text,\"ax\""
+#undef CTORS_SECTION_ASM_OP
+#define CTORS_SECTION_ASM_OP	      \
+  "\t.section\t.init_array,\"aw\",@init_array"
+#undef DTORS_SECTION_ASM_OP
+#define DTORS_SECTION_ASM_OP	      \
+  "\t.section\t.fini_array,\"aw\",@fini_array"
+#undef INIT_ARRAY_SECTION_ASM_OP
+#define INIT_ARRAY_SECTION_ASM_OP   \
+  "\t.section\t.init_array,\"aw\",@init_array"
+#undef FINI_ARRAY_SECTION_ASM_OP
+#define FINI_ARRAY_SECTION_ASM_OP   \
+  "\t.section\t.fini_array,\"aw\",@fini_array"
+
+#undef GLOBAL_ASM_OP
+#define GLOBAL_ASM_OP		"\t.global\t"
+#undef  USER_LABEL_PREFIX
+
+#undef ASM_OUTPUT_ALIGN
+#define ASM_OUTPUT_ALIGN(STREAM, LOG)		\
+  do						\
+    {						\
+      if ((LOG) == 0)				\
+        break;					\
+      fprintf (STREAM, "\t.balign %d\n", 1 << (LOG));	\
+    }						\
+  while (0)
+
+#undef ASM_OUTPUT_ADDR_VEC_ELT
+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
+  fprintf (FILE, "\t.long .L%d\n", VALUE)
+
+/* This is how to output an element of a case-vector that is relative.
+   Note: The local label referenced by the "1b" below is emitted by
+   the tablejump insn.  */
+
+#undef ASM_OUTPUT_ADDR_DIFF_ELT
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+  fprintf (FILE, "\t.long .L%d - 1b\n", VALUE)
+
+#undef ASM_OUTPUT_SIZE_DIRECTIVE
+#define ASM_OUTPUT_SIZE_DIRECTIVE(STREAM, NAME, SIZE)			\
+  do									\
+    {									\
+      HOST_WIDE_INT size_ = (SIZE);					\
+									\
+      fputs (SIZE_ASM_OP, STREAM);					\
+      assemble_name (STREAM, NAME);					\
+      fprintf (STREAM, ", " HOST_WIDE_INT_PRINT_DEC "\n", size_);	\
+    }									\
+  while (0)
+
+#undef ASM_OUTPUT_MEASURED_SIZE
+#define ASM_OUTPUT_MEASURED_SIZE(STREAM, NAME)				\
+  do									\
+    {									\
+      fputs (SIZE_ASM_OP, STREAM);					\
+      assemble_name (STREAM, NAME);					\
+      fputs (", .-", STREAM);						\
+      assemble_name (STREAM, NAME);					\
+      putc ('\n', STREAM);						\
+    }									\
+  while (0)
+
+#undef ASM_OUTPUT_TYPE_DIRECTIVE
+#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)			\
+  do									\
+    {									\
+      fputs (TYPE_ASM_OP, STREAM);					\
+      assemble_name (STREAM, NAME);					\
+      fputs (", ", STREAM);						\
+      fprintf (STREAM, TYPE_OPERAND_FMT, TYPE);				\
+      putc ('\n', STREAM);						\
+    }									\
+  while (0)
+
+#undef  ASM_GENERATE_INTERNAL_LABEL
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)		\
+  do								\
+    {								\
+      sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM));			\
+    }								\
+  while (0)
+
+#undef  ASM_OUTPUT_EXTERNAL
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)			\
+  do								\
+    {								\
+      default_elf_asm_output_external (FILE, DECL, NAME);	\
+    }								\
+  while (0)
+
+#undef  ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
+  do									\
+    {									\
+      fprintf ((FILE), "%s", COMMON_ASM_OP);				\
+      assemble_name ((FILE), (NAME));					\
+      fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n",	\
+	       (SIZE), (ALIGN) / BITS_PER_UNIT);			\
+    }									\
+  while (0)
+
+#undef  SKIP_ASM_OP
+#define SKIP_ASM_OP   "\t.zero\t"
+
+#undef  ASM_OUTPUT_LIMITED_STRING
+#define ASM_OUTPUT_LIMITED_STRING(FILE, STR)		\
+  do							\
+    {							\
+      const unsigned char *_limited_str =		\
+	(const unsigned char *) (STR);			\
+      unsigned ch;					\
+							\
+      fprintf ((FILE), "\t.string\t\"");		\
+							\
+      for (; (ch = *_limited_str); _limited_str++)	\
+        {						\
+	  int escape;					\
+							\
+	  switch (escape = ESCAPES[ch])			\
+	    {						\
+	    case 0:					\
+	      putc (ch, (FILE));			\
+	      break;					\
+	    case 1:					\
+	      fprintf ((FILE), "\\%03o", ch);		\
+	      break;					\
+	    default:					\
+	      putc ('\\', (FILE));			\
+	      putc (escape, (FILE));			\
+	      break;					\
+	    }						\
+        }						\
+							\
+      fprintf ((FILE), "\"\n");				\
+    }							\
+  while (0)
+
+#undef  PREFERRED_DEBUGGING_TYPE
+
+#undef TARGET_AS100_SYNTAX
+#define TARGET_AS100_SYNTAX 0
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index f70e8f34004..0695f3b6538 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -1438,10 +1438,14 @@ bit_count (unsigned int x)
   return (x + (x >> 16)) & 0x3f;
 }
 
+#if defined(TARGET_SAVE_ACC_REGISTER)
 #define MUST_SAVE_ACC_REGISTER			\
   (TARGET_SAVE_ACC_REGISTER			\
    && (is_interrupt_func (NULL_TREE)		\
        || is_fast_interrupt_func (NULL_TREE)))
+#else
+#define MUST_SAVE_ACC_REGISTER 0
+#endif
 
 /* Returns either the lowest numbered and highest numbered registers that
    occupy the call-saved area of the stack frame, if the registers are
diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h
index b50b48f8afb..672e087cd13 100644
--- a/gcc/config/rx/rx.h
+++ b/gcc/config/rx/rx.h
@@ -408,7 +408,9 @@ typedef unsigned int CUMULATIVE_ARGS;
 #define GLOBAL_ASM_OP 		\
   (TARGET_AS100_SYNTAX ? "\t.GLB\t" : "\t.global\t")
 #define ASM_COMMENT_START	" ;"
+#undef ASM_APP_ON
 #define ASM_APP_ON		""
+#undef ASM_APP_OFF
 #define ASM_APP_OFF 		""
 #define LOCAL_LABEL_PREFIX	"L"
 #undef  USER_LABEL_PREFIX
diff --git a/gcc/config/rx/rx.opt b/gcc/config/rx/rx.opt
index 50814a17a75..4e80c860e43 100644
--- a/gcc/config/rx/rx.opt
+++ b/gcc/config/rx/rx.opt
@@ -82,18 +82,6 @@ Maximum size of global and static variables which can be placed into the small d
 
 ;---------------------------------------------------
 
-msim
-Target
-Use the simulator runtime.
-
-;---------------------------------------------------
-
-mas100-syntax
-Target Mask(AS100_SYNTAX) Report
-Generate assembler output that is compatible with the Renesas AS100 assembler.  This may restrict some of the compiler's capabilities.  The default is to generate GAS compatible syntax.
-
-;---------------------------------------------------
-
 mrelax
 Target
 Enable linker relaxation.
diff --git a/gcc/config/rx/t-linux b/gcc/config/rx/t-linux
new file mode 100644
index 00000000000..0975b2690dc
--- /dev/null
+++ b/gcc/config/rx/t-linux
@@ -0,0 +1,34 @@
+# Makefile fragment for building GCC for the rx-linux.
+# Copyright (C) 2019 Yoshinori Sato
+# Based on t-rx
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 3, or (at your
+# option) any later version.
+#
+# GCC is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the  GNU General Public
+# License along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Enable multilibs:
+
+MULTILIB_OPTIONS    =
+MULTILIB_DIRNAMES   =
+
+MULTILIB_MATCHES    = nofpu=mnofpu  nofpu=mcpu?rx200  nofpu=mcpu?RX200
+
+MULTILIB_EXCEPTIONS =
+MULTILIB_EXTRA_OPTS =
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
diff --git a/libgcc/config.host b/libgcc/config.host
index 91fed5fa473..2c297f40270 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1211,6 +1211,9 @@ rx-*-elf)
 	tmake_file="rx/t-rx t-fdpbit"
 	tm_file="$tm_file rx/rx-abi.h rx/rx-lib.h"
 	;;
+rx-*-linux*)
+	tmake_file="rx/t-rx rx/t-linux"
+	;;
 s390-*-linux*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux s390/32/t-floattodi t-stack s390/t-stack-s390"
 	md_unwind_header=s390/linux-unwind.h
diff --git a/libgcc/config/rx/t-linux b/libgcc/config/rx/t-linux
new file mode 100644
index 00000000000..41ec3a3d4dc
--- /dev/null
+++ b/libgcc/config/rx/t-linux
@@ -0,0 +1,20 @@
+# Makefile fragment for building LIBGCC for rx-linux.
+# Copyright (C) 2019 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 3, or (at your
+# option) any later version.
+#
+# GCC is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the  GNU General Public
+# License along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+HOST_LIBGCC2_CFLAGS += -DDF=SF
Oleg Endo June 2, 2019, 1:12 p.m. UTC | #4
On Sun, 2019-06-02 at 20:26 +0900, Yoshinori Sato wrote:
> On Fri, 31 May 2019 09:16:18 +0900,
> Jeff Law wrote:
> > 
> > On 5/29/19 12:27 PM, Jeff Law wrote:
> > > On 5/23/19 6:05 AM, Yoshinori Sato wrote:
> > > > I ported linux kernel to Renesas RX.
> > > > 
> > > > rx-*-elf target output a binary different from the standard
> > > > ELF.
> > > > It has the same format as the Renesas compiler.
> > > > 
> > > > But the linux kernel requires the standard ELF format.
> > > > I want to define a rx-*-linux target so that I can generate
> > > > a standard ELF binary.
> > > 
> > > Presumably you're resubmitting after your assignment got recorded
> > > (I
> > > think I saw that fly by recently).
> > > 
> > > I'll construct a ChangeLog and install this on the trunk.
> > 
> > So this is causing libgcc to fail to build for rx-elf.  The problem
> > is
> > the DF=SF #define.  I think you need so split that out so that it's
> > only
> > used for rx-linux.
> > 
> > Jeff
> 
> OK. fix it.
> I tried build rx-elf target. it success.
> 

Setting DF=SF is the wrong thing to do IMHO.  RX can do DF just fine in
software.  If this is hardcoded like that in the roots of the
toolchain, it will make compiling packages that actually need real DF
completely impossible, won't it?  We also don't set DI = SI just
because the hardware is bad at SI ... 

Just my 2 cents.

Cheers,
Oleg
Segher Boessenkool June 2, 2019, 5:37 p.m. UTC | #5
On Sun, Jun 02, 2019 at 10:12:37PM +0900, Oleg Endo wrote:
> On Sun, 2019-06-02 at 20:26 +0900, Yoshinori Sato wrote:
> > On Fri, 31 May 2019 09:16:18 +0900,
> > Jeff Law wrote:
> > > 
> > > On 5/29/19 12:27 PM, Jeff Law wrote:
> > > > On 5/23/19 6:05 AM, Yoshinori Sato wrote:
> > > > > I ported linux kernel to Renesas RX.
> > > > > 
> > > > > rx-*-elf target output a binary different from the standard
> > > > > ELF.
> > > > > It has the same format as the Renesas compiler.
> > > > > 
> > > > > But the linux kernel requires the standard ELF format.
> > > > > I want to define a rx-*-linux target so that I can generate
> > > > > a standard ELF binary.
> > > > 
> > > > Presumably you're resubmitting after your assignment got recorded
> > > > (I
> > > > think I saw that fly by recently).
> > > > 
> > > > I'll construct a ChangeLog and install this on the trunk.
> > > 
> > > So this is causing libgcc to fail to build for rx-elf.  The problem
> > > is
> > > the DF=SF #define.  I think you need so split that out so that it's
> > > only
> > > used for rx-linux.
> > > 
> > > Jeff
> > 
> > OK. fix it.
> > I tried build rx-elf target. it success.
> > 
> 
> Setting DF=SF is the wrong thing to do IMHO.  RX can do DF just fine in
> software.  If this is hardcoded like that in the roots of the
> toolchain, it will make compiling packages that actually need real DF
> completely impossible, won't it?  We also don't set DI = SI just
> because the hardware is bad at SI ... 

This is -m64bit-doubles/-m32bit-doubles, and t-rx already multilibs that?
And the default is 32-bit.  So why does rx-linux need something different?
You could make a point for wanting 64-bit doubles as default, even;
disabling it completely does not seem like a good plan.

(This patch seems to have broken rx-elf btw?)


Segher
Oleg Endo June 3, 2019, 1:37 p.m. UTC | #6
On Sun, 2019-06-02 at 12:37 -0500, Segher Boessenkool wrote:
> 
> This is -m64bit-doubles/-m32bit-doubles, and t-rx already multilibs
> that?

Yes, it does.

> And the default is 32-bit.  So why does rx-linux need something
> different?
> You could make a point for wanting 64-bit doubles as default, even;
> disabling it completely does not seem like a good plan.
> 

On RX, "default to 32-bit" means DF=SF, always.  I.e. DF is disabled
for good.  Usually I built RX stuff always with -m64bit-doubles because
of that.  It should be actually the default and -m32bit-doubles should
be some kind of "optimization" switch.  So in my optinion, -m64bit-
doubles should be the default for a linux target, to allow having
actual doubles, and not just floats.

Cheers,
Oleg
Yoshinori Sato June 3, 2019, 5:01 p.m. UTC | #7
On Sun, 02 Jun 2019 22:12:37 +0900,
Oleg Endo wrote:
> 
> On Sun, 2019-06-02 at 20:26 +0900, Yoshinori Sato wrote:
> > On Fri, 31 May 2019 09:16:18 +0900,
> > Jeff Law wrote:
> > > 
> > > On 5/29/19 12:27 PM, Jeff Law wrote:
> > > > On 5/23/19 6:05 AM, Yoshinori Sato wrote:
> > > > > I ported linux kernel to Renesas RX.
> > > > > 
> > > > > rx-*-elf target output a binary different from the standard
> > > > > ELF.
> > > > > It has the same format as the Renesas compiler.
> > > > > 
> > > > > But the linux kernel requires the standard ELF format.
> > > > > I want to define a rx-*-linux target so that I can generate
> > > > > a standard ELF binary.
> > > > 
> > > > Presumably you're resubmitting after your assignment got recorded
> > > > (I
> > > > think I saw that fly by recently).
> > > > 
> > > > I'll construct a ChangeLog and install this on the trunk.
> > > 
> > > So this is causing libgcc to fail to build for rx-elf.  The problem
> > > is
> > > the DF=SF #define.  I think you need so split that out so that it's
> > > only
> > > used for rx-linux.
> > > 
> > > Jeff
> > 
> > OK. fix it.
> > I tried build rx-elf target. it success.
> > 
> 
> Setting DF=SF is the wrong thing to do IMHO.  RX can do DF just fine in
> software.  If this is hardcoded like that in the roots of the
> toolchain, it will make compiling packages that actually need real DF
> completely impossible, won't it?  We also don't set DI = SI just
> because the hardware is bad at SI ... 
> 
> Just my 2 cents.
> 
> Cheers,
> Oleg
> 

OK.
I was misunderstood.
I think this is not a problem.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 7122c8ed1c8..b547ab1d1cb 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2799,6 +2799,11 @@ rl78-*-elf*)
 rx-*-elf*)
 	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
 	tmake_file="${tmake_file} rx/t-rx"
+	extra_options="${extra_options} rx/elf.opt"
+	;;
+rx-*-linux*)
+	tm_file="elfos.h linux.h glibc-stdint.h rx/linux.h ../../libgcc/config/rx/rx-abi.h"
+	tmake_file="${tmake_file} rx/t-linux"
 	;;
 s390-*-linux*)
 	tm_file="s390/s390.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h s390/linux.h"
diff --git a/gcc/config/rx/elf.opt b/gcc/config/rx/elf.opt
new file mode 100644
index 00000000000..907e030df8e
--- /dev/null
+++ b/gcc/config/rx/elf.opt
@@ -0,0 +1,44 @@
+; Command line options for the Renesas RX port of GCC.
+; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+; Contributed by Red Hat.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+;---------------------------------------------------
+
+; elf target extra options
+
+msim
+Target
+Use the simulator runtime.
+
+;---------------------------------------------------
+
+mas100-syntax
+Target Mask(AS100_SYNTAX) Report
+Generate assembler output that is compatible with the Renesas AS100 assembler.  This may restrict some of the compiler's capabilities.  The default is to generate GAS compatable syntax.
+
+;---------------------------------------------------
+
+mint-register=
+Target RejectNegative Joined UInteger Var(rx_interrupt_registers) Init(0)
+Specifies the number of registers to reserve for interrupt handlers.
+
+;---------------------------------------------------
+
+msave-acc-in-interrupts
+Target Mask(SAVE_ACC_REGISTER)
+Specifies whether interrupt functions should save and restore the accumulator register.
diff --git a/gcc/config/rx/linux.h b/gcc/config/rx/linux.h
new file mode 100644
index 00000000000..df3fdd41092
--- /dev/null
+++ b/gcc/config/rx/linux.h
@@ -0,0 +1,231 @@
+/* GCC backend definitions for the rx-linux
+   Copyright (C) 2019 Yoshinori Sato
+   Based on rx.h
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3, or (at your
+   option) any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+
+#include "config/rx/rx.h"
+
+#undef TARGET_CPU_CPP_BUILTINS
+#define TARGET_CPU_CPP_BUILTINS()               \
+  do                                            \
+    {                                           \
+      builtin_define ("__RX__"); 		\
+      builtin_assert ("cpu=RX"); 		\
+      if (rx_cpu_type == RX610)			\
+        builtin_assert ("machine=RX610");	\
+     else					\
+        builtin_assert ("machine=RX600");	\
+						\
+      if (TARGET_BIG_ENDIAN_DATA)		\
+	builtin_define ("__RX_BIG_ENDIAN__");	\
+      else					\
+	builtin_define ("__RX_LITTLE_ENDIAN__");\
+						\
+      if (TARGET_64BIT_DOUBLES)			\
+	builtin_define ("__RX_64BIT_DOUBLES__");\
+      else					\
+	builtin_define ("__RX_32BIT_DOUBLES__");\
+						\
+      if (ALLOW_RX_FPU_INSNS)			\
+	builtin_define ("__RX_FPU_INSNS__");	\
+						\
+    }                                           \
+  while (0)
+
+#undef  CC1_SPEC
+#define CC1_SPEC "\
+  %{mcpu=rx200:%{fpu:%erx200 cpu does not have FPU hardware}}"
+
+#undef  ASM_SPEC
+#define ASM_SPEC "\
+%{mbig-endian-data:-mbig-endian-data} \
+%{m64bit-doubles:-m64bit-doubles} \
+%{!m64bit-doubles:-m32bit-doubles} \
+%{msmall-data-limit*:-msmall-data-limit} \
+%{mrelax:-relax} \
+"
+
+#undef DATA_SECTION_ASM_OP
+#define DATA_SECTION_ASM_OP	      			\
+   "\t.section .data,\"aw\",@progbits\n\t.p2align 2"
+
+#undef SDATA_SECTION_ASM_OP
+#define SDATA_SECTION_ASM_OP	      			\
+   "\t.section .data2,\"aw\",@progbits\n\t.p2align 1"
+
+#undef  READONLY_DATA_SECTION_ASM_OP
+#define READONLY_DATA_SECTION_ASM_OP  			\
+   "\t.section .rodata,\"a\",@progbits\n\t.p2align 2"
+
+#undef BSS_SECTION_ASM_OP
+#define BSS_SECTION_ASM_OP	      			\
+   "\t.section .bss\n\t.p2align 2"
+
+#undef SBSS_SECTION_ASM_OP
+#define SBSS_SECTION_ASM_OP	      			\
+   "\t.section .bss2\n\t.p2align 1"
+
+/* The following definitions are conditional depending upon whether the
+   compiler is being built or crtstuff.c is being compiled by the built
+   compiler.  */
+#undef TEXT_SECTION_ASM_OP
+#define TEXT_SECTION_ASM_OP	      \
+  "\t.section .text,\"ax\""
+#undef CTORS_SECTION_ASM_OP
+#define CTORS_SECTION_ASM_OP	      \
+  "\t.section\t.init_array,\"aw\",@init_array"
+#undef DTORS_SECTION_ASM_OP
+#define DTORS_SECTION_ASM_OP	      \
+  "\t.section\t.fini_array,\"aw\",@fini_array"
+#undef INIT_ARRAY_SECTION_ASM_OP
+#define INIT_ARRAY_SECTION_ASM_OP   \
+  "\t.section\t.init_array,\"aw\",@init_array"
+#undef FINI_ARRAY_SECTION_ASM_OP
+#define FINI_ARRAY_SECTION_ASM_OP   \
+  "\t.section\t.fini_array,\"aw\",@fini_array"
+
+#undef GLOBAL_ASM_OP
+#define GLOBAL_ASM_OP		"\t.global\t"
+#undef  USER_LABEL_PREFIX
+
+#undef ASM_OUTPUT_ALIGN
+#define ASM_OUTPUT_ALIGN(STREAM, LOG)		\
+  do						\
+    {						\
+      if ((LOG) == 0)				\
+        break;					\
+      fprintf (STREAM, "\t.balign %d\n", 1 << (LOG));	\
+    }						\
+  while (0)
+
+#undef ASM_OUTPUT_ADDR_VEC_ELT
+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
+  fprintf (FILE, "\t.long .L%d\n", VALUE)
+
+/* This is how to output an element of a case-vector that is relative.
+   Note: The local label referenced by the "1b" below is emitted by
+   the tablejump insn.  */
+
+#undef ASM_OUTPUT_ADDR_DIFF_ELT
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+  fprintf (FILE, "\t.long .L%d - 1b\n", VALUE)
+
+#undef ASM_OUTPUT_SIZE_DIRECTIVE
+#define ASM_OUTPUT_SIZE_DIRECTIVE(STREAM, NAME, SIZE)			\
+  do									\
+    {									\
+      HOST_WIDE_INT size_ = (SIZE);					\
+									\
+      fputs (SIZE_ASM_OP, STREAM);					\
+      assemble_name (STREAM, NAME);					\
+      fprintf (STREAM, ", " HOST_WIDE_INT_PRINT_DEC "\n", size_);	\
+    }									\
+  while (0)
+
+#undef ASM_OUTPUT_MEASURED_SIZE
+#define ASM_OUTPUT_MEASURED_SIZE(STREAM, NAME)				\
+  do									\
+    {									\
+      fputs (SIZE_ASM_OP, STREAM);					\
+      assemble_name (STREAM, NAME);					\
+      fputs (", .-", STREAM);						\
+      assemble_name (STREAM, NAME);					\
+      putc ('\n', STREAM);						\
+    }									\
+  while (0)
+
+#undef ASM_OUTPUT_TYPE_DIRECTIVE
+#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)			\
+  do									\
+    {									\
+      fputs (TYPE_ASM_OP, STREAM);					\
+      assemble_name (STREAM, NAME);					\
+      fputs (", ", STREAM);						\
+      fprintf (STREAM, TYPE_OPERAND_FMT, TYPE);				\
+      putc ('\n', STREAM);						\
+    }									\
+  while (0)
+
+#undef  ASM_GENERATE_INTERNAL_LABEL
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)		\
+  do								\
+    {								\
+      sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM));			\
+    }								\
+  while (0)
+
+#undef  ASM_OUTPUT_EXTERNAL
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)			\
+  do								\
+    {								\
+      default_elf_asm_output_external (FILE, DECL, NAME);	\
+    }								\
+  while (0)
+
+#undef  ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
+  do									\
+    {									\
+      fprintf ((FILE), "%s", COMMON_ASM_OP);				\
+      assemble_name ((FILE), (NAME));					\
+      fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n",	\
+	       (SIZE), (ALIGN) / BITS_PER_UNIT);			\
+    }									\
+  while (0)
+
+#undef  SKIP_ASM_OP
+#define SKIP_ASM_OP   "\t.zero\t"
+
+#undef  ASM_OUTPUT_LIMITED_STRING
+#define ASM_OUTPUT_LIMITED_STRING(FILE, STR)		\
+  do							\
+    {							\
+      const unsigned char *_limited_str =		\
+	(const unsigned char *) (STR);			\
+      unsigned ch;					\
+							\
+      fprintf ((FILE), "\t.string\t\"");		\
+							\
+      for (; (ch = *_limited_str); _limited_str++)	\
+        {						\
+	  int escape;					\
+							\
+	  switch (escape = ESCAPES[ch])			\
+	    {						\
+	    case 0:					\
+	      putc (ch, (FILE));			\
+	      break;					\
+	    case 1:					\
+	      fprintf ((FILE), "\\%03o", ch);		\
+	      break;					\
+	    default:					\
+	      putc ('\\', (FILE));			\
+	      putc (escape, (FILE));			\
+	      break;					\
+	    }						\
+        }						\
+							\
+      fprintf ((FILE), "\"\n");				\
+    }							\
+  while (0)
+
+#undef  PREFERRED_DEBUGGING_TYPE
+
+#undef TARGET_AS100_SYNTAX
+#define TARGET_AS100_SYNTAX 0
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index f70e8f34004..0695f3b6538 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -1438,10 +1438,14 @@ bit_count (unsigned int x)
   return (x + (x >> 16)) & 0x3f;
 }
 
+#if defined(TARGET_SAVE_ACC_REGISTER)
 #define MUST_SAVE_ACC_REGISTER			\
   (TARGET_SAVE_ACC_REGISTER			\
    && (is_interrupt_func (NULL_TREE)		\
        || is_fast_interrupt_func (NULL_TREE)))
+#else
+#define MUST_SAVE_ACC_REGISTER 0
+#endif
 
 /* Returns either the lowest numbered and highest numbered registers that
    occupy the call-saved area of the stack frame, if the registers are
diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h
index b50b48f8afb..672e087cd13 100644
--- a/gcc/config/rx/rx.h
+++ b/gcc/config/rx/rx.h
@@ -408,7 +408,9 @@ typedef unsigned int CUMULATIVE_ARGS;
 #define GLOBAL_ASM_OP 		\
   (TARGET_AS100_SYNTAX ? "\t.GLB\t" : "\t.global\t")
 #define ASM_COMMENT_START	" ;"
+#undef ASM_APP_ON
 #define ASM_APP_ON		""
+#undef ASM_APP_OFF
 #define ASM_APP_OFF 		""
 #define LOCAL_LABEL_PREFIX	"L"
 #undef  USER_LABEL_PREFIX
diff --git a/gcc/config/rx/rx.opt b/gcc/config/rx/rx.opt
index 50814a17a75..4e80c860e43 100644
--- a/gcc/config/rx/rx.opt
+++ b/gcc/config/rx/rx.opt
@@ -82,18 +82,6 @@ Maximum size of global and static variables which can be placed into the small d
 
 ;---------------------------------------------------
 
-msim
-Target
-Use the simulator runtime.
-
-;---------------------------------------------------
-
-mas100-syntax
-Target Mask(AS100_SYNTAX) Report
-Generate assembler output that is compatible with the Renesas AS100 assembler.  This may restrict some of the compiler's capabilities.  The default is to generate GAS compatible syntax.
-
-;---------------------------------------------------
-
 mrelax
 Target
 Enable linker relaxation.
diff --git a/gcc/config/rx/t-linux b/gcc/config/rx/t-linux
new file mode 100644
index 00000000000..0975b2690dc
--- /dev/null
+++ b/gcc/config/rx/t-linux
@@ -0,0 +1,34 @@
+# Makefile fragment for building GCC for the rx-linux.
+# Copyright (C) 2019 Yoshinori Sato
+# Based on t-rx
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 3, or (at your
+# option) any later version.
+#
+# GCC is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the  GNU General Public
+# License along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Enable multilibs:
+
+MULTILIB_OPTIONS    =
+MULTILIB_DIRNAMES   =
+
+MULTILIB_MATCHES    = nofpu=mnofpu  nofpu=mcpu?rx200  nofpu=mcpu?RX200
+
+MULTILIB_EXCEPTIONS =
+MULTILIB_EXTRA_OPTS =
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
diff --git a/libgcc/config.host b/libgcc/config.host
index 91fed5fa473..d75e2b5d7aa 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1211,6 +1211,10 @@ rx-*-elf)
 	tmake_file="rx/t-rx t-fdpbit"
 	tm_file="$tm_file rx/rx-abi.h rx/rx-lib.h"
 	;;
+rx-*-linux*)
+	tmake_file="rx/t-rx t-fdpbit"
+	tm_file="$tm_file rx/rx-lib.h"
+	;;
 s390-*-linux*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux s390/32/t-floattodi t-stack s390/t-stack-s390"
 	md_unwind_header=s390/linux-unwind.h
Jeff Law June 5, 2019, 11:07 p.m. UTC | #8
On 6/2/19 5:26 AM, Yoshinori Sato wrote:
> On Fri, 31 May 2019 09:16:18 +0900,
> Jeff Law wrote:
>>
>> On 5/29/19 12:27 PM, Jeff Law wrote:
>>> On 5/23/19 6:05 AM, Yoshinori Sato wrote:
>>>> I ported linux kernel to Renesas RX.
>>>>
>>>> rx-*-elf target output a binary different from the standard ELF.
>>>> It has the same format as the Renesas compiler.
>>>>
>>>> But the linux kernel requires the standard ELF format.
>>>> I want to define a rx-*-linux target so that I can generate
>>>> a standard ELF binary.
>>> Presumably you're resubmitting after your assignment got recorded (I
>>> think I saw that fly by recently).
>>>
>>> I'll construct a ChangeLog and install this on the trunk.
>> So this is causing libgcc to fail to build for rx-elf.  The problem is
>> the DF=SF #define.  I think you need so split that out so that it's only
>> used for rx-linux.
>>
>> Jeff
> 
> OK. fix it.
> I tried build rx-elf target. it success.
What parts did you build?  For me it fails building libgcc:


> /home/tmp/rx/./gcc/xgcc -B/home/tmp/rx/./gcc/ -B/tmp/rx/rx-elf/bin/ -B/tmp/rx/rx-elf/lib/ -isystem /tmp/rx/rx-elf/include -isystem /tmp/rx/rx-elf/sys-include    -g -O2 -m64bit-doubles -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wold-style-definition  -isystem ./include   -DDF=SF -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -DDF=SF -I. -I. -I../../.././gcc -I/home/gcc/GIT-3/gcc/libgcc -I/home/gcc/GIT-3/gcc/libgcc/. -I/home/gcc/GIT-3/gcc/libgcc/../gcc -I/home/gcc/GIT-3/gcc/libgcc/../include  -DHAVE_CC_TLS -DUSE_EMUTLS -o _muldc3.o -MT _muldc3.o -MD -MP -MF _muldc3.dep -DL_muldc3 -c /home/gcc/GIT-3/gcc/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
> In file included from /home/gcc/GIT-3/gcc/libgcc/libgcc2.c:56:
> /home/gcc/GIT-3/gcc/libgcc/libgcc2.h:256:16: warning: conflicting types for built-in function ‘__divdc3’; expected ‘_Complex double(double,  double,  double,  double)’ [-Wbuiltin-declaration-mismatch]
>   256 | #define __N(a) __ ## a
>       |                ^~
> /home/gcc/GIT-3/gcc/libgcc/libgcc2.h:366:19: note: in expansion of macro ‘__N’
>   366 | #define __divdc3  __N(divdc3)
>       |                   ^~~
> /home/gcc/GIT-3/gcc/libgcc/libgcc2.h:461:15: note: in expansion of macro ‘__divdc3’
>   461 | extern DCtype __divdc3 (DFtype, DFtype, DFtype, DFtype);
>       |               ^~~~~~~~


[ ... and so on ... ]

Jeff
Jeff Law June 5, 2019, 11:22 p.m. UTC | #9
On 6/3/19 11:01 AM, Yoshinori Sato wrote:
> On Sun, 02 Jun 2019 22:12:37 +0900,
> Oleg Endo wrote:
>>
>> On Sun, 2019-06-02 at 20:26 +0900, Yoshinori Sato wrote:
>>> On Fri, 31 May 2019 09:16:18 +0900,
>>> Jeff Law wrote:
>>>>
>>>> On 5/29/19 12:27 PM, Jeff Law wrote:
>>>>> On 5/23/19 6:05 AM, Yoshinori Sato wrote:
>>>>>> I ported linux kernel to Renesas RX.
>>>>>>
>>>>>> rx-*-elf target output a binary different from the standard
>>>>>> ELF.
>>>>>> It has the same format as the Renesas compiler.
>>>>>>
>>>>>> But the linux kernel requires the standard ELF format.
>>>>>> I want to define a rx-*-linux target so that I can generate
>>>>>> a standard ELF binary.
>>>>>
>>>>> Presumably you're resubmitting after your assignment got recorded
>>>>> (I
>>>>> think I saw that fly by recently).
>>>>>
>>>>> I'll construct a ChangeLog and install this on the trunk.
>>>>
>>>> So this is causing libgcc to fail to build for rx-elf.  The problem
>>>> is
>>>> the DF=SF #define.  I think you need so split that out so that it's
>>>> only
>>>> used for rx-linux.
>>>>
>>>> Jeff
>>>
>>> OK. fix it.
>>> I tried build rx-elf target. it success.
>>>
>>
>> Setting DF=SF is the wrong thing to do IMHO.  RX can do DF just fine in
>> software.  If this is hardcoded like that in the roots of the
>> toolchain, it will make compiling packages that actually need real DF
>> completely impossible, won't it?  We also don't set DI = SI just
>> because the hardware is bad at SI ... 
>>
>> Just my 2 cents.
>>
>> Cheers,
>> Oleg
>>
> 
> OK.
> I was misunderstood.
> I think this is not a problem.
[ ... ]
THanks.  Give we already had your original patch in the source tree, I
extracted just the new bits and committed them.  I'm attaching the
changes for archival purposes.

Jeff
commit aafb499477a6f23d01c4c048c20c8833a801396a
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Jun 5 23:20:27 2019 +0000

            * config.host (rx-*-linux*): Add t-fdpbit to tmake_file
            Add appropriate tm_file clause as well.
            * config/rx/t-rx (HOST_LIBGCC2_CFLAGS): Remove.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@271978 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 82c124f8ece..93cdcda3284 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-06-05  Yoshinori Sato  <ysato@users.sourceforge.jp>
+
+	* config.host (rx-*-linux*): Add t-fdpbit to tmake_file
+	Add appropriate tm_file clause as well.
+	* config/rx/t-rx (HOST_LIBGCC2_CFLAGS): Remove.
+
 2019-06-05  James Clarke  <jrtc27@jrtc27.com>
 
 	* config/ia64/crtbegin.S (__dso_handle): Put in .sdata/.sbss
diff --git a/libgcc/config.host b/libgcc/config.host
index ff2f0fa1e58..d75e2b5d7aa 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1212,7 +1212,8 @@ rx-*-elf)
 	tm_file="$tm_file rx/rx-abi.h rx/rx-lib.h"
 	;;
 rx-*-linux*)
-	tmake_file="rx/t-rx"
+	tmake_file="rx/t-rx t-fdpbit"
+	tm_file="$tm_file rx/rx-lib.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/t-rx b/libgcc/config/rx/t-rx
index 34cdc97cc03..ace3b16f39e 100644
--- a/libgcc/config/rx/t-rx
+++ b/libgcc/config/rx/t-rx
@@ -23,7 +23,6 @@
 # the normal libgcc sources:
 
 LIB2ADD = $(srcdir)/config/rx/rx-abi-functions.c
-HOST_LIBGCC2_CFLAGS += -DDF=SF
 
 
 # We need special handling of the floating point conversion
Yoshinori Sato June 7, 2019, 7:34 a.m. UTC | #10
On Thu, 06 Jun 2019 08:22:55 +0900,
Jeff Law wrote:
> 
> [1  <text/plain; utf-8 (7bit)>]
> On 6/3/19 11:01 AM, Yoshinori Sato wrote:
> > On Sun, 02 Jun 2019 22:12:37 +0900,
> > Oleg Endo wrote:
> >>
> >> On Sun, 2019-06-02 at 20:26 +0900, Yoshinori Sato wrote:
> >>> On Fri, 31 May 2019 09:16:18 +0900,
> >>> Jeff Law wrote:
> >>>>
> >>>> On 5/29/19 12:27 PM, Jeff Law wrote:
> >>>>> On 5/23/19 6:05 AM, Yoshinori Sato wrote:
> >>>>>> I ported linux kernel to Renesas RX.
> >>>>>>
> >>>>>> rx-*-elf target output a binary different from the standard
> >>>>>> ELF.
> >>>>>> It has the same format as the Renesas compiler.
> >>>>>>
> >>>>>> But the linux kernel requires the standard ELF format.
> >>>>>> I want to define a rx-*-linux target so that I can generate
> >>>>>> a standard ELF binary.
> >>>>>
> >>>>> Presumably you're resubmitting after your assignment got recorded
> >>>>> (I
> >>>>> think I saw that fly by recently).
> >>>>>
> >>>>> I'll construct a ChangeLog and install this on the trunk.
> >>>>
> >>>> So this is causing libgcc to fail to build for rx-elf.  The problem
> >>>> is
> >>>> the DF=SF #define.  I think you need so split that out so that it's
> >>>> only
> >>>> used for rx-linux.
> >>>>
> >>>> Jeff
> >>>
> >>> OK. fix it.
> >>> I tried build rx-elf target. it success.
> >>>
> >>
> >> Setting DF=SF is the wrong thing to do IMHO.  RX can do DF just fine in
> >> software.  If this is hardcoded like that in the roots of the
> >> toolchain, it will make compiling packages that actually need real DF
> >> completely impossible, won't it?  We also don't set DI = SI just
> >> because the hardware is bad at SI ... 
> >>
> >> Just my 2 cents.
> >>
> >> Cheers,
> >> Oleg
> >>
> > 
> > OK.
> > I was misunderstood.
> > I think this is not a problem.
> [ ... ]
> THanks.  Give we already had your original patch in the source tree, I
> extracted just the new bits and committed them.  I'm attaching the
> changes for archival purposes.
> 
> Jeff

OK. Thanks.
It can build linux kernel.

> [2 P <text/plain; UTF-8 (base64)>]
> commit aafb499477a6f23d01c4c048c20c8833a801396a
> Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
> Date:   Wed Jun 5 23:20:27 2019 +0000
> 
>             * config.host (rx-*-linux*): Add t-fdpbit to tmake_file
>             Add appropriate tm_file clause as well.
>             * config/rx/t-rx (HOST_LIBGCC2_CFLAGS): Remove.
>     
>     git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@271978 138bc75d-0d04-0410-961f-82ee72b054a4
> 
> diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
> index 82c124f8ece..93cdcda3284 100644
> --- a/libgcc/ChangeLog
> +++ b/libgcc/ChangeLog
> @@ -1,3 +1,9 @@
> +2019-06-05  Yoshinori Sato  <ysato@users.sourceforge.jp>
> +
> +	* config.host (rx-*-linux*): Add t-fdpbit to tmake_file
> +	Add appropriate tm_file clause as well.
> +	* config/rx/t-rx (HOST_LIBGCC2_CFLAGS): Remove.
> +
>  2019-06-05  James Clarke  <jrtc27@jrtc27.com>
>  
>  	* config/ia64/crtbegin.S (__dso_handle): Put in .sdata/.sbss
> diff --git a/libgcc/config.host b/libgcc/config.host
> index ff2f0fa1e58..d75e2b5d7aa 100644
> --- a/libgcc/config.host
> +++ b/libgcc/config.host
> @@ -1212,7 +1212,8 @@ rx-*-elf)
>  	tm_file="$tm_file rx/rx-abi.h rx/rx-lib.h"
>  	;;
>  rx-*-linux*)
> -	tmake_file="rx/t-rx"
> +	tmake_file="rx/t-rx t-fdpbit"
> +	tm_file="$tm_file rx/rx-lib.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/t-rx b/libgcc/config/rx/t-rx
> index 34cdc97cc03..ace3b16f39e 100644
> --- a/libgcc/config/rx/t-rx
> +++ b/libgcc/config/rx/t-rx
> @@ -23,7 +23,6 @@
>  # the normal libgcc sources:
>  
>  LIB2ADD = $(srcdir)/config/rx/rx-abi-functions.c
> -HOST_LIBGCC2_CFLAGS += -DDF=SF
>  
>  
>  # We need special handling of the floating point conversion
diff mbox series

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 7122c8ed1c8..b547ab1d1cb 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2799,6 +2799,11 @@  rl78-*-elf*)
 rx-*-elf*)
 	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
 	tmake_file="${tmake_file} rx/t-rx"
+	extra_options="${extra_options} rx/elf.opt"
+	;;
+rx-*-linux*)
+	tm_file="elfos.h linux.h glibc-stdint.h rx/linux.h ../../libgcc/config/rx/rx-abi.h"
+	tmake_file="${tmake_file} rx/t-linux"
 	;;
 s390-*-linux*)
 	tm_file="s390/s390.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h s390/linux.h"
diff --git a/gcc/config/rx/elf.opt b/gcc/config/rx/elf.opt
new file mode 100644
index 00000000000..907e030df8e
--- /dev/null
+++ b/gcc/config/rx/elf.opt
@@ -0,0 +1,44 @@ 
+; Command line options for the Renesas RX port of GCC.
+; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+; Contributed by Red Hat.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+;---------------------------------------------------
+
+; elf target extra options
+
+msim
+Target
+Use the simulator runtime.
+
+;---------------------------------------------------
+
+mas100-syntax
+Target Mask(AS100_SYNTAX) Report
+Generate assembler output that is compatible with the Renesas AS100 assembler.  This may restrict some of the compiler's capabilities.  The default is to generate GAS compatable syntax.
+
+;---------------------------------------------------
+
+mint-register=
+Target RejectNegative Joined UInteger Var(rx_interrupt_registers) Init(0)
+Specifies the number of registers to reserve for interrupt handlers.
+
+;---------------------------------------------------
+
+msave-acc-in-interrupts
+Target Mask(SAVE_ACC_REGISTER)
+Specifies whether interrupt functions should save and restore the accumulator register.
diff --git a/gcc/config/rx/linux.h b/gcc/config/rx/linux.h
new file mode 100644
index 00000000000..5466f41b8f5
--- /dev/null
+++ b/gcc/config/rx/linux.h
@@ -0,0 +1,231 @@ 
+/* GCC backend definitions for the rx-linux
+   Copyright (C) 2019 Yoshinori Sato
+   Based on rx.h
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3, or (at your
+   option) any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+
+#include "config/rx/rx.h"
+
+#undef TARGET_CPU_CPP_BUILTINS
+#define TARGET_CPU_CPP_BUILTINS()               \
+  do                                            \
+    {                                           \
+      builtin_define ("__RX__"); 		\
+      builtin_assert ("cpu=RX"); 		\
+      if (rx_cpu_type == RX610)			\
+        builtin_assert ("machine=RX610");	\
+     else					\
+        builtin_assert ("machine=RX600");	\
+      						\
+      if (TARGET_BIG_ENDIAN_DATA)		\
+	builtin_define ("__RX_BIG_ENDIAN__");	\
+      else					\
+	builtin_define ("__RX_LITTLE_ENDIAN__");\
+						\
+      if (TARGET_64BIT_DOUBLES)			\
+	builtin_define ("__RX_64BIT_DOUBLES__");\
+      else					\
+	builtin_define ("__RX_32BIT_DOUBLES__");\
+      						\
+      if (ALLOW_RX_FPU_INSNS)			\
+	builtin_define ("__RX_FPU_INSNS__");	\
+						\
+    }                                           \
+  while (0)
+
+#undef  CC1_SPEC
+#define CC1_SPEC "\
+  %{mcpu=rx200:%{fpu:%erx200 cpu does not have FPU hardware}}"
+
+#undef  ASM_SPEC
+#define ASM_SPEC "\
+%{mbig-endian-data:-mbig-endian-data} \
+%{m64bit-doubles:-m64bit-doubles} \
+%{!m64bit-doubles:-m32bit-doubles} \
+%{msmall-data-limit*:-msmall-data-limit} \
+%{mrelax:-relax} \
+"
+
+#undef DATA_SECTION_ASM_OP
+#define DATA_SECTION_ASM_OP	      			\
+   "\t.section .data,\"aw\",@progbits\n\t.p2align 2"
+
+#undef SDATA_SECTION_ASM_OP
+#define SDATA_SECTION_ASM_OP	      			\
+   "\t.section .data2,\"aw\",@progbits\n\t.p2align 1"
+
+#undef  READONLY_DATA_SECTION_ASM_OP
+#define READONLY_DATA_SECTION_ASM_OP  			\
+   "\t.section .rodata,\"a\",@progbits\n\t.p2align 2"
+
+#undef BSS_SECTION_ASM_OP
+#define BSS_SECTION_ASM_OP	      			\
+   "\t.section .bss\n\t.p2align 2"
+
+#undef SBSS_SECTION_ASM_OP
+#define SBSS_SECTION_ASM_OP	      			\
+   "\t.section .bss2\n\t.p2align 1"
+
+/* The following definitions are conditional depending upon whether the
+   compiler is being built or crtstuff.c is being compiled by the built
+   compiler.  */
+#undef TEXT_SECTION_ASM_OP
+#define TEXT_SECTION_ASM_OP	      \
+  "\t.section .text,\"ax\""
+#undef CTORS_SECTION_ASM_OP
+#define CTORS_SECTION_ASM_OP	      \
+  "\t.section\t.init_array,\"aw\",@init_array"
+#undef DTORS_SECTION_ASM_OP
+#define DTORS_SECTION_ASM_OP	      \
+  "\t.section\t.fini_array,\"aw\",@fini_array"
+#undef INIT_ARRAY_SECTION_ASM_OP
+#define INIT_ARRAY_SECTION_ASM_OP   \
+  "\t.section\t.init_array,\"aw\",@init_array"
+#undef FINI_ARRAY_SECTION_ASM_OP
+#define FINI_ARRAY_SECTION_ASM_OP   \
+  "\t.section\t.fini_array,\"aw\",@fini_array"
+
+#undef GLOBAL_ASM_OP
+#define GLOBAL_ASM_OP		"\t.global\t"
+#undef  USER_LABEL_PREFIX
+
+#undef ASM_OUTPUT_ALIGN
+#define ASM_OUTPUT_ALIGN(STREAM, LOG)		\
+  do						\
+    {						\
+      if ((LOG) == 0)				\
+        break;					\
+      fprintf (STREAM, "\t.balign %d\n", 1 << (LOG));	\
+    }						\
+  while (0)
+
+#undef ASM_OUTPUT_ADDR_VEC_ELT
+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
+  fprintf (FILE, "\t.long .L%d\n", VALUE)
+
+/* This is how to output an element of a case-vector that is relative.
+   Note: The local label referenced by the "1b" below is emitted by
+   the tablejump insn.  */
+
+#undef ASM_OUTPUT_ADDR_DIFF_ELT
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+  fprintf (FILE, "\t.long .L%d - 1b\n", VALUE)
+
+#undef ASM_OUTPUT_SIZE_DIRECTIVE
+#define ASM_OUTPUT_SIZE_DIRECTIVE(STREAM, NAME, SIZE)			\
+  do									\
+    {									\
+      HOST_WIDE_INT size_ = (SIZE);					\
+									\
+      fputs (SIZE_ASM_OP, STREAM);					\
+      assemble_name (STREAM, NAME);					\
+      fprintf (STREAM, ", " HOST_WIDE_INT_PRINT_DEC "\n", size_);	\
+    }									\
+  while (0)
+
+#undef ASM_OUTPUT_MEASURED_SIZE
+#define ASM_OUTPUT_MEASURED_SIZE(STREAM, NAME)				\
+  do									\
+    {									\
+      fputs (SIZE_ASM_OP, STREAM);					\
+      assemble_name (STREAM, NAME);					\
+      fputs (", .-", STREAM);						\
+      assemble_name (STREAM, NAME);					\
+      putc ('\n', STREAM);						\
+    }									\
+  while (0)
+
+#undef ASM_OUTPUT_TYPE_DIRECTIVE
+#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)			\
+  do									\
+    {									\
+      fputs (TYPE_ASM_OP, STREAM);					\
+      assemble_name (STREAM, NAME);					\
+      fputs (", ", STREAM);						\
+      fprintf (STREAM, TYPE_OPERAND_FMT, TYPE);				\
+      putc ('\n', STREAM);						\
+    }									\
+  while (0)
+
+#undef  ASM_GENERATE_INTERNAL_LABEL
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)		\
+  do								\
+    {								\
+      sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM));			\
+    }								\
+  while (0)
+
+#undef  ASM_OUTPUT_EXTERNAL
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)			\
+  do								\
+    {								\
+      default_elf_asm_output_external (FILE, DECL, NAME);	\
+    }								\
+  while (0)
+
+#undef  ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
+  do									\
+    {									\
+      fprintf ((FILE), "%s", COMMON_ASM_OP);				\
+      assemble_name ((FILE), (NAME));					\
+      fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n",	\
+	       (SIZE), (ALIGN) / BITS_PER_UNIT);			\
+    }									\
+  while (0)
+
+#undef  SKIP_ASM_OP
+#define SKIP_ASM_OP   "\t.zero\t"
+
+#undef  ASM_OUTPUT_LIMITED_STRING
+#define ASM_OUTPUT_LIMITED_STRING(FILE, STR)		\
+  do							\
+    {							\
+      const unsigned char *_limited_str =		\
+	(const unsigned char *) (STR);			\
+      unsigned ch;					\
+							\
+      fprintf ((FILE), "\t.string\t\"");		\
+							\
+      for (; (ch = *_limited_str); _limited_str++)	\
+        {						\
+	  int escape;					\
+							\
+	  switch (escape = ESCAPES[ch])			\
+	    {						\
+	    case 0:					\
+	      putc (ch, (FILE));			\
+	      break;					\
+	    case 1:					\
+	      fprintf ((FILE), "\\%03o", ch);		\
+	      break;					\
+	    default:					\
+	      putc ('\\', (FILE));			\
+	      putc (escape, (FILE));			\
+	      break;					\
+	    }						\
+        }						\
+							\
+      fprintf ((FILE), "\"\n");				\
+    }							\
+  while (0)
+
+#undef  PREFERRED_DEBUGGING_TYPE
+
+#undef TARGET_AS100_SYNTAX
+#define TARGET_AS100_SYNTAX 0
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index f70e8f34004..0695f3b6538 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -1438,10 +1438,14 @@  bit_count (unsigned int x)
   return (x + (x >> 16)) & 0x3f;
 }
 
+#if defined(TARGET_SAVE_ACC_REGISTER)
 #define MUST_SAVE_ACC_REGISTER			\
   (TARGET_SAVE_ACC_REGISTER			\
    && (is_interrupt_func (NULL_TREE)		\
        || is_fast_interrupt_func (NULL_TREE)))
+#else
+#define MUST_SAVE_ACC_REGISTER 0
+#endif
 
 /* Returns either the lowest numbered and highest numbered registers that
    occupy the call-saved area of the stack frame, if the registers are
diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h
index b50b48f8afb..672e087cd13 100644
--- a/gcc/config/rx/rx.h
+++ b/gcc/config/rx/rx.h
@@ -408,7 +408,9 @@  typedef unsigned int CUMULATIVE_ARGS;
 #define GLOBAL_ASM_OP 		\
   (TARGET_AS100_SYNTAX ? "\t.GLB\t" : "\t.global\t")
 #define ASM_COMMENT_START	" ;"
+#undef ASM_APP_ON
 #define ASM_APP_ON		""
+#undef ASM_APP_OFF
 #define ASM_APP_OFF 		""
 #define LOCAL_LABEL_PREFIX	"L"
 #undef  USER_LABEL_PREFIX
diff --git a/gcc/config/rx/rx.opt b/gcc/config/rx/rx.opt
index 50814a17a75..4e80c860e43 100644
--- a/gcc/config/rx/rx.opt
+++ b/gcc/config/rx/rx.opt
@@ -82,18 +82,6 @@  Maximum size of global and static variables which can be placed into the small d
 
 ;---------------------------------------------------
 
-msim
-Target
-Use the simulator runtime.
-
-;---------------------------------------------------
-
-mas100-syntax
-Target Mask(AS100_SYNTAX) Report
-Generate assembler output that is compatible with the Renesas AS100 assembler.  This may restrict some of the compiler's capabilities.  The default is to generate GAS compatible syntax.
-
-;---------------------------------------------------
-
 mrelax
 Target
 Enable linker relaxation.
diff --git a/gcc/config/rx/t-linux b/gcc/config/rx/t-linux
new file mode 100644
index 00000000000..0975b2690dc
--- /dev/null
+++ b/gcc/config/rx/t-linux
@@ -0,0 +1,34 @@ 
+# Makefile fragment for building GCC for the rx-linux.
+# Copyright (C) 2019 Yoshinori Sato
+# Based on t-rx
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 3, or (at your
+# option) any later version.
+#
+# GCC is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the  GNU General Public
+# License along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Enable multilibs:
+
+MULTILIB_OPTIONS    =
+MULTILIB_DIRNAMES   =
+
+MULTILIB_MATCHES    = nofpu=mnofpu  nofpu=mcpu?rx200  nofpu=mcpu?RX200
+
+MULTILIB_EXCEPTIONS =
+MULTILIB_EXTRA_OPTS =
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
diff --git a/libgcc/config.host b/libgcc/config.host
index 91fed5fa473..ff2f0fa1e58 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1211,6 +1211,9 @@  rx-*-elf)
 	tmake_file="rx/t-rx t-fdpbit"
 	tm_file="$tm_file rx/rx-abi.h rx/rx-lib.h"
 	;;
+rx-*-linux*)
+	tmake_file="rx/t-rx"
+	;;
 s390-*-linux*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux s390/32/t-floattodi t-stack s390/t-stack-s390"
 	md_unwind_header=s390/linux-unwind.h
diff --git a/libgcc/config/rx/t-rx b/libgcc/config/rx/t-rx
index ace3b16f39e..34cdc97cc03 100644
--- a/libgcc/config/rx/t-rx
+++ b/libgcc/config/rx/t-rx
@@ -23,6 +23,7 @@ 
 # the normal libgcc sources:
 
 LIB2ADD = $(srcdir)/config/rx/rx-abi-functions.c
+HOST_LIBGCC2_CFLAGS += -DDF=SF
 
 
 # We need special handling of the floating point conversion