2015-10-29 Catherine Moore <clm@codesourcery.com>

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
This commit is contained in:
Catherine Moore 2015-10-29 06:58:16 -07:00
parent a75cf613fd
commit ca9584fb9b
8 changed files with 132 additions and 3 deletions

View 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.

View 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;
}
}

View 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

View 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 ] {

View File

@ -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"

View File

@ -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"

View File

@ -0,0 +1,2 @@
Section '\.eh_frame' has no debugging data\.

View 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
#...