H8: Set H8/300H as the default architecture for H8 family

Message ID 20260709210449.744366-1-jdx@o2.pl
State New
Headers
Series H8: Set H8/300H as the default architecture for H8 family |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed

Commit Message

Jan Dubiec July 9, 2026, 9:04 p.m. UTC
  Binutils, in particular ld and gas, use H8/300 as the default architecture.
On the other hand, support for H8/300 has been removed from gcc since
July 2020 (AFAIR) and H8/300H is the default there. This situation causes
that about 30 test cases fail in the following way:

[...]
Running /mnt/Works/binutils/ld/testsuite/ld-gc/gc.exp ...
h8300-elf-cc  -B/mnt/Works/xcomp/build-binutils-h8300-linux/ld/tmpdir/ld/ -I/mnt/Works/binutils/ld/testsuite/ld-gc -g -O2 -fno-sanitize=all    -c -ffunction-sections -fdata-sections -fno-sanitize=all -fno-lto  -c /mnt/Works/binutils/ld/testsuite/ld-gc/gc.c -o tmpdir/gc.o
Executing on host: sh -c {h8300-elf-cc  -B/mnt/Works/xcomp/build-binutils-h8300-linux/ld/tmpdir/ld/ -I/mnt/Works/binutils/ld/testsuite/ld-gc -g -O2 -fno-sanitize=all    -c -ffunction-sections -fdata-sections -fno-sanitize=all -fno-lto  -c /mnt/Works/binutils/ld/testsuite/ld-gc/gc.c -o tmpdir/gc.o 2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]
./ld-new    -o tmpdir/gcexe -L/mnt/Works/binutils/ld/testsuite/ld-gc --gc-sections -e main --defsym __stack_chk_fail=0 tmpdir/gc.o
Executing on host: sh -c {./ld-new    -o tmpdir/gcexe -L/mnt/Works/binutils/ld/testsuite/ld-gc --gc-sections -e main --defsym __stack_chk_fail=0 tmpdir/gc.o 2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]
/mnt/Works/xcomp/build-binutils-h8300-linux/ld/ld-new: h8300h architecture of input file `tmpdir/gc.o' is incompatible with h8300 output
/mnt/Works/xcomp/build-binutils-h8300-linux/ld/ld-new: h8300h architecture of input file `tmpdir/gc.o' is incompatible with h8300 output

FAIL: Check --gc-section
[...]

This patch sets H8/300H as the default architecture for H8 family.

bfd/ChangeLog:

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

gas/ChangeLog:

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

ld/ChangeLog:

	* configure.tgt: Set H8/300H as the default architecture
	for H8 family.

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

Comments

Jeffrey Law July 10, 2026, 12:53 a.m. UTC | #1
On 7/9/2026 3:04 PM, Jan Dubiec wrote:
> Binutils, in particular ld and gas, use H8/300 as the default architecture.
> On the other hand, support for H8/300 has been removed from gcc since
> July 2020 (AFAIR) and H8/300H is the default there. This situation causes
> that about 30 test cases fail in the following way:
I'm a lot less involved in binutils than I have been in the past, but 
this makes sense to me.  As Jan mentions, we dropped old H8/300 support 
in GCC a while back and default to H8/300H.

Jan, do you have write permissions in the binutils repo?

Jeff
  
Jan Beulich July 10, 2026, 7:04 a.m. UTC | #2
On 10.07.2026 02:53, Jeffrey Law via Binutils wrote:
> On 7/9/2026 3:04 PM, Jan Dubiec wrote:
>> Binutils, in particular ld and gas, use H8/300 as the default architecture.
>> On the other hand, support for H8/300 has been removed from gcc since
>> July 2020 (AFAIR) and H8/300H is the default there. This situation causes
>> that about 30 test cases fail in the following way:
> I'm a lot less involved in binutils than I have been in the past, but 
> this makes sense to me.  As Jan mentions, we dropped old H8/300 support 
> in GCC a while back and default to H8/300H.

Imo NEW entries should be added for both gas/ and ld/.

Jan
  
Jan Dubiec July 10, 2026, 9:47 a.m. UTC | #3
On 10.07.2026 02:53, Jeffrey Law via Binutils wrote:
[...]> Jan, do you have write permissions in the binutils repo?
No, I don't.

/J.D.
  
Jan Dubiec July 10, 2026, 9:47 a.m. UTC | #4
On 10.07.2026 09:04, Jan Beulich wrote:
[...]> Imo NEW entries should be added for both gas/ and ld/.
Do you mean something like this:

  gas/NEWS | 5 +++++
  ld/NEWS  | 5 +++++
  2 files changed, 10 insertions(+)

diff --git a/gas/NEWS b/gas/NEWS
index 38928ab83ff..5f752169f86 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -24,6 +24,11 @@
  * 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. The mismatch between the default architectures
+  used by gcc and gas/ld caused some ld test cases to fail.
+
  Changes in 2.46:

  * Add support for AMD Zen6 processor.
diff --git a/ld/NEWS b/ld/NEWS
index 2de87ae227c..32dc75f9ace 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -15,6 +15,11 @@ 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. The mismatch between the default architectures
+  used by gcc and gas/ld caused some ld test cases to fail.
+
  Changes in 2.46:

  * Add --gnu-tls-tag/--no-gnu-tls-tag options to i386 ELF linker to add


/J.D.
  
Jan Beulich July 10, 2026, 10:04 a.m. UTC | #5
On 10.07.2026 11:47, Jan Dubiec wrote:
> On 10.07.2026 09:04, Jan Beulich wrote:
> [...]> Imo NEW entries should be added for both gas/ and ld/.
> Do you mean something like this:

Almost; I'd ...

>   gas/NEWS | 5 +++++
>   ld/NEWS  | 5 +++++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/gas/NEWS b/gas/NEWS
> index 38928ab83ff..5f752169f86 100644
> --- a/gas/NEWS
> +++ b/gas/NEWS
> @@ -24,6 +24,11 @@
>   * 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. The mismatch between the default architectures
> +  used by gcc and gas/ld caused some ld test cases to fail.

... suggest to omit the last sentence (also from ld/NEWS).

Jan
  
Jan Dubiec July 10, 2026, 10:24 a.m. UTC | #6
On 10.07.2026 12:04, Jan Beulich wrote:
> On 10.07.2026 11:47, Jan Dubiec wrote:
>> On 10.07.2026 09:04, Jan Beulich wrote:
>> [...]> Imo NEW entries should be added for both gas/ and ld/.
>> Do you mean something like this:
> 
> Almost; I'd ...
OK then, I will post a new version of the patch in a few hours.

/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/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/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;