[PATCH] [MIPS] Improve interlinking error message

Catherine Moore clm@codesourcery.com
Tue Aug 3 16:43:00 GMT 2010


This patch improves the error message that is displayed if an assembly 
language routine tries to use an invalid jump instruction to change modes.

Does this look okay to install?
Thanks,
Catherine

2010-08-03  Catherine Moore  <clm@codesourcery.com>

	bfd/
	* elfxx-mips.c (mips_elf_perform_relocation): Improve
	interlinking error message.

	ld/testsuite/ld-mips-elf/
	* mode-change-error-1a.s: New.
	* mode-change-error-1b.s: New.
	* mode-change-error-1.d: New.
	* mips-elf.exp: Run new test.

Index: elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.268
diff -p -r1.268 elfxx-mips.c
*** elfxx-mips.c        27 Jul 2010 21:18:52 -0000      1.268
--- elfxx-mips.c        3 Aug 2010 16:22:07 -0000
*************** mips_elf_perform_relocation (struct bfd_
*** 5641,5647 ****
         if (!ok)
         {
           (*_bfd_error_handler)
!           (_("%B: %A+0x%lx: jump to stub routine which is not jal"),
              input_bfd,
              input_section,
              (unsigned long) relocation->r_offset);
--- 5641,5647 ----
         if (!ok)
         {
           (*_bfd_error_handler)
!           (_("%B: %A+0x%lx: Jump that does not support interlinking 
used where a mode change is required."),
              input_bfd,
              input_section,
              (unsigned long) relocation->r_offset);


Index: mips-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/mips-elf.exp,v
retrieving revision 1.64
diff -p -r1.64 mips-elf.exp
*** mips-elf.exp        13 Jan 2010 22:34:28 -0000      1.64
--- mips-elf.exp        3 Aug 2010 16:21:43 -0000
*************** if {$has_newabi} {
*** 322,327 ****
--- 322,329 ----
       run_dump_test "jalbal"
   }

+ run_dump_test "mode-change-error-1"
+
   run_dump_test "mips16-hilo"
   if {$has_newabi} {
       run_dump_test "mips16-hilo-n32"

Index: mode-change-error-1.d
===================================================================
RCS file: mode-change-error-1.d
diff -N mode-change-error-1.d
*** /dev/null   1 Jan 1970 00:00:00 -0000
--- mode-change-error-1.d       3 Aug 2010 16:21:43 -0000
***************
*** 0 ****
--- 1,5 ----
+ #name: Mode Change Error 1
+ #source: mode-change-error-1a.s
+ #source: mode-change-error-1b.s
+ #ld: -e 0x8000000
+ #error: .*: Jump that does not support interlinking used where a 
mode change is required.
Index: mode-change-error-1a.s
===================================================================
RCS file: mode-change-error-1a.s
diff -N mode-change-error-1a.s
*** /dev/null   1 Jan 1970 00:00:00 -0000
--- mode-change-error-1a.s      3 Aug 2010 16:21:43 -0000
***************
*** 0 ****
--- 1,17 ----
+       .option pic0
+       .text
+       .align  4
+       .globl  main
+       .set    nomips16
+       .ent    main
+       .type   main, @function
+ main:
+       .mask   0x80000000,-4
+       .fmask  0x00000000,0
+       .set    noreorder
+
+       j       doit
+       nop
+
+       .end    main
+       .size   main, .-main
Index: mode-change-error-1b.s
===================================================================
RCS file: mode-change-error-1b.s
diff -N mode-change-error-1b.s
*** /dev/null   1 Jan 1970 00:00:00 -0000
--- mode-change-error-1b.s      3 Aug 2010 16:21:43 -0000
***************
*** 0 ****
--- 1,18 ----
+       .text
+       .align  4
+       .globl  doit
+       .set    mips16
+       .ent    doit
+       .type   doit, @function
+ doit:
+       .frame  $sp,0,$31
+       .mask   0x00000000,0
+       .fmask  0x00000000,0
+       sll     $2,$4,1
+       sll     $4,$4,3
+       .set    noreorder
+       .set    nomacro
+       j       $31
+       addu    $2,$2,$4
+       .end    doit
+       .size   doit, .-doit



More information about the Binutils mailing list