[v2,1/2] H8: Set H8/300H as the default architecture for the H8 family

Message ID 20260710145551.744408-1-jdx@o2.pl
State New
Headers
Series [v2,1/2] H8: Set H8/300H as the default architecture for the H8 family |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 fail Patch failed to apply

Commit Message

Jan Dubiec July 10, 2026, 2:54 p.m. UTC
  This patch sets H8/300H as the default architecture for the H8 family. More
info in the previous thread.

bfd/ChangeLog:

	* cpu-h8300.c: Set H8/300H as the default architecture
	for the H8 family.

gas/ChangeLog:

	* config/tc-h8300.c: Set H8/300H as the default architecture
	for the H8 family.
	* NEWS: Added info about the above change.

ld/ChangeLog:

	* configure.tgt: Set H8/300H as the default architecture
	for the H8 family.
	* NEWS: Added info about the above change.

Signed-off-by: Jan Dubiec <jdx@o2.pl>
---
 bfd/cpu-h8300.c       | 4 ++--
 gas/NEWS              | 4 ++++
 gas/config/tc-h8300.c | 2 +-
 ld/NEWS               | 4 ++++
 ld/configure.tgt      | 4 ++--
 5 files changed, 13 insertions(+), 5 deletions(-)
  

Comments

Alan Modra July 10, 2026, 11:20 p.m. UTC | #1
On Fri, Jul 10, 2026 at 04:54:40PM +0200, Jan Dubiec wrote:
> diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c
> index f2294ad217e..4447417610f 100644
> --- a/bfd/cpu-h8300.c
> +++ b/bfd/cpu-h8300.c
> @@ -134,10 +134,10 @@ static const bfd_arch_info_type h8300s_info_struct =
>    N (32, 32, bfd_mach_h8300s, "h8300s", "h8300s", false, & h8300hn_info_struct);
>  
>  static const bfd_arch_info_type h8300h_info_struct =
> -  N (32, 32, bfd_mach_h8300h, "h8300h", "h8300h", false, &h8300s_info_struct);
> +  N (32, 32, bfd_mach_h8300h, "h8300h", "h8300h", true, &h8300s_info_struct);
>  
>  const bfd_arch_info_type bfd_h8300_arch =
> -  N (16, 16, bfd_mach_h8300, "h8300", "h8300", true, &h8300h_info_struct);
> +  N (16, 16, bfd_mach_h8300, "h8300", "h8300", false, &h8300h_info_struct);
>  
>  /* Pad the given address to 32 bits, converting 16-bit and 24-bit
>     addresses into the values they would have had on a h8s target.  */

A bfd_arch_info_type comment says:
  /* TRUE if this is the default machine for the architecture.
     The default arch should be the first entry for an arch so that
     all the entries for that arch can be accessed via <<next>>.  */
  bool the_default;

According to that, when changing the default you should also rearrange
the "next" pointers.
  
Jan Dubiec July 11, 2026, 12:55 a.m. UTC | #2
On 11.07.2026 01:20, Alan Modra wrote:
[...]

> A bfd_arch_info_type comment says:
>    /* TRUE if this is the default machine for the architecture.
>       The default arch should be the first entry for an arch so that
>       all the entries for that arch can be accessed via <<next>>.  */
>    bool the_default;
> 
> According to that, when changing the default you should also rearrange
> the "next" pointers.
> 
I reordered the list as suggested in the comment and posted a new (v3) 
version of the patch in a separate thread.

/J.D.
  

Patch

diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c
index f2294ad217e..4447417610f 100644
--- a/bfd/cpu-h8300.c
+++ b/bfd/cpu-h8300.c
@@ -134,10 +134,10 @@  static const bfd_arch_info_type h8300s_info_struct =
   N (32, 32, bfd_mach_h8300s, "h8300s", "h8300s", false, & h8300hn_info_struct);
 
 static const bfd_arch_info_type h8300h_info_struct =
-  N (32, 32, bfd_mach_h8300h, "h8300h", "h8300h", false, &h8300s_info_struct);
+  N (32, 32, bfd_mach_h8300h, "h8300h", "h8300h", true, &h8300s_info_struct);
 
 const bfd_arch_info_type bfd_h8300_arch =
-  N (16, 16, bfd_mach_h8300, "h8300", "h8300", true, &h8300h_info_struct);
+  N (16, 16, bfd_mach_h8300, "h8300", "h8300", false, &h8300h_info_struct);
 
 /* Pad the given address to 32 bits, converting 16-bit and 24-bit
    addresses into the values they would have had on a h8s target.  */
diff --git a/gas/NEWS b/gas/NEWS
index 38928ab83ff..1b0d53047bb 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -24,6 +24,10 @@ 
 * Add support for RISC-V vendor extensions:
   SpacemiT: xsmtvdot v1.0, xsmtvdotii v1.0.
 
+* Change the default architecture for H8 family from H8/300 to H8/300H.
+  Support for H8/300 was removed from gcc in 2020, making H8/300H the
+  default architecture.
+
 Changes in 2.46:
 
 * Add support for AMD Zen6 processor.
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index ec5cc4f6e39..8025204bfa1 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -52,7 +52,7 @@  int Smode;
 int Nmode;
 int SXmode;
 
-static int default_mach = bfd_mach_h8300;
+static int default_mach = bfd_mach_h8300h;
 
 #define PSIZE (Hmode && !Nmode ? L_32 : L_16)
 
diff --git a/ld/NEWS b/ld/NEWS
index 2de87ae227c..53394fee430 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -15,6 +15,10 @@  Changes in 2.47:
   not only XCOFF.  On by default and controlled with --no-link-mapless and
   --link-mapless options, also for XCOFF.
 
+* Change the default architecture for H8 family from H8/300 to H8/300H.
+  Support for H8/300 was removed from gcc in 2020, making H8/300H the
+  default architecture.
+
 Changes in 2.46:
 
 * Add --gnu-tls-tag/--no-gnu-tls-tag options to i386 ELF linker to add
diff --git a/ld/configure.tgt b/ld/configure.tgt
index a696e557533..6371177db28 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -313,8 +313,8 @@  ft32-*-*)		targ_emul=elf32ft32
 			targ_extra_ofiles=ldelfgen.o
 			;;
 h8300-*-elf* | h8300-*-rtems*)
-			targ_emul=h8300elf;
-			targ_extra_emuls="h8300helf h8300self h8300hnelf h8300snelf h8300sxelf h8300sxnelf"
+			targ_emul=h8300helf;
+			targ_extra_emuls="h8300self h8300hnelf h8300snelf h8300sxelf h8300sxnelf h8300elf"
 			;;
 h8300-*-linux*)
 			targ_emul=h8300elf_linux;