]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* elf32-rl78.c (rl78_elf_merge_private_bfd_data): Complain if G10
authorNick Clifton <nickc@redhat.com>
Fri, 9 Aug 2013 10:40:04 +0000 (10:40 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 9 Aug 2013 10:40:04 +0000 (10:40 +0000)
flag bits do not match.
(rl78_elf_print_private_bfd_data): Describe G10 flag.

* readelf.c (get_machine_flags): Handle RL78 G10 flag.

* config/tc-rl78.c (elf_flags): New variable.
(enum options): Add OPTION_G10.
(md_longopts): Add mg10.
(md_parse_option): Parse -mg10.
(rl78_elf_final_processing): New function.
* config/tc-rl78.c (tc_final_processing): Define.
* doc/c-rl78.texi: Document -mg10 option.

* rl78.c (E_FLAG_RL78_G10): Define.

* lib/ld-lib.exp (check_shared_lib_support): Note that the RL78
does not support shared library generation.

12 files changed:
bfd/ChangeLog
bfd/elf32-rl78.c
binutils/ChangeLog
binutils/readelf.c
gas/ChangeLog
gas/config/tc-rl78.c
gas/config/tc-rl78.h
gas/doc/c-rl78.texi
include/elf/ChangeLog
include/elf/rl78.h
ld/testsuite/ChangeLog
ld/testsuite/lib/ld-lib.exp

index 47e2e215cf1e53e65cd99b353d8b9403d8b5f846..ccbc820909fdb50bf3347ed87e720e3cdc624e64 100644 (file)
@@ -1,3 +1,9 @@
+2013-08-09  Nick Clifton  <nickc@redhat.com>
+
+       * elf32-rl78.c (rl78_elf_merge_private_bfd_data): Complain if G10
+       flag bits do not match.
+       (rl78_elf_print_private_bfd_data): Describe G10 flag.
+
 2013-08-05  John Tytgat  <john@bass-software.com>
 
        * po/BLD-POTFILES.in: Regenerate.
index 651a8bdce691a5d5e2e80ed0533bc463ba5c7af4..d18cc184ded0f2f0b9b45b101a0263d38c79f7c5 100644 (file)
@@ -1,6 +1,5 @@
 /* Renesas RL78 specific support for 32-bit ELF.
-   Copyright (C) 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 2011-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -1021,9 +1020,11 @@ static bfd_boolean
 rl78_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
 {
   flagword new_flags;
+  flagword old_flags;
   bfd_boolean error = FALSE;
 
   new_flags = elf_elfheader (ibfd)->e_flags;
+  old_flags = elf_elfheader (obfd)->e_flags;
 
   if (!elf_flags_init (obfd))
     {
@@ -1031,6 +1032,23 @@ rl78_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
       elf_flags_init (obfd) = TRUE;
       elf_elfheader (obfd)->e_flags = new_flags;
     }
+  else if (old_flags != new_flags)
+    {
+      flagword changed_flags = old_flags ^ new_flags;
+
+      if (changed_flags & E_FLAG_RL78_G10)
+       {
+         (*_bfd_error_handler)
+           (_("RL78/G10 ABI conflict: cannot link G10 and non-G10 objects together"));
+
+         if (old_flags & E_FLAG_RL78_G10)
+           (*_bfd_error_handler) (_("- %s is G10, %s is not"),
+                                  bfd_get_filename (obfd), bfd_get_filename (ibfd));
+         else
+           (*_bfd_error_handler) (_("- %s is G10, %s is not"),
+                                  bfd_get_filename (ibfd), bfd_get_filename (obfd));
+       }
+    }
 
   return !error;
 }
@@ -1049,6 +1067,9 @@ rl78_elf_print_private_bfd_data (bfd * abfd, void * ptr)
   flags = elf_elfheader (abfd)->e_flags;
   fprintf (file, _("private flags = 0x%lx:"), (long) flags);
 
+  if (flags & E_FLAG_RL78_G10)
+    fprintf (file, _(" [G10]"));
+
   fputc ('\n', file);
   return TRUE;
 }
index 802d9f1831701727e1c877242b401f46cd0b1ebd..bd8acb3063095c00205a19f4d8636cee809982b4 100644 (file)
@@ -1,3 +1,7 @@
+2013-08-09  Nick Clifton  <nickc@redhat.com>
+
+       * readelf.c (get_machine_flags): Handle RL78 G10 flag.
+
 2013-07-26  Sergey Guriev  <sergey.s.guriev@intel.com>
            Alexander Ivchenko  <alexander.ivchenko@intel.com>
            Maxim Kuznetsov  <maxim.kuznetsov@intel.com>
index b6c2a39cc3010938c26761ca70e128d96dd6c09f..2dd1d8bef2e159234c9e7be4ae877775ed12c250 100644 (file)
@@ -2779,6 +2779,11 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
            strcat (buf, ", G-Float");
          break;
 
+       case EM_RL78:
+         if (e_flags & E_FLAG_RL78_G10)
+           strcat (buf, ", G10");
+         break;
+         
        case EM_RX:
          if (e_flags & E_FLAG_RX_64BIT_DOUBLES)
            strcat (buf, ", 64-bit doubles");
index d51874f00d51a8f52fe01b2c188f43c84c3602cb..329d7425dd3c5c848b9b4eb724604024aa70a296 100644 (file)
@@ -1,3 +1,13 @@
+2013-08-09  Nick Clifton  <nickc@redhat.com>
+
+       * config/tc-rl78.c (elf_flags): New variable.
+       (enum options): Add OPTION_G10.
+       (md_longopts): Add mg10.
+       (md_parse_option): Parse -mg10.
+       (rl78_elf_final_processing): New function.
+       * config/tc-rl78.c (tc_final_processing): Define.
+       * doc/c-rl78.texi: Document -mg10 option.
+
 2013-08-06  Jürgen Urban  <JuergenUrban@gmx.de>
 
        * config/tc-mips.c (match_vu0_suffix_operand): Allow single-channel
index 77a19bb50771227f2077647a260ddb9abcdfb9b4..651f3f6790a2d60f592ea83397faed051e300825 100644 (file)
@@ -1,6 +1,5 @@
 /* tc-rl78.c -- Assembler for the Renesas RL78
-   Copyright 2011
-   Free Software Foundation, Inc.
+   Copyright 2011-2013 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -45,6 +44,9 @@ const char line_separator_chars[] = "@";
 const char EXP_CHARS[]            = "eE";
 const char FLT_CHARS[]            = "dD";
 
+/* ELF flags to set in the output file header.  */
+static int elf_flags = 0;
+
 /*------------------------------------------------------------------*/
 
 char * rl78_lex_start;
@@ -260,6 +262,7 @@ rl78_field (int val, int pos, int sz)
 enum options
 {
   OPTION_RELAX = OPTION_MD_BASE,
+  OPTION_G10,
 };
 
 #define RL78_SHORTOPTS ""
@@ -269,6 +272,7 @@ const char * md_shortopts = RL78_SHORTOPTS;
 struct option md_longopts[] =
 {
   {"relax", no_argument, NULL, OPTION_RELAX},
+  {"mg10", no_argument, NULL, OPTION_G10},
   {NULL, no_argument, NULL, 0}
 };
 size_t md_longopts_size = sizeof (md_longopts);
@@ -282,6 +286,9 @@ md_parse_option (int c, char * arg ATTRIBUTE_UNUSED)
       linkrelax = 1;
       return 1;
 
+    case OPTION_G10:
+      elf_flags |= E_FLAG_RL78_G10;
+      return 1;
     }
   return 0;
 }
@@ -326,6 +333,13 @@ rl78_md_end (void)
 {
 }
 
+/* Set the ELF specific flags.  */
+void
+rl78_elf_final_processing (void)
+{
+  elf_elfheader (stdoutput)->e_flags |= elf_flags;
+}
+
 /* Write a value out to the object file, using the appropriate endianness.  */
 void
 md_number_to_chars (char * buf, valueT val, int n)
index b3ac383b2b60cbae950f0133d41a1009fcadcfaf..67f12c961a5dbe7857c26f242e73bfee1bbfb28b 100644 (file)
@@ -1,6 +1,5 @@
 /* tc-rl78.h - header file for Renesas RL78
-   Copyright 2011
-   Free Software Foundation, Inc.
+   Copyright 2011-2013 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -77,3 +76,6 @@ extern void rl78_cons_fix_new (fragS *, int, int, expressionS *);
 #define MAX_MEM_FOR_RS_ALIGN_CODE 8
 #define HANDLE_ALIGN(FRAG) rl78_handle_align (FRAG)
 extern void rl78_handle_align (fragS *);
+
+#define elf_tc_final_processing        rl78_elf_final_processing
+extern void rl78_elf_final_processing (void);
index 44ede4710cc090ba5041528b4917c4e9c2980be1..0964ac456994cef127e7d1fa6768d35483de9a06 100644 (file)
@@ -1,5 +1,4 @@
-@c Copyright 2011
-@c Free Software Foundation, Inc.
+@c Copyright 2011-2013 Free Software Foundation, Inc.
 @c This is part of the GAS manual.
 @c For copying conditions, see the file as.texinfo.
 @ifset GENERIC
 @cindex options, RL78
 @cindex RL78 options
 
-The Renesas RL78 port of @code{@value{AS}} has no target-specific
-options.
+@table @code
+@item relax
+Enable support for link-time relaxation.
+
+@item mg10
+Mark the generated binary as targeting the G10 variant of the RL78
+architecture.
+
+@end table
 
 @node RL78-Modifiers
 @section Symbolic Operand Modifiers
index 8445e61bf49593ab8925b68781ac54d8f5235769..2b694825295fa6924c002e8443b17e86015dfa42 100644 (file)
@@ -1,3 +1,7 @@
+2013-08-09  Nick Clifton  <nickc@redhat.com>
+
+       * rl78.c (E_FLAG_RL78_G10): Define.
+
 2013-07-15  Maciej W. Rozycki  <macro@codesourcery.com>
 
        * mips.h (Tag_GNU_MIPS_ABI_FP): Remove comment.
index 82959e14980cee08db906336e4bc0c49975fdfa5..b281d3af6dc3cb0448e63d63bb85d726f4fb600e 100644 (file)
@@ -1,5 +1,5 @@
 /* RL78 ELF support for BFD.
-   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2008-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -104,8 +104,9 @@ END_RELOC_NUMBERS (R_RL78_max)
 #define EF_RL78_ALL_FLAGS      (EF_RL78_CPU_MASK)
 
 /* Values for the e_flags field in the ELF header.  */
-#define E_FLAG_RL78_64BIT_DOUBLES              (1 << 0)
+#define E_FLAG_RL78_64BIT_DOUBLES      (1 << 0)
 #define E_FLAG_RL78_DSP                        (1 << 1) /* Defined in the RL78 CPU Object file specification, but not explained.  */
+#define E_FLAG_RL78_G10                        (1 << 2) /* CPU is missing register banks 1-3, so uses different ABI.  */
 
 /* These define the addend field of R_RL78_RH_RELAX relocations.  */
 #define        RL78_RELAXA_BRA         0x00000010      /* Any type of branch (must be decoded).  */
index d3ab790ac1ae9b0cce3d74811ad518a1293b2ad7..902e8902253e1d9136729b93bbc5ee3556bb69a1 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-09  Nick Clifton  <nickc@redhat.com>
+
+       * lib/ld-lib.exp (check_shared_lib_support): Note that the RL78
+       does not support shared library generation.
+
 2013-07-31  John Tytgat  <john@bass-software.com>
 
        PR ld/15787
index 256d8263c916879d67e668a8890217ad8cec06c3..64ac7b2598cb11566cb21f573ccd773367597152 100644 (file)
@@ -1595,6 +1595,7 @@ proc check_shared_lib_support { } {
         && ![istarget openrisc-*-*]
         && ![istarget or32-*-*]
         && ![istarget pj-*-*]
+        && ![istarget rl78-*-*]
         && ![istarget rx-*-*]
         && ![istarget spu-*-*]
         && ![istarget v850*-*-*]