mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-04 07:44:22 +08:00
738e53487d
* 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.
145 lines
3.9 KiB
ArmAsm
145 lines
3.9 KiB
ArmAsm
.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
|