public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ld: Add rx-linux emulation.
@ 2020-04-29 12:47 Yoshinori Sato
  2020-04-29 12:47 ` [PATCH] gas: Change ELF flags initial value in rx-linux Yoshinori Sato
  2020-04-30 12:37 ` [PATCH] ld: Add rx-linux emulation Nick Clifton
  0 siblings, 2 replies; 4+ messages in thread
From: Yoshinori Sato @ 2020-04-29 12:47 UTC (permalink / raw)
  To: binutils

The rx-linux target needs to behave differently than rx-elf.
Add an emulation for that.

ld/ChangeLog
2020-04-25  Yoshinori Sato <ysato@users.sourceforge.jp>

	* emulparams/elf32rx_linux.sh: New rx-linux emulation.
	* emultempl/rxlinux.em: New.
	* configure.tgt: Add rx-linux.
	* Makefile.am: Add eelf32rx_linux.c
	* Makefile.in: Regenerate.
---
 ld/Makefile.am                 |  2 ++
 ld/Makefile.in                 |  2 ++
 ld/configure.tgt               |  2 ++
 ld/emulparams/elf32rx_linux.sh | 17 ++++++++++++++
 ld/emultempl/rxlinux.em        | 42 ++++++++++++++++++++++++++++++++++
 5 files changed, 65 insertions(+)
 create mode 100644 ld/emulparams/elf32rx_linux.sh
 create mode 100644 ld/emultempl/rxlinux.em

diff --git a/ld/Makefile.am b/ld/Makefile.am
index a64899fc09..e3ef6865c0 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -277,6 +277,7 @@ ALL_EMULATION_SOURCES = \
 	eelf32lriscv_ilp32.c \
 	eelf32rl78.c \
 	eelf32rx.c \
+	eelf32rx_linux.c \
 	eelf32tilegx.c \
 	eelf32tilegx_be.c \
 	eelf32tilepro.c \
@@ -766,6 +767,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lriscv_ilp32.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rl78.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rx.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rx_linux.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32tilegx.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32tilegx_be.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32tilepro.Pc@am__quote@
diff --git a/ld/Makefile.in b/ld/Makefile.in
index b34455b1f8..51fdd964cc 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -767,6 +767,7 @@ ALL_EMULATION_SOURCES = \
 	eelf32lriscv_ilp32.c \
 	eelf32rl78.c \
 	eelf32rx.c \
+	eelf32rx_linux.c \
 	eelf32tilegx.c \
 	eelf32tilegx_be.c \
 	eelf32tilepro.c \
@@ -1346,6 +1347,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppcwindiss.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rl78.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rx_linux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32tilegx.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32tilegx_be.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32tilepro.Po@am__quote@
diff --git a/ld/configure.tgt b/ld/configure.tgt
index ced5d1f992..0b6ee8bc87 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -775,6 +775,8 @@ rs6000-*-aix*)		targ_emul=aixrs6
 			;;
 rl78-*-*)		targ_emul=elf32rl78
 			;;
+rx-*-linux*)		targ_emul=elf32rx_linux
+			;;
 rx-*-*)			targ_emul=elf32rx
 			;;
 s12z-*-*)		targ_emul=m9s12zelf
diff --git a/ld/emulparams/elf32rx_linux.sh b/ld/emulparams/elf32rx_linux.sh
new file mode 100644
index 0000000000..3abe4165d5
--- /dev/null
+++ b/ld/emulparams/elf32rx_linux.sh
@@ -0,0 +1,17 @@
+MACHINE=
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-rx-linux"
+# See also `include/elf/rx.h'
+TEXT_START_ADDR=0x10000000
+ARCH=rx
+ENTRY=start
+EMBEDDED=yes
+TEMPLATE_NAME=elf
+EXTRA_EM_FILE=rxlinux
+ELFSIZE=32
+MAXPAGESIZE=256
+
+STACK_ADDR="(DEFINED(__stack) ? __stack : 0xbffffffc)"
+STACK_SENTINEL="LONG(0xdeaddead)"
+# We do not need .stack for shared library.
+test -n "$CREATE_SHLIB" && unset STACK_ADDR
diff --git a/ld/emultempl/rxlinux.em b/ld/emultempl/rxlinux.em
new file mode 100644
index 0000000000..ee036a17dd
--- /dev/null
+++ b/ld/emultempl/rxlinux.em
@@ -0,0 +1,42 @@
+# This shell script emits a C file. -*- C -*-
+#   Copyright (C) 2020 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# This file is sourced from elf.em, and defines extra rx-elf
+# specific routines.
+#
+test -z "$TARGET2_TYPE" && TARGET2_TYPE="rel"
+fragment <<EOF
+
+#include "elf32-rx.h"
+
+/* This is a convenient point to tell BFD about target specific flags.
+   After the output has been created, but before inputs are read.  */
+static void
+rx_linux_create_output_section_statements (void)
+{
+  extern void bfd_elf32_rx_set_target_flags (bfd_boolean, bfd_boolean);
+
+  bfd_elf32_rx_set_target_flags (FALSE, FALSE);
+}
+
+EOF
+LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=rx_linux_create_output_section_statements
+
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] gas: Change ELF flags initial value in rx-linux
  2020-04-29 12:47 [PATCH] ld: Add rx-linux emulation Yoshinori Sato
@ 2020-04-29 12:47 ` Yoshinori Sato
  2020-04-30 12:37   ` Nick Clifton
  2020-04-30 12:37 ` [PATCH] ld: Add rx-linux emulation Nick Clifton
  1 sibling, 1 reply; 4+ messages in thread
From: Yoshinori Sato @ 2020-04-29 12:47 UTC (permalink / raw)
  To: binutils

rx-linux uses the common GCC ABI.
Setting RX ABI in ELF flags is wrong.
For rx-linux, change to generate GCC ABI objects.

gas/ChangeLog
2020-04-27  Yoshinori Sato <ysato@users.sourceforge.jp>

	* config/tc-rx.c (elf_flags): Reset default value.
	(md_parse_option): For rx-elf Initialize elf_flags with RX_ABI.
---
 gas/config/tc-rx.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index febdb5ab95..e3521d3193 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -42,12 +42,13 @@ const char EXP_CHARS[]            = "eE";
 const char FLT_CHARS[]            = "dD";
 \f
 /* ELF flags to set in the output file header.  */
-static int elf_flags = E_FLAG_RX_ABI;
+static int elf_flags;
 
 #ifndef TE_LINUX
 bfd_boolean rx_use_conventional_section_names = FALSE;
 #else
 bfd_boolean rx_use_conventional_section_names = TRUE;
+static int elf_flags;
 #endif
 static bfd_boolean rx_use_small_data_limit = FALSE;
 
@@ -129,6 +130,9 @@ struct cpu_type  cpu_type_list[] =
 int
 md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg ATTRIBUTE_UNUSED)
 {
+#ifndef TE_LINUX
+  elf_flags = E_FLAG_RX_ABI;
+#endif
   switch (c)
     {
     case OPTION_BIG:
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ld: Add rx-linux emulation.
  2020-04-29 12:47 [PATCH] ld: Add rx-linux emulation Yoshinori Sato
  2020-04-29 12:47 ` [PATCH] gas: Change ELF flags initial value in rx-linux Yoshinori Sato
@ 2020-04-30 12:37 ` Nick Clifton
  1 sibling, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2020-04-30 12:37 UTC (permalink / raw)
  To: Yoshinori Sato, binutils

Hi Yoshinori,

> ld/ChangeLog
> 2020-04-25  Yoshinori Sato <ysato@users.sourceforge.jp>
> 
> 	* emulparams/elf32rx_linux.sh: New rx-linux emulation.
> 	* emultempl/rxlinux.em: New.
> 	* configure.tgt: Add rx-linux.
> 	* Makefile.am: Add eelf32rx_linux.c
> 	* Makefile.in: Regenerate.

Approved and applied.

Cheers
  Nick


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gas: Change ELF flags initial value in rx-linux
  2020-04-29 12:47 ` [PATCH] gas: Change ELF flags initial value in rx-linux Yoshinori Sato
@ 2020-04-30 12:37   ` Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2020-04-30 12:37 UTC (permalink / raw)
  To: Yoshinori Sato, binutils

Hi Yoshinori,

> gas/ChangeLog
> 2020-04-27  Yoshinori Sato <ysato@users.sourceforge.jp>
> 
> 	* config/tc-rx.c (elf_flags): Reset default value.
> 	(md_parse_option): For rx-elf Initialize elf_flags with RX_ABI.

Approved and applied.

Cheers
  Nick


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-30 12:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 12:47 [PATCH] ld: Add rx-linux emulation Yoshinori Sato
2020-04-29 12:47 ` [PATCH] gas: Change ELF flags initial value in rx-linux Yoshinori Sato
2020-04-30 12:37   ` Nick Clifton
2020-04-30 12:37 ` [PATCH] ld: Add rx-linux emulation Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).