From 4046d87a365240eed765f315f37b9bb64f208892 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 9 Aug 2013 10:40:04 +0000 Subject: [PATCH] * 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. * 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. --- bfd/ChangeLog | 6 ++++++ bfd/elf32-rl78.c | 25 +++++++++++++++++++++++-- binutils/ChangeLog | 4 ++++ binutils/readelf.c | 5 +++++ gas/ChangeLog | 10 ++++++++++ gas/config/tc-rl78.c | 18 ++++++++++++++++-- gas/config/tc-rl78.h | 6 ++++-- gas/doc/c-rl78.texi | 14 ++++++++++---- include/elf/ChangeLog | 4 ++++ include/elf/rl78.h | 5 +++-- ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/lib/ld-lib.exp | 1 + 12 files changed, 91 insertions(+), 12 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 47e2e215cf1..ccbc820909f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2013-08-09 Nick Clifton + + * 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 * po/BLD-POTFILES.in: Regenerate. diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index 651a8bdce69..d18cc184ded 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -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; } diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 802d9f18317..bd8acb30630 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2013-08-09 Nick Clifton + + * readelf.c (get_machine_flags): Handle RL78 G10 flag. + 2013-07-26 Sergey Guriev Alexander Ivchenko Maxim Kuznetsov diff --git a/binutils/readelf.c b/binutils/readelf.c index b6c2a39cc30..2dd1d8bef2e 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -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"); diff --git a/gas/ChangeLog b/gas/ChangeLog index d51874f00d5..329d7425dd3 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2013-08-09 Nick Clifton + + * 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 * config/tc-mips.c (match_vu0_suffix_operand): Allow single-channel diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index 77a19bb5077..651f3f6790a 100644 --- a/gas/config/tc-rl78.c +++ b/gas/config/tc-rl78.c @@ -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) diff --git a/gas/config/tc-rl78.h b/gas/config/tc-rl78.h index b3ac383b2b6..67f12c961a5 100644 --- a/gas/config/tc-rl78.h +++ b/gas/config/tc-rl78.h @@ -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); diff --git a/gas/doc/c-rl78.texi b/gas/doc/c-rl78.texi index 44ede4710cc..0964ac45699 100644 --- a/gas/doc/c-rl78.texi +++ b/gas/doc/c-rl78.texi @@ -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 @@ -25,8 +24,15 @@ @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 diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 8445e61bf49..2b694825295 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,7 @@ +2013-08-09 Nick Clifton + + * rl78.c (E_FLAG_RL78_G10): Define. + 2013-07-15 Maciej W. Rozycki * mips.h (Tag_GNU_MIPS_ABI_FP): Remove comment. diff --git a/include/elf/rl78.h b/include/elf/rl78.h index 82959e14980..b281d3af6dc 100644 --- a/include/elf/rl78.h +++ b/include/elf/rl78.h @@ -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). */ diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index d3ab790ac1a..902e8902253 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-09 Nick Clifton + + * lib/ld-lib.exp (check_shared_lib_support): Note that the RL78 + does not support shared library generation. + 2013-07-31 John Tytgat PR ld/15787 diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 256d8263c91..64ac7b2598c 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -1595,6 +1595,7 @@ proc check_shared_lib_support { } { && ![istarget openrisc-*-*] && ![istarget or32-*-*] && ![istarget pj-*-*] + && ![istarget rl78-*-*] && ![istarget rx-*-*] && ![istarget spu-*-*] && ![istarget v850*-*-*] -- 2.30.2