gas misbehavior in binutils-2.16.1 for sh4 target and --enable-shared

Kaz Kojima kkojima@rr.iij4u.or.jp
Thu Aug 25 05:13:00 GMT 2005


Mike Frysinger <vapier@gentoo.org> wrote:
> binutils-2.16.1 with --enabled-shared:
> test.o: ELF 32-bit LSB relocatable, Hitachi SH, version 1 (SYSV), not stripped
> Flags: 0x19, unknown ISA

It's caused by an off-by-one error.  Thanks for catching it.
sh_elf_get_flags_from_mach looks up a value in a table starting with
the wrong index.  I've committed the attached patch.  

Regards,
	kaz
--
2005-08-25  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* elf32-sh.c (sh_elf_get_flags_from_mach): Fix off-by-one error.

--- ORIG/src/bfd/elf32-sh.c	2005-08-25 11:59:27.000000000 +0900
+++ LOCAL/src/bfd/elf32-sh.c	2005-08-25 12:05:33.000000000 +0900
@@ -6655,7 +6655,7 @@ sh_elf_set_mach_from_flags (bfd *abfd)
 int
 sh_elf_get_flags_from_mach (unsigned long mach)
 {
-  int i = ARRAY_SIZE (sh_ef_bfd_table);
+  int i = ARRAY_SIZE (sh_ef_bfd_table) - 1;
   
   for (; i>0; i--)
     if (sh_ef_bfd_table[i] == mach)



More information about the Binutils mailing list