This is the mail archive of the binutils-cvs@sourceware.org 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]

[binutils-gdb/binutils-2_29-branch] MIPS/BFD: Correct microMIPS cross-mode BAL to JALX relaxation


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=31939e5b2a7b5dd1e1a6d79af73bd37aca2bd61b

commit 31939e5b2a7b5dd1e1a6d79af73bd37aca2bd61b
Author: Maciej W. Rozycki <macro@imgtec.com>
Date:   Wed Aug 30 16:03:31 2017 +0100

    MIPS/BFD: Correct microMIPS cross-mode BAL to JALX relaxation
    
    Fix a bug in commit a6ebf6169a1b ("MIPS: Convert cross-mode BAL to
    JALX") and in BFD linker relaxation correct the microMIPS interpretation
    of the branch offset, which is supposed to be shifted by 1 bit, rather
    than 2 as in the regular MIPS case.
    
    	bfd/
    	* elfxx-mips.c (mips_elf_perform_relocation): Correct microMIPS
    	branch offset interpretation.
    
    	gas/
    	* testsuite/gas/mips/branch-addend-micromips.d: New test.
    	* testsuite/gas/mips/branch-addend-micromips-n32.d: New test.
    	* testsuite/gas/mips/branch-addend-micromips-n64.d: New test.
    	* testsuite/gas/mips/branch-addend-micromips.s: New test source.
    	* testsuite/gas/mips/mips.exp: Run the new tests.
    
    	ld/
    	* testsuite/ld-mips-elf/bal-jalx-addend-micromips.d: New test.
    	* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d: New
    	test.
    	* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d: New
    	test.
    	* testsuite/ld-mips-elf/bal-jalx-local-micromips.d: New test.
    	* testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d: New
    	test.
    	* testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d: New
    	test.
    	* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d: New test.
    	* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d: New test.
    	* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d: New test.
    	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d: New
    	test.
    	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d: New
    	test.
    	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d: New
    	test.
    	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
    
    (cherry picked from commit 70e65ca8e5d1fc984d58f6137c290e807fe772a5)

Diff:
---
 bfd/ChangeLog                                      |  5 ++++
 bfd/elfxx-mips.c                                   |  6 ++++-
 gas/ChangeLog                                      |  8 ++++++
 .../gas/mips/branch-addend-micromips-n32.d         | 23 ++++++++++++++++
 .../gas/mips/branch-addend-micromips-n64.d         | 27 +++++++++++++++++++
 gas/testsuite/gas/mips/branch-addend-micromips.d   | 22 +++++++++++++++
 gas/testsuite/gas/mips/branch-addend-micromips.s   | 31 ++++++++++++++++++++++
 gas/testsuite/gas/mips/mips.exp                    |  3 +++
 ld/ChangeLog                                       | 23 ++++++++++++++++
 .../ld-mips-elf/bal-jalx-addend-micromips-n32.d    |  6 +++++
 .../ld-mips-elf/bal-jalx-addend-micromips-n64.d    |  6 +++++
 .../ld-mips-elf/bal-jalx-addend-micromips.d        | 22 +++++++++++++++
 .../ld-mips-elf/bal-jalx-local-micromips-n32.d     |  6 +++++
 .../ld-mips-elf/bal-jalx-local-micromips-n64.d     |  6 +++++
 .../ld-mips-elf/bal-jalx-local-micromips.d         | 20 ++++++++++++++
 .../bal-jalx-pic-ignore-micromips-n32.d            |  6 +++++
 .../bal-jalx-pic-ignore-micromips-n64.d            |  6 +++++
 .../ld-mips-elf/bal-jalx-pic-ignore-micromips.d    | 22 +++++++++++++++
 .../ld-mips-elf/bal-jalx-pic-micromips-n32.d       |  6 +++++
 .../ld-mips-elf/bal-jalx-pic-micromips-n64.d       |  6 +++++
 ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d  |  6 +++++
 ld/testsuite/ld-mips-elf/mips-elf.exp              | 21 +++++++++++++++
 22 files changed, 286 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c90206c..7d997fd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2017-08-30  Maciej W. Rozycki  <macro@imgtec.com>
+
+	* elfxx-mips.c (mips_elf_perform_relocation): Correct microMIPS
+	branch offset interpretation.
+
 2017-08-29  Nick Clifton  <nickc@redhat.com>
 
 	Import from mainline:
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 2eb3dd3..2d82832 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -6414,6 +6414,7 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
       bfd_boolean ok = FALSE;
       bfd_vma opcode = x >> 16;
       bfd_vma jalx_opcode = 0;
+      bfd_vma sign_bit = 0;
       bfd_vma addr;
       bfd_vma dest;
 
@@ -6421,12 +6422,14 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
 	{
 	  ok = opcode == 0x4060;
 	  jalx_opcode = 0x3c;
+	  sign_bit = 0x10000;
 	  value <<= 1;
 	}
       else if (r_type == R_MIPS_PC16 || r_type == R_MIPS_GNU_REL16_S2)
 	{
 	  ok = opcode == 0x411;
 	  jalx_opcode = 0x1d;
+	  sign_bit = 0x20000;
 	  value <<= 2;
 	}
 
@@ -6436,7 +6439,8 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
 		  + input_section->output_offset
 		  + relocation->r_offset
 		  + 4);
-	  dest = addr + (((value & 0x3ffff) ^ 0x20000) - 0x20000);
+	  dest = (addr
+		  + (((value & ((sign_bit << 1) - 1)) ^ sign_bit) - sign_bit));
 
 	  if ((addr >> 28) << 28 != (dest >> 28) << 28)
 	    {
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 028a82c..84aad43 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,13 @@
 2017-08-30  Maciej W. Rozycki  <macro@imgtec.com>
 
+	* testsuite/gas/mips/branch-addend-micromips.d: New test.
+	* testsuite/gas/mips/branch-addend-micromips-n32.d: New test.
+	* testsuite/gas/mips/branch-addend-micromips-n64.d: New test.
+	* testsuite/gas/mips/branch-addend-micromips.s: New test source.
+	* testsuite/gas/mips/mips.exp: Run the new tests.
+
+2017-08-30  Maciej W. Rozycki  <macro@imgtec.com>
+
 	* config/tc-mips.c (md_convert_frag): Respect
 	`mips_ignore_branch_isa'.
 	* testsuite/gas/mips/branch-local-5.d: New test.
diff --git a/gas/testsuite/gas/mips/branch-addend-micromips-n32.d b/gas/testsuite/gas/mips/branch-addend-micromips-n32.d
new file mode 100644
index 0000000..085cc22
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-addend-micromips-n32.d
@@ -0,0 +1,23 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: microMIPS BAL addend encoding (n32)
+#as: -n32 -march=from-abi
+#source: branch-addend-micromips.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+	\.\.\.
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 	jalr	zero,ra
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 	nop
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 4060 0000 	bal	00001018 <bar\+0x8>
+[ 	]*[0-9a-f]+: R_MICROMIPS_PC16_S1	foo\+0xfffc
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 4060 0000 	bal	00001020 <bar\+0x10>
+[ 	]*[0-9a-f]+: R_MICROMIPS_PC16_S1	bar\+0xfffc
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c 	jr	ra
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+	\.\.\.
diff --git a/gas/testsuite/gas/mips/branch-addend-micromips-n64.d b/gas/testsuite/gas/mips/branch-addend-micromips-n64.d
new file mode 100644
index 0000000..65d0cd2
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-addend-micromips-n64.d
@@ -0,0 +1,27 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: microMIPS BAL addend encoding (n64)
+#as: -64 -march=from-abi
+#source: branch-addend-micromips.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+	\.\.\.
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 	jalr	zero,ra
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 	nop
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 4060 0000 	bal	0000000000001018 <bar\+0x8>
+[ 	]*[0-9a-f]+: R_MICROMIPS_PC16_S1	foo\+0xfffc
+[ 	]*[0-9a-f]+: R_MIPS_NONE	\*ABS\*\+0xfffc
+[ 	]*[0-9a-f]+: R_MIPS_NONE	\*ABS\*\+0xfffc
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 4060 0000 	bal	0000000000001020 <bar\+0x10>
+[ 	]*[0-9a-f]+: R_MICROMIPS_PC16_S1	bar\+0xfffc
+[ 	]*[0-9a-f]+: R_MIPS_NONE	\*ABS\*\+0xfffc
+[ 	]*[0-9a-f]+: R_MIPS_NONE	\*ABS\*\+0xfffc
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c 	jr	ra
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+	\.\.\.
diff --git a/gas/testsuite/gas/mips/branch-addend-micromips.d b/gas/testsuite/gas/mips/branch-addend-micromips.d
new file mode 100644
index 0000000..345d9df
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-addend-micromips.d
@@ -0,0 +1,22 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: microMIPS BAL addend encoding
+#as: -32
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+	\.\.\.
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 	jalr	zero,ra
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 	nop
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 4060 7ffe 	bal	00011014 <bar\+0x10004>
+[ 	]*[0-9a-f]+: R_MICROMIPS_PC16_S1	foo
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 4060 7ffe 	bal	0001101c <bar\+0x1000c>
+[ 	]*[0-9a-f]+: R_MICROMIPS_PC16_S1	bar
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c 	jr	ra
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+	\.\.\.
diff --git a/gas/testsuite/gas/mips/branch-addend-micromips.s b/gas/testsuite/gas/mips/branch-addend-micromips.s
new file mode 100644
index 0000000..91d7c8f
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-addend-micromips.s
@@ -0,0 +1,31 @@
+	.text
+	.set	noreorder
+	.space	0x1000
+
+	.align	4
+	.set	nomicromips
+	.globl	foo
+	.ent	foo
+foo:
+	nor	$0, $0
+	jalr	$0, $ra
+	 nor	$0, $0
+	.end	foo
+
+	.align	4
+	.set	micromips
+	.globl	bar
+	.ent	bar
+bar:
+	nor	$0, $0
+	bal	foo + 0x10000
+	 nor	$0, $0
+	bal	bar + 0x10000
+	 nor	$0, $0
+	jalr	$0, $ra
+	 nor	$0, $0
+	.end	bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+	.align	4, 0
+	.space	16
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index e67473b..c71dca4 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -678,9 +678,12 @@ if { [istarget mips*-*-vxworks*] } {
 	run_dump_test "branch-local-n64-7"
     }
     run_dump_test "branch-addend"
+    run_dump_test "branch-addend-micromips"
     if $has_newabi {
 	run_dump_test "branch-addend-n32"
+	run_dump_test "branch-addend-micromips-n32"
 	run_dump_test "branch-addend-n64"
+	run_dump_test "branch-addend-micromips-n64"
     }
     run_dump_test "branch-absolute"
     run_dump_test "branch-absolute-addend"
diff --git a/ld/ChangeLog b/ld/ChangeLog
index c806a53..23bdba4 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,26 @@
+2017-08-30  Maciej W. Rozycki  <macro@imgtec.com>
+
+	* testsuite/ld-mips-elf/bal-jalx-addend-micromips.d: New test.
+	* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d: New
+	test.
+	* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d: New
+	test.
+	* testsuite/ld-mips-elf/bal-jalx-local-micromips.d: New test.
+	* testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d: New
+	test.
+	* testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d: New
+	test.
+	* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d: New test.
+	* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d: New test.
+	* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d: New test.
+	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d: New
+	test.
+	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d: New
+	test.
+	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d: New
+	test.
+	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
+
 2017-08-17  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	PR 21961
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d
new file mode 100644
index 0000000..9c7aca5
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d
@@ -0,0 +1,6 @@
+#name: microMIPS BAL/JALX addend calculation (n32)
+#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s
+#as: -EB -n32 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-addend-micromips.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d
new file mode 100644
index 0000000..e254c65
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d
@@ -0,0 +1,6 @@
+#name: microMIPS BAL/JALX addend calculation (n64)
+#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s
+#as: -EB -64 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-addend-micromips.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d
new file mode 100644
index 0000000..e066f5d
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d
@@ -0,0 +1,22 @@
+#name: microMIPS BAL/JALX addend calculation
+#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s
+#as: -EB -32
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+	\.\.\.
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 	jalr	zero,ra
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 	nop
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> f300 4400 	jalx	0*1c011000 <.*>
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 4060 7ff8 	bal	0*1c011010 <.*>
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c 	jr	ra
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d
new file mode 100644
index 0000000..16fcb0a
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d
@@ -0,0 +1,6 @@
+#name: microMIPS BAL to JALX conversion for local symbol (n32)
+#source: ../../../gas/testsuite/gas/mips/branch-local-7.s
+#as: -EB -n32 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-local-micromips.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d
new file mode 100644
index 0000000..d13a9ea
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d
@@ -0,0 +1,6 @@
+#name: microMIPS BAL to JALX conversion for local symbol (n64)
+#source: ../../../gas/testsuite/gas/mips/branch-local-7.s
+#as: -EB -64 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-local-micromips.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d
new file mode 100644
index 0000000..e944d3b
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d
@@ -0,0 +1,20 @@
+#name: microMIPS BAL to JALX conversion for local symbol
+#source: ../../../gas/testsuite/gas/mips/branch-local-7.s
+#as: -EB -32
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+	\.\.\.
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 	jalr	zero,ra
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 	nop
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> f300 0400 	jalx	0*1c001000 <foo>
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c 	jr	ra
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d
new file mode 100644
index 0000000..9a293c5
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d
@@ -0,0 +1,6 @@
+#name: microMIPS BAL/JALX in PIC mode (ignore branch ISA, n32)
+#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s
+#as: -EB -n32 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared --ignore-branch-isa
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-pic-ignore-micromips.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d
new file mode 100644
index 0000000..2b78bb9
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d
@@ -0,0 +1,6 @@
+#name: microMIPS BAL/JALX in PIC mode (ignore branch ISA, n64)
+#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s
+#as: -EB -64 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared --ignore-branch-isa
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-pic-ignore-micromips.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d
new file mode 100644
index 0000000..0b48b3a
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d
@@ -0,0 +1,22 @@
+#name: microMIPS BAL/JALX in PIC mode (ignore branch ISA)
+#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s
+#as: -EB -32
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared --ignore-branch-isa
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+	\.\.\.
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 	jalr	zero,ra
+[0-9a-f]+ <[^>]*> 00000027 	nor	zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 	nop
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 4060 7ff4 	bal	0*1c011000 <.*>
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 4060 7ff8 	bal	0*1c011010 <.*>
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c 	jr	ra
+[0-9a-f]+ <[^>]*> 0000 02d0 	not	zero,zero
+	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d
new file mode 100644
index 0000000..3b25dc7
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d
@@ -0,0 +1,6 @@
+#name: microMIPS BAL/JALX in PIC mode (n32)
+#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s
+#as: -EB -n32 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared
+#error: \A[^\n]*: In function `bar':\n
+#error:   \(\.text\+0x1014\): Unsupported branch between ISA modes\Z
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d
new file mode 100644
index 0000000..d39f114
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d
@@ -0,0 +1,6 @@
+#name: microMIPS BAL/JALX in PIC mode (n64)
+#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s
+#as: -EB -64 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared
+#error: \A[^\n]*: In function `bar':\n
+#error:   \(\.text\+0x1014\): Unsupported branch between ISA modes\Z
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d
new file mode 100644
index 0000000..7404d25
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d
@@ -0,0 +1,6 @@
+#name: microMIPS BAL/JALX in PIC mode
+#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s
+#as: -EB -32
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared
+#error: \A[^\n]*: In function `bar':\n
+#error:   \(\.text\+0x1014\): Unsupported branch between ISA modes\Z
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 4008da0..96f57bf 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -251,22 +251,43 @@ if { $linux_gnu } {
 run_dump_test "jalx-addend" [list [list ld $abi_ldflags(o32)]]
 run_dump_test "jalx-local" [list [list ld $abi_ldflags(o32)]]
 run_dump_test "bal-jalx-addend" [list [list ld $abi_ldflags(o32)]]
+run_dump_test "bal-jalx-addend-micromips" [list [list ld $abi_ldflags(o32)]]
 run_dump_test "bal-jalx-local" [list [list ld $abi_ldflags(o32)]]
+run_dump_test "bal-jalx-local-micromips" [list [list ld $abi_ldflags(o32)]]
 run_dump_test "bal-jalx-pic" [list [list ld $abi_ldflags(o32)]]
+run_dump_test "bal-jalx-pic-micromips" [list [list ld $abi_ldflags(o32)]]
 run_dump_test "bal-jalx-pic-ignore" [list [list ld $abi_ldflags(o32)]]
+run_dump_test "bal-jalx-pic-ignore-micromips" \
+					[list [list ld $abi_ldflags(o32)]]
 if $has_newabi {
     run_dump_test "jalx-addend-n32" [list [list ld $abi_ldflags(n32)]]
     run_dump_test "jalx-local-n32" [list [list ld $abi_ldflags(n32)]]
     run_dump_test "bal-jalx-addend-n32" [list [list ld $abi_ldflags(n32)]]
+    run_dump_test "bal-jalx-addend-micromips-n32" \
+					[list [list ld $abi_ldflags(n32)]]
     run_dump_test "bal-jalx-local-n32" [list [list ld $abi_ldflags(n32)]]
+    run_dump_test "bal-jalx-local-micromips-n32" \
+					[list [list ld $abi_ldflags(n32)]]
     run_dump_test "bal-jalx-pic-n32" [list [list ld $abi_ldflags(n32)]]
+    run_dump_test "bal-jalx-pic-micromips-n32" \
+					[list [list ld $abi_ldflags(n32)]]
     run_dump_test "bal-jalx-pic-ignore-n32" [list [list ld $abi_ldflags(n32)]]
+    run_dump_test "bal-jalx-pic-ignore-micromips-n32" \
+					[list [list ld $abi_ldflags(n32)]]
     run_dump_test "jalx-addend-n64" [list [list ld $abi_ldflags(n64)]]
     run_dump_test "jalx-local-n64" [list [list ld $abi_ldflags(n64)]]
     run_dump_test "bal-jalx-addend-n64" [list [list ld $abi_ldflags(n64)]]
+    run_dump_test "bal-jalx-addend-micromips-n64" \
+					[list [list ld $abi_ldflags(n64)]]
     run_dump_test "bal-jalx-local-n64" [list [list ld $abi_ldflags(n64)]]
+    run_dump_test "bal-jalx-local-micromips-n64" \
+					[list [list ld $abi_ldflags(n64)]]
     run_dump_test "bal-jalx-pic-n64" [list [list ld $abi_ldflags(n64)]]
+    run_dump_test "bal-jalx-pic-micromips-n64" \
+					[list [list ld $abi_ldflags(n64)]]
     run_dump_test "bal-jalx-pic-ignore-n64" [list [list ld $abi_ldflags(n64)]]
+    run_dump_test "bal-jalx-pic-ignore-micromips-n64" \
+					[list [list ld $abi_ldflags(n64)]]
 }
 
 run_dump_test "unaligned-jalx-0" [list [list ld $abi_ldflags(o32)]]


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