aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-mips-elf
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2008-08-06 19:44:47 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2008-08-06 19:44:47 +0000
commit738e53487d7edb6b7428b889dcb0721d3d9e2c43 (patch)
tree6d055845fb85211181d8a9e38a0fa8076e990443 /ld/testsuite/ld-mips-elf
parentd57a3c85f6eee87b04852e98cce75af080969951 (diff)
downloadgdb-738e53487d7edb6b7428b889dcb0721d3d9e2c43.zip
gdb-738e53487d7edb6b7428b889dcb0721d3d9e2c43.tar.gz
gdb-738e53487d7edb6b7428b889dcb0721d3d9e2c43.tar.bz2
bfd/
* reloc.c (BFD_RELOC_MIPS16_GOT16, BFD_RELOC_MIPS16_CALL16): Declare. * libbfd.h, bfd-in2.h: Regenerate. * elf32-mips.c (elf_mips16_howto_table_rel): Fill in reserved R_MIPS16_GOT16 and R_MIPS16_CALL16 entries. (mips16_reloc_map): Add mappings. * elf64-mips.c (mips16_elf64_howto_table_rel): Fill in reserved R_MIPS16_GOT16 and R_MIPS16_CALL16 entries. (mips16_elf64_howto_table_rela): Likewise. (mips16_reloc_map): Add mappings. * elfn32-mips.c (elf_mips16_howto_table_rel): Fill in reserved R_MIPS16_GOT16 and R_MIPS16_CALL16 entries. (elf_mips16_howto_table_rela): Likewise. (mips16_reloc_map): Add mappings. * elfxx-mips.c (mips_elf_create_shadow_symbol): New function. (section_allows_mips16_refs_p): Likewise. (mips16_stub_symndx): Likewise. (mips_elf_check_mips16_stubs): Treat the data argument as a bfd_link_info. Mark every dynamic symbol as needing MIPS16 stubs and create a "shadow" symbol for the original MIPS16 definition. (mips16_reloc_p, got16_reloc_p, call16_reloc_p, hi16_reloc_p) (lo16_reloc_p, mips16_call_reloc_p): New functions. (_bfd_mips16_elf_reloc_unshuffle): Use mips16_reloc_p to generalize relocation checks. (_bfd_mips16_elf_reloc_shuffle): Likewise. (_bfd_mips_elf_lo16_reloc): Handle R_MIPS16_GOT16. (mips_elf_got16_entry): Add comment. (mips_elf_calculate_relocation): Use hi16_reloc_p, lo16_reloc_p, mips16_call_reloc_p, call16_reloc_p and got16_reloc_p to generalize relocation checks. Use section_allows_mips16_refs_p instead of mips16_stub_section_p. Handle R_MIPS16_CALL16 and R_MIPS16_GOT16, allowing the former to refer directly to a MIPS16 function if its stub is not needed. (mips16_stub_section_p): Delete. (_bfd_mips_elf_symbol_processing): Convert odd-valued function symbols into even MIPS16 symbols. (mips_elf_add_lo16_rel_addend): Use mips16_reloc_p to generalize a relocation check. (_bfd_mips_elf_check_relocs): Calculate "bed" and "rel_end" earlier in the function. Use mips16_stub_symndx to identify the target function. Avoid out-of-bounds accesses when the stub has no relocations; report an error instead. Use section_allows_mips16_refs_p instead of mips16_stub_section_p. Use mips16_call_reloc_p and got16_reloc_p to generalize relocation checks. Handle R_MIPS16_CALL16 and R_MIPS16_GOT16. Don't create dynamic relocations for absolute references to __gnu_local_gp. (_bfd_mips_elf_always_size_sections): Pass a bfd_link_info as the argument to mips_elf_check_mips16_stubs. Generalize comment. (_bfd_mips_elf_relocate_section): Use hi16_reloc_p and got16_reloc_p to generalize relocation checks. (_bfd_mips_elf_finish_dynamic_symbol): If a dynamic MIPS16 function symbol has a non-MIPS16 stub, redirect the symbol to the stub. Fix an overly long line. Don't give dynamic symbols type STO_MIPS16. (_bfd_mips_elf_gc_sweep_hook): Handle R_MIPS16_CALL16 and R_MIPS16_GOT16. gas/ * config/tc-mips.c (mips16_reloc_p, got16_reloc_p, hi16_reloc_p) (lo16_reloc_p): New functions. (reloc_needs_lo_p): Use hi16_reloc_p and got16_reloc_p to generalize relocation checks. (matching_lo_reloc): New function. (fixup_has_matching_lo_p): Use it. (mips16_mark_labels): Don't clobber a symbol's visibility. (append_insn): Use hi16_reloc_p and lo16_reloc_p. (mips16_ip): Handle BFD_RELOC_MIPS16_GOT16 and BFD_RELOC_MIPS16_CALL16. (md_apply_fix): Likewise. (mips16_percent_op): Add %got and %call16. (mips_frob_file): Use got16_reloc_p to generalize relocation checks. Use matching_lo_reloc. (mips_force_relocation): Use hi16_reloc_p and lo16_reloc_p to generalize relocation checks. (mips_fix_adjustable): Use lo16_reloc_p to generalize relocation checks. gas/testsuite/ * gas/mips/elf-rel8-mips16.d, gas/mips/elf-rel8-mips16.s, * gas/mips/elf-rel9-mips16.d, gas/mips/elf-rel9-mips16.s, * gas/mips/elf-rel13-mips16.d, gas/mips/elf-rel13-mips16.s: New tests. * gas/mips/mips.exp: Run them. ld/testsuite/ * ld-mips-elf/mips16-local-stubs-1.d: Remove stub_for_h3, which was only referenced by the .pdr section, and was not actually needed by code. * ld-mips-elf/mips16-intermix.d: Remove unused static function stubs. * ld-mips-elf/mips16-pic-1a.s, ld-mips-elf/mips16-pic-1b.s, ld-mips-elf/mips16-pic-1-dummy.s, ld-mips-elf/mips16-pic-1.dd, ld-mips-elf/mips16-pic-1.gd, ld-mips-elf/mips16-pic-1.inc, ld-mips-elf/mips16-pic-1.ld, ld-mips-elf/mips16-pic-2a.s, ld-mips-elf/mips16-pic-2b.s, ld-mips-elf/mips16-pic-2.ad, ld-mips-elf/mips16-pic-2.dd, ld-mips-elf/mips16-pic-2.gd, ld-mips-elf/mips16-pic-2.nd, ld-mips-elf/mips16-pic-2.rd: New tests. * ld-mips-elf/mips-elf.exp: Run them.
Diffstat (limited to 'ld/testsuite/ld-mips-elf')
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp24
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-intermix.d12
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-local-stubs-1.d31
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-1-dummy.s15
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-1.dd1227
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-1.gd57
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-1.inc147
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-1.ld22
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-1a.s144
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-1b.s19
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-2.ad6
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-2.dd208
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-2.gd28
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-2.nd10
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-2.rd9
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-2a.s63
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-pic-2b.s16
17 files changed, 2010 insertions, 28 deletions
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 80493e9..29cd3bb 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -56,6 +56,30 @@ set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]]
set linux_gnu [expr [istarget mips*-*-linux*]]
set embedded_elf [expr [istarget mips*-*-elf]]
+if { $linux_gnu } {
+ run_ld_link_tests [list \
+ [list "Dummy shared library for MIPS16 PIC test 1" \
+ "-shared -melf32btsmip" \
+ "-EB -32" { mips16-pic-1-dummy.s } \
+ {} \
+ "mips16-pic-1-dummy.so"] \
+ [list "MIPS16 PIC test 1" \
+ "-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-1-dummy.so" \
+ "-EB -32 -I $srcdir/$subdir" { mips16-pic-1a.s mips16-pic-1b.s } \
+ { { objdump { -dr -j.text } mips16-pic-1.dd }
+ { readelf -A mips16-pic-1.gd } } \
+ "mips16-pic-1"] \
+ [list "MIPS16 PIC test 2" \
+ "-melf32btsmip -T mips16-pic-1.ld -shared" \
+ "-EB -32 -I $srcdir/$subdir" { mips16-pic-2a.s mips16-pic-2b.s } \
+ { { objdump { -dr -j.text } mips16-pic-2.dd } \
+ { readelf -A mips16-pic-2.gd } \
+ { readelf --symbols mips16-pic-2.nd } \
+ { readelf --relocs mips16-pic-2.rd } \
+ { readelf -d mips16-pic-2.ad } } \
+ "mips16-pic-2"]]
+}
+
if { [istarget mips64*-linux-gnu] } {
set o32_as_flags "-32 -EB"
set o32_ld_flags "-melf32btsmip"
diff --git a/ld/testsuite/ld-mips-elf/mips16-intermix.d b/ld/testsuite/ld-mips-elf/mips16-intermix.d
index 5c6ee68..cc8c1fe 100644
--- a/ld/testsuite/ld-mips-elf/mips16-intermix.d
+++ b/ld/testsuite/ld-mips-elf/mips16-intermix.d
@@ -14,7 +14,6 @@ SYMBOL TABLE:
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_d
.* l F .text 0+[0-9a-f]+ m32_static_d
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static_d
-.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static_d
.* l F .text 0+[0-9a-f]+ m32_static1_d
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static1_d
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static1_d
@@ -23,7 +22,6 @@ SYMBOL TABLE:
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static32_d
.* l F .text 0+[0-9a-f]+ m32_static16_d
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static16_d
-.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static16_d
.* l F .text 0+[0-9a-f]+ m32_static_ld
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static_ld
.* l F .text 0+[0-9a-f]+ m32_static1_ld
@@ -35,7 +33,6 @@ SYMBOL TABLE:
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_dl
.* l F .text 0+[0-9a-f]+ m32_static_dl
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static_dl
-.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static_dl
.* l F .text 0+[0-9a-f]+ m32_static1_dl
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static1_dl
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static1_dl
@@ -44,11 +41,9 @@ SYMBOL TABLE:
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static32_dl
.* l F .text 0+[0-9a-f]+ m32_static16_dl
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static16_dl
-.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static16_dl
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_dlld
.* l F .text 0+[0-9a-f]+ m32_static_dlld
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static_dlld
-.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static_dlld
.* l F .text 0+[0-9a-f]+ m32_static1_dlld
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static1_dlld
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static1_dlld
@@ -57,7 +52,6 @@ SYMBOL TABLE:
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static32_dlld
.* l F .text 0+[0-9a-f]+ m32_static16_dlld
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static16_dlld
-.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static16_dlld
.* l F .text 0+[0-9a-f]+ m32_static_d_l
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static_d_l
.* l F .text 0+[0-9a-f]+ m32_static1_d_l
@@ -66,10 +60,11 @@ SYMBOL TABLE:
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static32_d_l
.* l F .text 0+[0-9a-f]+ m32_static16_d_l
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static16_d_l
-.* l F .text 0+[0-9a-f]+ __fn_stub_m16_d_d
+# ??? We aren't yet able to get rid of the symbol table entry for
+# __fn_stub_m16_d_d, or its .pdr entry.
+.* l F .text 0+[0-9a-f]+ *
.* l F .text 0+[0-9a-f]+ m32_static_d_d
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static_d_d
-.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static_d_d
.* l F .text 0+[0-9a-f]+ m32_static1_d_d
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static1_d_d
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static1_d_d
@@ -78,7 +73,6 @@ SYMBOL TABLE:
.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static32_d_d
.* l F .text 0+[0-9a-f]+ m32_static16_d_d
.* l F .text 0+[0-9a-f]+ 0xf0 m16_static16_d_d
-.* l F .text 0+[0-9a-f]+ __fn_stub_m16_static16_d_d
#...
.* l F .text 0+[0-9a-f]+ __call_stub_m32_static1_d
.* l F .text 0+[0-9a-f]+ __call_stub_m16_static1_d
diff --git a/ld/testsuite/ld-mips-elf/mips16-local-stubs-1.d b/ld/testsuite/ld-mips-elf/mips16-local-stubs-1.d
index 9990493..1ffa1d1 100644
--- a/ld/testsuite/ld-mips-elf/mips16-local-stubs-1.d
+++ b/ld/testsuite/ld-mips-elf/mips16-local-stubs-1.d
@@ -57,13 +57,13 @@ Disassembly of section \.text:
20000068: 00000000 nop
2000006c <caller2>:
-2000006c: 1c00 0030 jalx 200000c0 <stub_for_f1>
+2000006c: 1c00 002c jalx 200000b0 <stub_for_f1>
20000070: 6500 nop
-20000072: 1c00 0038 jalx 200000e0 <stub_for_f2>
+20000072: 1c00 0034 jalx 200000d0 <stub_for_f2>
20000076: 6500 nop
-20000078: 1c00 0034 jalx 200000d0 <stub_for_g1>
+20000078: 1c00 0030 jalx 200000c0 <stub_for_g1>
2000007c: 6500 nop
-2000007e: 1c00 003c jalx 200000f0 <stub_for_g2>
+2000007e: 1c00 0038 jalx 200000e0 <stub_for_g2>
20000082: 6500 nop
20000084: 1800 0004 jal 20000010 <h1>
20000088: 6500 nop
@@ -82,33 +82,26 @@ Disassembly of section \.text:
200000a8: 00200008 jr at
200000ac: 00000000 nop
-# This isn't actually called, but is referenced from the .pdr section.
-200000b0 <stub_for_h3>:
+200000b0 <stub_for_f1>:
200000b0: 3c012000 lui at,0x2000
-200000b4: 24210039 addiu at,at,57
+200000b4: 24210000 addiu at,at,0
200000b8: 00200008 jr at
200000bc: 00000000 nop
-200000c0 <stub_for_f1>:
+200000c0 <stub_for_g1>:
200000c0: 3c012000 lui at,0x2000
-200000c4: 24210000 addiu at,at,0
+200000c4: 24210008 addiu at,at,8
200000c8: 00200008 jr at
200000cc: 00000000 nop
-200000d0 <stub_for_g1>:
+200000d0 <stub_for_f2>:
200000d0: 3c012000 lui at,0x2000
-200000d4: 24210008 addiu at,at,8
+200000d4: 24210014 addiu at,at,20
200000d8: 00200008 jr at
200000dc: 00000000 nop
-200000e0 <stub_for_f2>:
+200000e0 <stub_for_g2>:
200000e0: 3c012000 lui at,0x2000
-200000e4: 24210014 addiu at,at,20
+200000e4: 2421001c addiu at,at,28
200000e8: 00200008 jr at
200000ec: 00000000 nop
-
-200000f0 <stub_for_g2>:
-200000f0: 3c012000 lui at,0x2000
-200000f4: 2421001c addiu at,at,28
-200000f8: 00200008 jr at
-200000fc: 00000000 nop
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-1-dummy.s b/ld/testsuite/ld-mips-elf/mips16-pic-1-dummy.s
new file mode 100644
index 0000000..6ee56e0
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-1-dummy.s
@@ -0,0 +1,15 @@
+ .abicalls
+ nop
+
+ .macro dummyfn,name
+ .global \name
+ .ent \name
+\name:
+ jr $31
+ .end \name
+ .endm
+
+ dummyfn extern1
+ dummyfn extern2
+ dummyfn extern3
+ dummyfn extern4
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-1.dd b/ld/testsuite/ld-mips-elf/mips16-pic-1.dd
new file mode 100644
index 0000000..c853733
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-1.dd
@@ -0,0 +1,1227 @@
+
+.*
+
+
+Disassembly of section \.text:
+
+00040400 <a_unused1>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040404 <b_unused1>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040408 <callpic_unused1_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+# 0x40400: a_unused1
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,1025
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+# 0x40404: b_unused2
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,1029
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+00040444 <a_unused2>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040448 <b_unused2>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004044c <jals_unused2_mips16>:
+.*: [^\t]* jal .* <a_unused2>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <b_unused2>
+.*: [^\t]* nop
+
+00040458 <a_unused3>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004045c <b_unused3>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040460 <a_unused4>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040464 <b_unused4>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040468 <callpic_unused4_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32740\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32736\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+0004049c <a_unused5>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404a0 <b_unused5>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404a4 <jals_unused5_mips16>:
+.*: [^\t]* jal .* <a_unused5>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <b_unused5>
+.*: [^\t]* nop
+
+000404b0 <a_unused6>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404b4 <b_unused6>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404b8 <a_unused7>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404bc <b_unused7>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404c0 <a_unused8>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404c4 <b_unused8>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404c8 <a_unused9>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404cc <b_unused9>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404d0 <jals_unused9_mips16>:
+.*: [^\t]* jal .* <a_unused9>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <b_unused9>
+.*: [^\t]* nop
+
+000404dc <a_unused10>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404e0 <b_unused10>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404e4 <a_unused11>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404e8 <b_unused11>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404ec <a_used1>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404f0 <b_used1>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000404f4 <callpic_used1_nomips16>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+.*: [^\t]* move v0,gp
+.*: [^\t]* addiu sp,sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+# 0x40b10: __fn_a_used1
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,v0,2832
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+# 0x40b24: __fn_b_used1
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,v0,2852
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,sp,32
+
+0004054c <a_used2>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040550 <b_used2>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040554 <jals_used2_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used2>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <__fn_b_used2>
+.*: [^\t]* nop
+
+00040564 <a_used3>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040568 <b_used3>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004056c <callpic_used3_nomips16>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+.*: [^\t]* move v0,gp
+.*: [^\t]* addiu sp,sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+# 0x40b80: __fn_a_used3
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,v0,2944
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+# 0x40b94: __fn_b_used3
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,v0,2964
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,sp,32
+
+000405c4 <callpic_used3_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+# 0x40564: a_used3
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,1381
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+# 0x40568: b_used3
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,1385
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+00040600 <a_used4>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040604 <b_used4>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040608 <jals_used4_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used4>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <__fn_b_used4>
+.*: [^\t]* nop
+
+00040618 <jals_used4_mips16>:
+.*: [^\t]* jal .* <a_used4>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <b_used4>
+.*: [^\t]* nop
+
+00040624 <a_used5>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040628 <b_used5>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004062c <jals_used5_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used5>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <__fn_b_used5>
+.*: [^\t]* nop
+
+0004063c <callpic_used5_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+# 0x40624: a_used5
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,1573
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+# 0x40628: b_used5
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,1577
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+00040678 <a_used6>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004067c <b_used6>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040680 <callpic_used6_nomips16>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+.*: [^\t]* move v0,gp
+.*: [^\t]* addiu sp,sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32732\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32728\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,sp,32
+
+000406d0 <a_used7>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000406d4 <b_used7>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000406d8 <jals_used7_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used7>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <__fn_b_used7>
+.*: [^\t]* nop
+
+000406e8 <a_used8>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000406ec <b_used8>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000406f0 <a_used9>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000406f4 <b_used9>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000406f8 <a_used10>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000406fc <b_used10>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040700 <callpic_used10_nomips16>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+.*: [^\t]* move v0,gp
+.*: [^\t]* addiu sp,sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32724\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32720\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,sp,32
+
+00040750 <callpic_used10_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32724\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32720\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+00040784 <a_used11>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040788 <b_used11>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004078c <jals_used11_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used11>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <__fn_b_used11>
+.*: [^\t]* nop
+
+0004079c <jals_used11_mips16>:
+.*: [^\t]* jal .* <a_used11>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <b_used11>
+.*: [^\t]* nop
+
+000407a8 <a_used12>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000407ac <b_used12>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000407b0 <jals_used12_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used12>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <__fn_b_used12>
+.*: [^\t]* nop
+
+000407c0 <callpic_used12_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32716\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32712\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+000407f4 <.mips16.a_used13>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000407f8 <.mips16.b_used13>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000407fc <callpic_used13_nomips16>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+.*: [^\t]* move v0,gp
+.*: [^\t]* addiu sp,sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32660\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32632\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,sp,32
+
+0004084c <a_used14>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040850 <b_used14>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040854 <jals_used14_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used14>
+.*: [^\t]* nop
+ .*: [^\t]* jal .* <__fn_b_used14>
+.*: [^\t]* nop
+
+00040864 <.mips16.a_used15>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040868 <.mips16.b_used15>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004086c <a_used16>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040870 <b_used16>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040874 <.mips16.a_used17>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040878 <.mips16.b_used17>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004087c <callpic_used17_nomips16>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+.*: [^\t]* move v0,gp
+.*: [^\t]* addiu sp,sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32676\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32656\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,sp,32
+
+000408cc <callpic_used17_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32676\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32656\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+00040900 <a_used18>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040904 <b_used18>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040908 <jals_used18_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used18>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <__fn_b_used18>
+.*: [^\t]* nop
+
+00040918 <jals_used18_mips16>:
+.*: [^\t]* jal .* <a_used18>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <b_used18>
+.*: [^\t]* nop
+
+00040924 <.mips16.a_used19>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040928 <.mips16.b_used19>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004092c <jals_used19_nomips16>:
+.*: [^\t]* jal .* <a_used19>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <b_used19>
+.*: [^\t]* nop
+
+0004093c <callpic_used19_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32644\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32672\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+00040970 <.mips16.a_used20>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040974 <.mips16.b_used20>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040978 <callpic_used20_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32668\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32652\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+000409ac <.mips16.a_used21>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+000409b0 <.mips16.b_used21>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+#...
+
+000409c0 <callpic_unused6_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32708\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32704\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+000409f4 <jals_unused7_mips16>:
+.*: [^\t]* jal .* <a_unused7>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <b_unused7>
+.*: [^\t]* nop
+
+00040a00 <jals_unused10_mips16>:
+.*: [^\t]* jal .* <a_unused10>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <b_unused10>
+.*: [^\t]* nop
+
+00040a0c <callpic_used8_nomips16>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+.*: [^\t]* move v0,gp
+.*: [^\t]* addiu sp,sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32700\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32696\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,sp,32
+
+00040a5c <jals_used9_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used9>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <__fn_b_used9>
+.*: [^\t]* nop
+
+00040a6c <callpic_used15_nomips16>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+.*: [^\t]* move v0,gp
+.*: [^\t]* addiu sp,sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32664\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32640\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,sp,32
+
+00040abc <jals_used16_nomips16>:
+.*: [^\t]* jal .* <__fn_a_used16>
+.*: [^\t]* nop
+.*: [^\t]* jal .* <__fn_b_used16>
+.*: [^\t]* nop
+
+00040acc <callpic_used21_mips16>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32648\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32636\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+
+00040b00 <__start>:
+ \.\.\.
+
+00040b10 <__fn_a_used1>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040b24 <__fn_b_used1>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x404f0: b_used1
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1265
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040b48 <__fn_a_used2>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040b5c <__fn_b_used2>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40550: b_used2
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1361
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040b80 <__fn_a_used3>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040b94 <__fn_b_used3>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40568: b_used3
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1385
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040bb8 <__fn_a_used4>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040bcc <__fn_b_used4>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40604: b_used4
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1541
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040bf0 <__fn_a_used5>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040c04 <__fn_b_used5>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40628: b_used5
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1577
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040c28 <__fn_a_used6>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040c3c <__fn_b_used6>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x4067c: b_used6
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1661
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040c60 <__fn_a_used7>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040c74 <__fn_b_used7>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x406d4: b_used7
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1749
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040c98 <__fn_a_used8>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040cac <__fn_b_used8>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x406ec: b_used8
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1773
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040cd0 <__fn_a_used9>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040ce4 <__fn_b_used9>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x406f4: b_used9
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1781
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040d08 <__fn_a_used10>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040d1c <__fn_b_used10>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x406fc: b_used10
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1789
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040d40 <__fn_a_used11>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040d54 <__fn_b_used11>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40788: b_used11
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1929
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040d78 <__fn_a_used12>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040d8c <__fn_b_used12>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x407ac: b_used12
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1965
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040db0 <a_used13>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040dc4 <b_used13>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x407f8: .mips16.b_used13
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,2041
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040de8 <__fn_a_used14>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040dfc <__fn_b_used14>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40850: b_used14
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,2129
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040e20 <a_used15>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040e34 <b_used15>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40628: .mips16.b_used15
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,2153
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040e58 <__fn_a_used16>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040e6c <__fn_b_used16>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40870: b_used16
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,2161
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040e90 <a_used17>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040ea4 <b_used17>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40878: .mips16.b_used17
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,2169
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040ec8 <__fn_a_used18>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040edc <__fn_b_used18>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40904: b_used18
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,2309
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040f00 <a_used19>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040f14 <b_used19>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40928: .mips16.b_used19
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,2345
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040f38 <a_used20>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040f4c <b_used20>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x40974: .mips16.b_used20
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,2421
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040f70 <a_used21>:
+.*: [^\t]* lui v0,.*
+.*: [^\t]* addiu v0,v0,.*
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040f84 <b_used21>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 0x409b0: .mips16.b_used21
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,2481
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-1.gd b/ld/testsuite/ld-mips-elf/mips16-pic-1.gd
new file mode 100644
index 0000000..874a319
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-1.gd
@@ -0,0 +1,57 @@
+
+Primary GOT:
+ Canonical gp value: 00057ff0
+
+ Reserved entries:
+ Address Access Initial Purpose
+ 00050000 -32752\(gp\) 00000000 Lazy resolver
+ 00050004 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+ Address Access Initial
+# GOT page entry
+ 00050008 -32744\(gp\) 00040000
+# a_unused4
+ 0005000c -32740\(gp\) 00040461
+# b_unused4
+ 00050010 -32736\(gp\) 00040465
+# __fn_a_used6
+ 00050014 -32732\(gp\) 00040c28
+# __fn_b_used6
+ 00050018 -32728\(gp\) 00040c3c
+# __fn_a_used10
+ 0005001c -32724\(gp\) 00040d08
+# __fn_b_used10
+ 00050020 -32720\(gp\) 00040d1c
+# __fn_a_used12
+ 00050024 -32716\(gp\) 00040d78
+# __fn_b_used12
+ 00050028 -32712\(gp\) 00040d8c
+# a_unused6
+ 0005002c -32708\(gp\) 000404b1
+# b_unused6
+ 00050030 -32704\(gp\) 000404b5
+# __fn_a_used8
+ 00050034 -32700\(gp\) 00040c98
+# __fn_b_used8
+ 00050038 -32696\(gp\) 00040cac
+ 0005003c -32692\(gp\) 00000000
+ 00050040 -32688\(gp\) 00000000
+ 00050044 -32684\(gp\) 00000000
+ 00050048 -32680\(gp\) 00000000
+
+ Global entries:
+ Address Access Initial Sym\.Val\. Type Ndx Name
+ 0005004c -32676\(gp\) 00040e90 00040e90 FUNC 7 a_used17
+ 00050050 -32672\(gp\) 00040f14 00040f14 FUNC 7 b_used19
+ 00050054 -32668\(gp\) 00040f38 00040f38 FUNC 7 a_used20
+ 00050058 -32664\(gp\) 00040e20 00040e20 FUNC 7 a_used15
+ 0005005c -32660\(gp\) 00040db0 00040db0 FUNC 7 a_used13
+ 00050060 -32656\(gp\) 00040ea4 00040ea4 FUNC 7 b_used17
+ 00050064 -32652\(gp\) 00040f4c 00040f4c FUNC 7 b_used20
+ 00050068 -32648\(gp\) 00040f70 00040f70 FUNC 7 a_used21
+ 0005006c -32644\(gp\) 00040f00 00040f00 FUNC 7 a_used19
+ 00050070 -32640\(gp\) 00040e34 00040e34 FUNC 7 b_used15
+ 00050074 -32636\(gp\) 00040f84 00040f84 FUNC 7 b_used21
+ 00050078 -32632\(gp\) 00040dc4 00040dc4 FUNC 7 b_used13
+
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-1.inc b/ld/testsuite/ld-mips-elf/mips16-pic-1.inc
new file mode 100644
index 0000000..9268a07
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-1.inc
@@ -0,0 +1,147 @@
+ # Declare a function called NAME and an __fn_NAME stub for it.
+ # Make the stub use la_TYPE to load the the target address into $2.
+ .macro stub,name,type
+ .set nomips16
+ .section .mips16.fn.\name, "ax", @progbits
+ .ent __fn_\name
+__fn_\name:
+ la_\type \name
+ mfc1 $4,$f12
+ jr $2
+ nop
+ .end __fn_\name
+
+ .set mips16
+ .text
+ .ent \name
+\name:
+__fn_local_\name:
+ jr $31
+ nop
+ .end \name
+ .endm
+
+ # Like stub, but ensure NAME is a local symbol.
+ .macro lstub,name,type
+ stub \name, \type
+ .equ local_\name,1
+ .endm
+
+ # Like stub, but ensure NAME is a hidden symbol.
+ .macro hstub,name,type
+ .globl \name
+ .hidden \name
+ stub \name, \type
+ .endm
+
+ # Like lstub, but make the MIPS16 function global rather than local.
+ .macro gstub,name,type
+ .globl \name
+ stub \name, \type
+ .endm
+
+ # Use an absolute sequence to load NAME into a register.
+ .macro la_noshared,name
+ lui $2,%hi(\name)
+ addiu $2,$2,%lo(\name)
+ .endm
+
+ # Use the normal PIC sequence to load __fn_local_NAME into $2
+ # and emit a dummy relocation against NAME. This macro is always
+ # used at the start of a function.
+ .macro la_shared,name
+ .reloc 0,R_MIPS_NONE,\name
+ .cpload $25
+ la $2,__fn_local_\name
+ .endm
+
+ # Use TYPE (either LSTUB, HSTUB or GSTUB) to define functions
+ # called a_NAME and b_NAME. The former uses absolute accesses
+ # and the latter uses PIC accesses.
+ .macro decl,name,type
+ \type a_\name, noshared
+ \type b_\name, shared
+ .endm
+
+ # Emit the MIPS16 PIC sequence for setting $28 from $25.
+ # Make the value of $25 available in $2 as well.
+ .macro cpload_mips16
+ li $2,%hi(_gp_disp)
+ addiu $3,$pc,%lo(_gp_disp)
+ sll $2,16
+ addu $2,$2,$3
+ move $28,$2
+ .endm
+
+ # Likewise, but for non-MIPS16 code.
+ .macro cpload_nomips16
+ .cpload $25
+ move $2,$28
+ .endm
+
+ # Start a PIC function in ISA mode MODE, which is either "mips16"
+ # or "nomips16".
+ .macro pic_prologue,mode
+ cpload_\mode
+ addiu $sp,$sp,-32
+ sw $2,16($sp)
+ sw $31,20($sp)
+ .endm
+
+ # Use a PIC function to call NAME.
+ .macro pic_call,name,mode
+ .ifdef local_\name
+ .ifc \mode,mips16
+ lw $2,%got(__fn_local_\name)($2)
+ addiu $2,%lo(__fn_local_\name)
+ .else
+ lw $2,%got(\name)($2)
+ addiu $2,%lo(\name)
+ .endif
+ .else
+ lw $2,%call16(\name)($2)
+ .endif
+ jalr $2
+ move $25,$2
+ lw $2,16($sp)
+ move $28,$2
+ .endm
+
+ # Finish a PIC function started by pic_prologue.
+ .macro pic_epilogue
+ lw $2,20($sp)
+ jr $2
+ addiu $sp,$sp,32
+ .endm
+
+ # Use PIC %call16 sequences to call a_NAME and b_NAME.
+ # MODE selects the ISA mode of the code: either "mips16"
+ # or "nomips16".
+ .macro callpic,name,mode
+ .text
+ .set \mode
+ .ent callpic_\name\()_\mode
+callpic_\name\()_\mode:
+ pic_prologue \mode
+ pic_call a_\name,\mode
+ pic_call b_\name,\mode
+ pic_epilogue
+ .end callpic_\name\()_\mode
+ .endm
+
+ # Use absolute jals to call a_NAME and b_NAME. MODE selects the
+ # ISA mode of the code: either "mips16" or "nomips16".
+ .macro jals,name,mode
+ .text
+ .set \mode
+ .ent jals_\name\()_\mode
+jals_\name\()_\mode:
+ .option pic0
+ jal a_\name
+ nop
+
+ jal b_\name
+ nop
+ .option pic2
+ .end jals_\name\()_\mode
+ .endm
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-1.ld b/ld/testsuite/ld-mips-elf/mips16-pic-1.ld
new file mode 100644
index 0000000..91f1464
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-1.ld
@@ -0,0 +1,22 @@
+SECTIONS
+{
+ . = 0x40000;
+ .interp : { *(.interp) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .dynamic : { *(.dynamic) }
+ .reginfo : { *(.reginfo) }
+ .hash : { *(.hash) }
+ . = ALIGN (0x400);
+ .text : { *(.text) *(.mips16.*) }
+ .MIPS.stubs : { *(.MIPS.stubs) }
+ . = ALIGN (0x400);
+ .rel.plt : { *(.rel.plt) }
+ .rel.dyn : { *(.rel.dyn) }
+ . = 0x50000;
+ _gp = . + 0x7ff0;
+ .got : { *(.got) }
+ . = 0x50400;
+ .data : { *(.data) }
+ .rld_map : { *(.rld_map) }
+}
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-1a.s b/ld/testsuite/ld-mips-elf/mips16-pic-1a.s
new file mode 100644
index 0000000..14ea93c
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-1a.s
@@ -0,0 +1,144 @@
+ .abicalls
+ .set noreorder
+ .include "mips16-pic-1.inc"
+
+ # Test local stubs that are only used by MIPS16 PIC calls in this file.
+ decl unused1,lstub
+ callpic unused1,mips16
+
+ # Test local stubs that are only used by MIPS16 jals in this file.
+ decl unused2,lstub
+ jals unused2,mips16
+
+ # Test local stubs that aren't called at all.
+ decl unused3,lstub
+
+ # Test hidden stubs that are called by MIPS16 PIC calls in this file.
+ decl unused4,hstub
+ callpic unused4,mips16
+
+ # Test hidden stubs that are called by MIPS16 jals in this file.
+ decl unused5,hstub
+ jals unused5,mips16
+
+ # Test hidden stubs that are called by MIPS16 PIC calls in another file.
+ decl unused6,hstub
+
+ # Test hidden stubs that are called by MIPS16 jals in another file.
+ decl unused7,hstub
+
+ # Test hidden stubs that aren't called at all.
+ decl unused8,hstub
+
+ # Test global stubs that are called by MIPS16 jals in this file.
+ decl unused9,gstub
+ jals unused9,mips16
+
+ # Test global stubs that are called by MIPS16 jals in another file.
+ decl unused10,gstub
+
+ # Test global stubs that aren't called at all.
+ decl unused11,gstub
+
+ # Test local stubs that are used by non-MIPS16 PIC calls in this file.
+ decl used1,lstub
+ callpic used1,nomips16
+
+ # Test local stubs that are used by non-MIPS16 jals in this file.
+ decl used2,lstub
+ jals used2,nomips16
+
+ # Test local stubs that are used by both MIPS16 and non-MIPS16 PIC
+ # calls in this file.
+ decl used3,lstub
+ callpic used3,nomips16
+ callpic used3,mips16
+
+ # Test local stubs that are used by both MIPS16 and non-MIPS16 jals
+ # in this file.
+ decl used4,lstub
+ jals used4,nomips16
+ jals used4,mips16
+
+ # Test local stubs that are used by a combination of MIPS16 PIC calls
+ # and non-MIPS16 jals in this file.
+ decl used5,lstub
+ jals used5,nomips16
+ callpic used5,mips16
+
+ # Test hidden stubs that are used by non-MIPS16 PIC calls in this file.
+ decl used6,hstub
+ callpic used6,nomips16
+
+ # Test hidden stubs that are used by non-MIPS16 jals in this file.
+ decl used7,hstub
+ jals used7,nomips16
+
+ # Test hidden stubs that are used by non-MIPS16 PIC calls in another
+ # file.
+ decl used8,hstub
+
+ # Test hidden stubs that are used by non-MIPS16 jals in another
+ # file.
+ decl used9,hstub
+
+ # Test hidden stubs that are used by both MIPS16 and non-MIPS16 PIC
+ # calls in this file.
+ decl used10,hstub
+ callpic used10,nomips16
+ callpic used10,mips16
+
+ # Test hidden stubs that are used by both MIPS16 and non-MIPS16 jals
+ # in this file.
+ decl used11,hstub
+ jals used11,nomips16
+ jals used11,mips16
+
+ # Test hidden stubs that are used by a combination of MIPS16 PIC calls
+ # and non-MIPS16 jals in this file.
+ decl used12,hstub
+ jals used12,nomips16
+ callpic used12,mips16
+
+ # Test global stubs that are used by non-MIPS16 PIC calls in this file.
+ decl used13,gstub
+ callpic used13,nomips16
+
+ # Test global stubs that are used by non-MIPS16 jals in this file.
+ decl used14,gstub
+ jals used14,nomips16
+
+ # Test global stubs that are used by non-MIPS16 PIC calls in another
+ # file.
+ decl used15,gstub
+
+ # Test global stubs that are used by non-MIPS16 jals in another file.
+ decl used16,gstub
+
+ # Test global stubs that are used by both MIPS16 and non-MIPS16 PIC
+ # calls in this file.
+ decl used17,gstub
+ callpic used17,nomips16
+ callpic used17,mips16
+
+ # Test global stubs that are used by both MIPS16 and non-MIPS16 jals
+ # in this file.
+ decl used18,gstub
+ jals used18,nomips16
+ jals used18,mips16
+
+ # Test global stubs that are used by a combination of MIPS16 PIC calls
+ # and non-MIPS16 jals in this file.
+ decl used19,gstub
+ jals used19,nomips16
+ callpic used19,mips16
+
+ # Test global stubs that are used by MIPS16 PIC calls in this file.
+ # We currently force all targets of call16 relocations to be dynamic,
+ # and the stub must be the definition of the dynamic symbol.
+ decl used20,gstub
+ callpic used20,mips16
+
+ # Test global stubs that are used by MIPS16 PIC calls in another file.
+ # Needed for the same reason as used21.
+ decl used21,gstub
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-1b.s b/ld/testsuite/ld-mips-elf/mips16-pic-1b.s
new file mode 100644
index 0000000..9a17072
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-1b.s
@@ -0,0 +1,19 @@
+ .abicalls
+ .set noreorder
+ .include "mips16-pic-1.inc"
+
+ callpic unused6,mips16
+ jals unused7,mips16
+ jals unused10,mips16
+ callpic used8,nomips16
+ jals used9,nomips16
+ callpic used15,nomips16
+ jals used16,nomips16
+ callpic used21,mips16
+
+ .globl __start
+ .ent __start
+ .set nomips16
+__start:
+ nop
+ .end __start
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-2.ad b/ld/testsuite/ld-mips-elf/mips16-pic-2.ad
new file mode 100644
index 0000000..95c53e5
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-2.ad
@@ -0,0 +1,6 @@
+# [MIPS_GOTSYM, MIPS_SYMTABNO) covers used4...used7.
+#...
+ .* \(MIPS_SYMTABNO\) * 10
+#...
+ .* \(MIPS_GOTSYM\) * 0x6
+#pass
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-2.dd b/ld/testsuite/ld-mips-elf/mips16-pic-2.dd
new file mode 100644
index 0000000..75ea6dc
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-2.dd
@@ -0,0 +1,208 @@
+
+.*
+
+
+Disassembly of section \.text:
+
+00040400 <unused1>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040404 <unused2>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040408 <unused3>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004040c <unused4>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040410 <unused5>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040414 <used1>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040418 <used2>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004041c <used3>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040420 <\.mips16\.used4>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040424 <\.mips16\.used5>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040428 <\.mips16\.used6>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+0004042c <\.mips16\.used7>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040430 <\.mips16\.used8>:
+.*: [^\t]* jr ra
+.*: [^\t]* nop
+
+00040434 <foo>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+# 40400: unused1
+.*: [^\t]* lw v0,-32744\(v0\)
+.*: [^\t]* addiu v0,1025
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32740\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32708\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+#...
+
+00040480 <bar>:
+.*: [^\t]* li v0,1
+.*: [^\t]* la v1,47ff0 <.*>
+.*: [^\t]* sll v0,16
+.*: [^\t]* addu v0,v1
+.*: [^\t]* move gp,v0
+.*: [^\t]* addiu sp,-32
+.*: [^\t]* sw v0,16\(sp\)
+.*: [^\t]* sw ra,20\(sp\)
+.*: [^\t]* lw v0,-32736\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,-32696\(v0\)
+.*: [^\t]* jalr v0
+.*: [^\t]* move t9,v0
+.*: [^\t]* lw v0,16\(sp\)
+.*: [^\t]* move gp,v0
+.*: [^\t]* lw v0,20\(sp\)
+.*: [^\t]* jr v0
+.*: [^\t]* addiu sp,32
+#...
+
+000404c0 <__fn_used1>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 40414: used1
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1045
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+000404e4 <__fn_used2>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 40418: used2
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1049
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040508 <__fn_used3>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 4041c: used3
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1053
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+0004052c <used4>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 40420: used4
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1057
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040550 <used5>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 40424: used5
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1061
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040574 <used6>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 40428: used6
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1065
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+00040598 <used7>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 4042c: used7
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1069
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
+
+000405bc <used8>:
+.*: [^\t]* lui gp,.*
+.*: [^\t]* addiu gp,gp,.*
+.*: [^\t]* addu gp,gp,t9
+# 40430: used8
+.*: [^\t]* lw v0,-32744\(gp\)
+.*: [^\t]* nop
+.*: [^\t]* addiu v0,v0,1073
+.*: [^\t]* mfc1 a0,\$f12
+.*: [^\t]* jr v0
+.*: [^\t]* nop
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-2.gd b/ld/testsuite/ld-mips-elf/mips16-pic-2.gd
new file mode 100644
index 0000000..ebc341e
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-2.gd
@@ -0,0 +1,28 @@
+
+Primary GOT:
+ Canonical gp value: 00057ff0
+
+ Reserved entries:
+ Address Access Initial Purpose
+ 00050000 -32752\(gp\) 00000000 Lazy resolver
+ 00050004 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+ Local entries:
+ Address Access Initial
+ 00050008 -32744\(gp\) 00040000
+ 0005000c -32740\(gp\) 00040409
+ 00050010 -32736\(gp\) 0004040d
+ 00050014 -32732\(gp\) 00000000
+ 00050018 -32728\(gp\) 00000000
+ 0005001c -32724\(gp\) 00000000
+ 00050020 -32720\(gp\) 00000000
+ 00050024 -32716\(gp\) 00000000
+ 00050028 -32712\(gp\) 00000000
+
+ Global entries:
+ Address Access Initial Sym\.Val\. Type Ndx Name
+ 0005002c -32708\(gp\) 00040574 00040574 FUNC 6 used6
+ 00050030 -32704\(gp\) 0004052c 0004052c FUNC 6 used4
+ 00050034 -32700\(gp\) 00040550 00040550 FUNC 6 used5
+ 00050038 -32696\(gp\) 00040598 00040598 FUNC 6 used7
+
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-2.nd b/ld/testsuite/ld-mips-elf/mips16-pic-2.nd
new file mode 100644
index 0000000..c4ad9fd
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-2.nd
@@ -0,0 +1,10 @@
+# used8 should come before MIPS_GOTSYM.
+#...
+ 4: 000405bc 36 FUNC GLOBAL DEFAULT .* used8
+ 5: .* _GLOBAL_OFFSET_TABLE_
+ 6: 00040574 36 FUNC GLOBAL DEFAULT .* used6
+ 7: 0004052c 36 FUNC GLOBAL DEFAULT .* used4
+ 8: 00040550 36 FUNC GLOBAL DEFAULT .* used5
+ 9: 00040598 36 FUNC GLOBAL DEFAULT .* used7
+
+#pass
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-2.rd b/ld/testsuite/ld-mips-elf/mips16-pic-2.rd
new file mode 100644
index 0000000..8411dbe
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-2.rd
@@ -0,0 +1,9 @@
+
+Relocation section '\.rel\.dyn' .*:
+.*
+0+00000 * [0-9]+ * R_MIPS_NONE *
+0+50400 * [0-9]+ * R_MIPS_REL32 *
+0+50404 * [0-9]+ * R_MIPS_REL32 *
+0+50410 * [0-9]+ * R_MIPS_REL32 *
+0+50408 * [0-9]+ * R_MIPS_REL32 * 0004052c * used4
+0+50414 * [0-9]+ * R_MIPS_REL32 * 00040550 * used5
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-2a.s b/ld/testsuite/ld-mips-elf/mips16-pic-2a.s
new file mode 100644
index 0000000..08a1269
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-2a.s
@@ -0,0 +1,63 @@
+ .abicalls
+ .set noreorder
+ .include "mips16-pic-1.inc"
+
+ # Test local stubs that are only used by MIPS16 PIC calls in this file.
+ lstub unused1,shared
+
+ # Test local stubs that aren't called at all.
+ lstub unused2,shared
+
+ # Test hidden stubs that are called by MIPS16 PIC calls in this file.
+ hstub unused3,shared
+
+ # Test hidden stubs that are called by MIPS16 PIC calls in another file.
+ hstub unused4,shared
+
+ # Test hidden stubs that aren't called at all.
+ hstub unused5,shared
+
+
+ # Test local stubs that are referenced by absolute relocations
+ # in this file.
+ lstub used1,shared
+
+ # Test hidden stubs that are referenced by absolute relocations
+ # in this file.
+ hstub used2,shared
+
+ # Test hidden stubs that are referenced by absolute relocations
+ # in another file.
+ hstub used3,shared
+
+ # Test global stubs that are referenced by absolute relocations
+ # in this file.
+ gstub used4,shared
+
+ # Test global stubs that are referenced by absolute relocations
+ # in another file.
+ gstub used5,shared
+
+ # Test global stubs that are called by MIPS16 PIC calls in this file.
+ gstub used6,shared
+
+ # Test global stubs that are called by MIPS16 PIC calls in another file.
+ gstub used7,shared
+
+ # Test global stubs that aren't referenced at all.
+ gstub used8,shared
+
+ .set mips16
+ .ent foo
+foo:
+ pic_prologue mips16
+ pic_call unused1,mips16
+ pic_call unused3,mips16
+ pic_call used6,mips16
+ pic_epilogue
+ .end foo
+
+ .data
+ .word used1
+ .word used2
+ .word used4
diff --git a/ld/testsuite/ld-mips-elf/mips16-pic-2b.s b/ld/testsuite/ld-mips-elf/mips16-pic-2b.s
new file mode 100644
index 0000000..2a66b5a
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/mips16-pic-2b.s
@@ -0,0 +1,16 @@
+ .abicalls
+ .set noreorder
+ .include "mips16-pic-1.inc"
+
+ .set mips16
+ .ent bar
+bar:
+ pic_prologue mips16
+ pic_call unused4,mips16
+ pic_call used7,mips16
+ pic_epilogue
+ .end bar
+
+ .data
+ .word used3
+ .word used5