diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index fa14e8d..fd1deaa 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -1708,6 +1708,7 @@ mips_elf_check_mips16_stubs (struct bfd_link_info *info, h->fn_stub->reloc_count = 0; h->fn_stub->flags |= SEC_EXCLUDE; h->fn_stub->output_section = bfd_abs_section_ptr; + h->fn_stub = bfd_abs_section_ptr; } if (h->call_stub != NULL @@ -1721,6 +1722,7 @@ mips_elf_check_mips16_stubs (struct bfd_link_info *info, h->call_stub->reloc_count = 0; h->call_stub->flags |= SEC_EXCLUDE; h->call_stub->output_section = bfd_abs_section_ptr; + h->call_stub = bfd_abs_section_ptr; } if (h->call_fp_stub != NULL @@ -1734,6 +1736,7 @@ mips_elf_check_mips16_stubs (struct bfd_link_info *info, h->call_fp_stub->reloc_count = 0; h->call_fp_stub->flags |= SEC_EXCLUDE; h->call_fp_stub->output_section = bfd_abs_section_ptr; + h->call_fp_stub = bfd_abs_section_ptr; } } diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index c5ce5bc..8e9ef40 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -666,15 +666,15 @@ 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" \ +set mips16_stub_test [list \ + [list "Stubs 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"]] + {mips16-stub-1.s mips16-stub-2.s mips16-stub-3.s} \ + {{readelf --debug-dump=frames mips16-stub.d}} \ + "mips16-stub"]] -run_ld_link_tests $mips16_fp_stub_test +run_ld_link_tests $mips16_stub_test set o32flagslist [list [list as $abi_asflags(o32)] [list ld $abi_ldflags(o32)]] diff --git a/ld/testsuite/ld-mips-elf/mips16-fp-stub-1.s b/ld/testsuite/ld-mips-elf/mips16-fp-stub-1.s deleted file mode 100644 index 98a5067..0000000 --- a/ld/testsuite/ld-mips-elf/mips16-fp-stub-1.s +++ /dev/null @@ -1,58 +0,0 @@ - .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 deleted file mode 100644 index d63cc7c..0000000 --- a/ld/testsuite/ld-mips-elf/mips16-fp-stub-2.s +++ /dev/null @@ -1,43 +0,0 @@ - .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 deleted file mode 100644 index 1d4aa28..0000000 --- a/ld/testsuite/ld-mips-elf/mips16-fp-stub.d +++ /dev/null @@ -1,2 +0,0 @@ - -Section '\.eh_frame' has no debugging data\. diff --git a/ld/testsuite/ld-mips-elf/mips16-stub-1.s b/ld/testsuite/ld-mips-elf/mips16-stub-1.s new file mode 100644 index 0000000..98a5067 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-stub-1.s @@ -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-stub-2.s b/ld/testsuite/ld-mips-elf/mips16-stub-2.s new file mode 100644 index 0000000..d63cc7c --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-stub-2.s @@ -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-stub-3.s b/ld/testsuite/ld-mips-elf/mips16-stub-3.s new file mode 100644 index 0000000..4bb45a7 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-stub-3.s @@ -0,0 +1,44 @@ + .section .mips16.call.bar,"ax",@progbits + .align 2 + .set nomips16 + .set nomicromips + .ent __call_stub_foo + .type __call_stub_foo, @function +__call_stub_foo: + .cfi_startproc + .cfi_def_cfa 29,-4 + .cfi_escape 0x16,29,1,0x6d + lui $25,%hi(foo) + addiu $25,$25,%lo(foo) + mtc1 $5,$f12 + mtc1 $4,$f13 + jr $25 + .cfi_endproc + .size __call_stub_foo, .-__call_stub_foo + .end __call_stub_foo + .text + .align 2 + .globl bar +.LFB0 = . + .set mips16 + .set nomicromips + .ent bar + .type bar, @function +bar: + .frame $17,32,$31 + .mask 0x80070000,-4 + .fmask 0x00000000,0 + save 48,$16,$17,$18,$31 + addiu $17,$sp,16 + move $16,$28 + sw $3,4($17) + sw $2,0($17) + sw $2,8($17) + lw $3,4($17) + lw $2,0($17) + jal bar + j $31 + .align 2 + .end bar +.LFE0: + .size bar, .-bar diff --git a/ld/testsuite/ld-mips-elf/mips16-stub.d b/ld/testsuite/ld-mips-elf/mips16-stub.d new file mode 100644 index 0000000..1d4aa28 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-stub.d @@ -0,0 +1,2 @@ + +Section '\.eh_frame' has no debugging data\.