This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: Allow SB1 and MIPS32 modules to be linked together


I noticed recently that bfd refuses to link MIPS32 modules with
32-bit SB1 modules.  This patch fixes it.  It also teaches bfd
that MIPS64r2 extends both MIPS64 and MIPS32r2.

At the moment, mips_mach_extensions says that:

   bfd_mach_mipsisa64r2 extends bfd_mach_mipsisa64
   bfd_mach_mipsisa64 extends bfd_mach_mips5

The code that reads mips_mach_extensions assumes that an architecture
is listed in at most one "extension" field, and is able to use a linear
loop as a result.  I didn't want to change that and make the function
potentially quadratic.  I therefore just handled the MIPS64->MIPS32
and MIPS64r2 -> MIPS32r2 as special cases.

OK to install?

Richard


bfd/
	* elfxx-mips.c (mips_mach_extends_p): Treat MIPS64 as an extension
	of MIPS32 and MIPS64r2 as an extension of MIPS32r2.

ld/testsuite/
	* ld-mips/mips-elf-flags.exp: Add more good_combination tests.

Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.147
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.147 elfxx-mips.c
*** bfd/elfxx-mips.c 29 Jul 2005 23:24:01 -0000 1.147
--- bfd/elfxx-mips.c 31 Jul 2005 09:41:54 -0000
*************** mips_mach_extends_p (unsigned long base,
*** 9661,9671 ****
  {
    size_t i;
  
!   for (i = 0; extension != base && i < ARRAY_SIZE (mips_mach_extensions); i++)
      if (extension == mips_mach_extensions[i].extension)
!       extension = mips_mach_extensions[i].base;
  
!   return extension == base;
  }
  
  
--- 9649,9674 ----
  {
    size_t i;
  
!   if (extension == base)
!     return TRUE;
! 
!   if (base == bfd_mach_mipsisa32
!       && mips_mach_extends_p (bfd_mach_mipsisa64, extension))
!     return TRUE;
! 
!   if (base == bfd_mach_mipsisa32r2
!       && mips_mach_extends_p (bfd_mach_mipsisa64r2, extension))
!     return TRUE;
! 
!   for (i = 0; i < ARRAY_SIZE (mips_mach_extensions); i++)
      if (extension == mips_mach_extensions[i].extension)
!       {
! 	extension = mips_mach_extensions[i].base;
! 	if (extension == base)
! 	  return TRUE;
!       }
  
!   return FALSE;
  }
  
  
Index: ld/testsuite/ld-mips-elf/mips-elf-flags.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/mips-elf-flags.exp,v
retrieving revision 1.6
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.6 mips-elf-flags.exp
*** ld/testsuite/ld-mips-elf/mips-elf-flags.exp 12 May 2005 07:32:07 -0000 1.6
--- ld/testsuite/ld-mips-elf/mips-elf-flags.exp 31 Jul 2005 09:41:54 -0000
*************** good_combination { "-mips3 -32" "-mips64
*** 158,160 ****
--- 158,163 ----
  
  good_combination { "-march=vr4120 -mabi=32" "-mips3 -mabi=32" } { 4120 o32 }
  good_combination { "-march=sb1 -mgp32 -32" "-march=4000 -mgp32 -32" } { sb1 o32 }
+ good_combination { "-mips32 -mabi=32" "-march=sb1 -mabi=32" } { sb1 o32 }
+ good_combination { "-mips64r2 -mabi=32" "-mips32 -mabi=32" } { mips64r2 o32 }
+ good_combination { "-mips5 -mabi=o64" "-mips64r2 -mabi=o64" } { mips64r2 o64 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]