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]

Merging ELF ASE flags when linking


The patch below was originally posted by cgd last year:

    <http://sources.redhat.com/ml/binutils/2001-11/msg00113.html>

and is needed to link mips16 code with normal-mode code.
It fixes the attached test case and causes no regressions on
mips-elf.  OK to install?

(OK for 2.13.1?)

Richard


[bfd/]
	* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Merge ASE
	use flags into resulting BFD.

[ld/testsuite/]
	* ld-mips-elf/mips16-1.d,
	* ld-mips-elf/mips16-1[ab].s: New test.
	* ld-mips-elf/mips-elf.exp: Run it.

Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.15
diff -c -d -p -r1.15 elfxx-mips.c
*** bfd/elfxx-mips.c	19 Jul 2002 21:34:02 -0000	1.15
--- bfd/elfxx-mips.c	26 Jul 2002 17:21:52 -0000
*************** _bfd_mips_elf_merge_private_bfd_data (ib
*** 7803,7808 ****
--- 7803,7817 ----
        old_flags &= ~EF_MIPS_ABI;
      }
  
+   /* For now, allow arbitrary mixing of ASEs (retain the union).  */
+   if ((new_flags & EF_MIPS_ARCH_ASE) != (old_flags & EF_MIPS_ARCH_ASE))
+     {
+       elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_ARCH_ASE;
+ 
+       new_flags &= ~ EF_MIPS_ARCH_ASE;
+       old_flags &= ~ EF_MIPS_ARCH_ASE;
+     }
+ 
    /* Warn about any other mismatches */
    if (new_flags != old_flags)
      {
Index: ld/testsuite/ld-mips-elf/mips-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/mips-elf.exp,v
retrieving revision 1.3
diff -c -d -p -r1.3 mips-elf.exp
*** ld/testsuite/ld-mips-elf/mips-elf.exp	10 Jun 2002 16:14:08 -0000	1.3
--- ld/testsuite/ld-mips-elf/mips-elf.exp	26 Jul 2002 17:21:53 -0000
*************** if { [istarget mips*-*-*] } then {
*** 39,44 ****
--- 39,46 ----
  	run_dump_test "emrelocs-eb"
  	run_dump_test "emrelocs-el"
  
+ 	run_dump_test "mips16-1"
+ 
  	run_dump_test "region1"
      }
  }
*** /dev/null	Tue Nov 14 21:44:43 2000
--- ld/testsuite/ld-mips-elf/mips16-1a.s	Fri Jul 26 17:55:17 2002
***************
*** 0 ****
--- 1,2 ----
+ 	.text
+ foo1:	jr $31
*** /dev/null	Tue Nov 14 21:44:43 2000
--- ld/testsuite/ld-mips-elf/mips16-1.d	Fri Jul 26 18:01:15 2002
***************
*** 0 ****
--- 1,5 ----
+ #source: mips16-1a.s -no-mips16
+ #source: mips16-1b.s -mips16
+ #ld: -r
+ #objdump: -d
+ #pass
*** /dev/null	Tue Nov 14 21:44:43 2000
--- ld/testsuite/ld-mips-elf/mips16-1b.s	Fri Jul 26 17:55:25 2002
***************
*** 0 ****
--- 1,2 ----
+ 	.text
+ foo2:	jr $31


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