2015-10-29 Catherine Moore <clm@codesourcery.com>
authorCatherine Moore <clm@codesourcery.com>
Thu, 29 Oct 2015 13:58:16 +0000 (06:58 -0700)
committerCatherine Moore <clm@codesourcery.com>
Thu, 29 Oct 2015 13:58:16 +0000 (06:58 -0700)
     bfd/
     * elfxx-mips.c (mips_elf_check_mips16_stubs): Set a stub's output
     section to bfd_abs_section_ptr if the stub is discarded.

     ld/testsuite/
     * ld-mips-elf/mips16-fp-stub-1.s: New.
     * ld-mips-elf/mips16-fp-stub-2.s: New.
     * ld-mips-elf/mips16-fp-stub.d: New.
     * ld-mips-elf/mips-elf.exp: Run new tests.
     * ld-mips-elf/mips16-intermix.d: Update expected output.

https://sourceware.org/ml/binutils/2015-10/msg00137.html

bfd/ChangeLog
bfd/elfxx-mips.c
ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/mips-elf.exp
ld/testsuite/ld-mips-elf/mips16-fp-stub-1.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/mips16-fp-stub-2.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/mips16-fp-stub.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/mips16-intermix.d

index 41cfcbe2342eecbc54daadeb6ee1ca3dc44c5524..593848148d2be6bd49fc7ea4129cd8c2d4c19789 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-29  Catherine Moore  <clm@codesourcery.com>
+    
+       * elfxx-mips.c (mips_elf_check_mips16_stubs): Set a stub's output
+       section to bfd_abs_section_ptr if the stub is discarded.
+
 2015-10-29  Ed Schouten  <ed@nuxi.nl>
 
        * config.bfd (targ_defvec): Add support for CloudABI on aarch64.
index 12d7a03d63119f4ae1344b67d81f8eb94a3f888d..57e1b6d9cf554c9fd327271f39c150fcd0f09359 100644 (file)
@@ -1707,6 +1707,7 @@ mips_elf_check_mips16_stubs (struct bfd_link_info *info,
       h->fn_stub->flags &= ~SEC_RELOC;
       h->fn_stub->reloc_count = 0;
       h->fn_stub->flags |= SEC_EXCLUDE;
+      h->fn_stub->output_section = bfd_abs_section_ptr;
     }
 
   if (h->call_stub != NULL
@@ -1719,6 +1720,7 @@ mips_elf_check_mips16_stubs (struct bfd_link_info *info,
       h->call_stub->flags &= ~SEC_RELOC;
       h->call_stub->reloc_count = 0;
       h->call_stub->flags |= SEC_EXCLUDE;
+      h->call_stub->output_section = bfd_abs_section_ptr;
     }
 
   if (h->call_fp_stub != NULL
@@ -1731,6 +1733,7 @@ mips_elf_check_mips16_stubs (struct bfd_link_info *info,
       h->call_fp_stub->flags &= ~SEC_RELOC;
       h->call_fp_stub->reloc_count = 0;
       h->call_fp_stub->flags |= SEC_EXCLUDE;
+      h->call_fp_stub->output_section = bfd_abs_section_ptr;
     }
 }
 
index f0124f999faf4e7c86188c0ef4fb5fff07bac082..d775f1142914ad32cfba851ec7f802886ee26bed 100644 (file)
@@ -1,3 +1,11 @@
+2015-10-29  Catherine Moore  <clm@codesourcery.com>
+    
+       * ld-mips-elf/mips16-fp-stub-1.s: New.
+       * ld-mips-elf/mips16-fp-stub-2.s: New.
+       * ld-mips-elf/mips16-fp-stub.d: New.
+       * ld-mips-elf/mips-elf.exp: Run new tests.
+       * ld-mips-elf/mips16-intermix.d: Update expected output.
+
 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/19162
index dd8b2288623e2644fce77b1662d8bf710227efa0..3b02bc0e245cefcb58f6a62510ad99903f39d0fc 100644 (file)
@@ -666,6 +666,16 @@ run_ld_link_tests $mips16_intermix_test
 
 run_dump_test "mips16-local-stubs-1"
 
+set mips16_fp_stub_test [list \
+    [list "Floating-point stub for mips16 functions" \
+        "$abi_ldflags(o32)" "" \
+        "$abi_asflags(o32) -mips32r2" \
+        {mips16-fp-stub-1.s mips16-fp-stub-2.s} \
+        {{readelf --debug-dump=frames mips16-fp-stub.d}} \
+        "mips16-fp-stub"]]
+
+run_ld_link_tests $mips16_fp_stub_test
+
 set o32flagslist [list [list as $abi_asflags(o32)] [list ld $abi_ldflags(o32)]]
 
 foreach firstfpabi [list 0 1 2 3 4 5 6 7 ] {
diff --git a/ld/testsuite/ld-mips-elf/mips16-fp-stub-1.s b/ld/testsuite/ld-mips-elf/mips16-fp-stub-1.s
new file mode 100644 (file)
index 0000000..98a5067
--- /dev/null
@@ -0,0 +1,58 @@
+       .file   1 "mips-fp-stub-1.c"
+       .section .mdebug.abi32
+       .previous
+       .nan    legacy
+       .module fp=32
+       .module oddspreg
+       # Stub function to call float foo (float, float)
+       .section        .mips16.call.fp.foo,"ax",@progbits
+       .align  2
+       .set    nomips16
+       .set    nomicromips
+       .ent    __call_stub_fp_foo
+       .type   __call_stub_fp_foo, @function
+__call_stub_fp_foo:
+       .cfi_startproc
+       .cfi_def_cfa 29,-4
+       .cfi_escape 0x16,29,1,0x6d
+       move    $18,$31
+       mtc1    $4,$f12
+       mtc1    $5,$f14
+       jal     foo
+       .cfi_register 31,18
+       mfc1    $2,$f0
+       jr      $18
+       .cfi_endproc
+       .size   __call_stub_fp_foo, .-__call_stub_fp_foo
+       .end    __call_stub_fp_foo
+       .text
+       .align  2
+       .globl  main
+       .set    mips16
+       .set    nomicromips
+       .ent    main
+       .type   main, @function
+main:
+       .frame  $17,24,$31              # vars= 8, regs= 3/0, args= 16, gp= 0
+       .mask   0x80060000,-4
+       .fmask  0x00000000,0
+       save    40,$17,$18,$31
+       addiu   $17,$sp,16
+       lw      $3,.L3
+       lw      $2,.L4
+       move    $5,$3
+       move    $4,$2
+       jal     foo
+       sw      $2,0($17)
+       li      $2,0
+       move    $sp,$17
+       restore 24,$17,$18,$31
+       j       $31
+       .align  2
+.L3:
+       .word   1085485875
+.L4:
+       .word   1065353216
+       .end    main
+       .size   main, .-main
+       .ident  "GCC: (Sourcery CodeBench Lite 2015.11-12 - Preview) 5.2.0"
diff --git a/ld/testsuite/ld-mips-elf/mips16-fp-stub-2.s b/ld/testsuite/ld-mips-elf/mips16-fp-stub-2.s
new file mode 100644 (file)
index 0000000..d63cc7c
--- /dev/null
@@ -0,0 +1,43 @@
+       .file   1 "mips-fp-stub-2.c"
+       .section .mdebug.abi32
+       .previous
+       .nan    legacy
+       .module fp=32
+       .module oddspreg
+       .text
+       .align  2
+       .globl  foo
+       # Stub function for foo (float, float)
+       .section        .mips16.fn.foo,"ax",@progbits
+       .align  2
+       .set    nomips16
+       .set    nomicromips
+       .ent    __fn_stub_foo
+       .type   __fn_stub_foo, @function
+__fn_stub_foo:
+       la      $25,foo
+       mfc1    $4,$f12
+       mfc1    $5,$f14
+       jr      $25
+       .end    __fn_stub_foo
+       __fn_local_foo = foo
+       .text
+       .set    mips16
+       .set    nomicromips
+       .ent    foo
+       .type   foo, @function
+foo:
+       .frame  $17,8,$31               # vars= 0, regs= 2/0, args= 0, gp= 0
+       .mask   0x80020000,-4
+       .fmask  0x00000000,0
+       save    8,$17,$31
+       move    $17,$sp
+       sw      $4,8($17)
+       sw      $5,12($17)
+       lw      $2,8($17)
+       move    $sp,$17
+       restore 8,$17,$31
+       j       $31
+       .end    foo
+       .size   foo, .-foo
+       .ident  "GCC: (Sourcery CodeBench Lite 2015.11-12 - Preview) 5.2.0"
diff --git a/ld/testsuite/ld-mips-elf/mips16-fp-stub.d b/ld/testsuite/ld-mips-elf/mips16-fp-stub.d
new file mode 100644 (file)
index 0000000..1d4aa28
--- /dev/null
@@ -0,0 +1,2 @@
+
+Section '\.eh_frame' has no debugging data\.
index 10c727063249800f46ff0c24317ef948932f11af..9318e3b941441fa65146434eb781cd24315265a9 100644 (file)
@@ -60,9 +60,6 @@ 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
-# ??? 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]+ m32_static1_d_d
@@ -94,6 +91,9 @@ SYMBOL TABLE:
 .* l     F .text       0+[0-9a-f]+ __call_stub_fp_m16_static16_d_l
 .* l     F .text       0+[0-9a-f]+ __call_stub_fp_m32_static16_d_d
 .* l     F .text       0+[0-9a-f]+ __call_stub_fp_m16_static16_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    df \*ABS\*     0+[0-9a-f]+ *
 #...
 .* g     F .text       0+[0-9a-f]+ m32_ld
 #...