From: Richard Sandiford Date: Thu, 10 Jul 2008 19:05:29 +0000 (+0000) Subject: include/elf/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=30c090907953c55bb80ec4af160054776d32303e;p=binutils-gdb.git include/elf/ * mips.h (ELF_ST_IS_MIPS16, ELF_ST_SET_MIPS16): New macros. bfd/ * elfxx-mips.c (mips_elf_check_mips16_stubs): Use ELF_ST_IS_MIPS16. (mips_elf_calculate_relocation): Likewise. (_bfd_mips_elf_add_symbol_hook): Likewise. (_bfd_mips_elf_finish_dynamic_symbol): Likewise. (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise. opcodes/ * mips-dis.c (_print_insn_mips): Use ELF_ST_IS_MIPS16. gas/ * config/tc-mips.c (mips16_mark_labels): Use ELF_ST_SET_MIPS16. (mips_fix_adjustable): Likewise. (mips_frob_file_after_relocs): Likewise. gas/testsuite/ * gas/mips/mips16-vis-1.d, gas/mips/mips16-vis-1.s: New tests. * gas/mips/mips.exp: Run them. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 291aebf7477..60ba1a37a44 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2008-07-10 Richard Sandiford + + * elfxx-mips.c (mips_elf_check_mips16_stubs): Use ELF_ST_IS_MIPS16. + (mips_elf_calculate_relocation): Likewise. + (_bfd_mips_elf_add_symbol_hook): Likewise. + (_bfd_mips_elf_finish_dynamic_symbol): Likewise. + (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise. + 2008-07-10 Andreas Schwab * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Add missing diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 08399131f59..fabae69cdf3 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -1172,7 +1172,7 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h, } if (h->call_stub != NULL - && h->root.other == STO_MIPS16) + && ELF_ST_IS_MIPS16 (h->root.other)) { /* We don't need the call_stub; this is a 16 bit function, so calls from other 16 bit functions are OK. Clobber the size @@ -1184,7 +1184,7 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h, } if (h->call_fp_stub != NULL - && h->root.other == STO_MIPS16) + && ELF_ST_IS_MIPS16 (h->root.other)) { /* We don't need the call_stub; this is a 16 bit function, so calls from other 16 bit functions are OK. Clobber the size @@ -4182,7 +4182,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, } /* MIPS16 text labels should be treated as odd. */ - if (sym->st_other == STO_MIPS16) + if (ELF_ST_IS_MIPS16 (sym->st_other)) ++symbol; /* Record the name of this symbol, for our caller. */ @@ -4192,7 +4192,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, if (*namep == '\0') *namep = bfd_section_name (input_bfd, sec); - target_is_16_bit_code_p = (sym->st_other == STO_MIPS16); + target_is_16_bit_code_p = ELF_ST_IS_MIPS16 (sym->st_other); } else { @@ -4288,7 +4288,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, symbol = 0; } - target_is_16_bit_code_p = (h->root.other == STO_MIPS16); + target_is_16_bit_code_p = ELF_ST_IS_MIPS16 (h->root.other); } /* If this is a 32- or 64-bit call to a 16-bit function with a stub, we @@ -6121,7 +6121,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, /* If this is a mips16 text symbol, add 1 to the value to make it odd. This will cause something like .word SYM to come up with the right value when it is loaded into the PC. */ - if (sym->st_other == STO_MIPS16) + if (ELF_ST_IS_MIPS16 (sym->st_other)) ++*valp; return TRUE; @@ -6144,7 +6144,7 @@ _bfd_mips_elf_link_output_symbol_hook && strcmp (input_sec->name, ".scommon") == 0) sym->st_shndx = SHN_MIPS_SCOMMON; - if (sym->st_other == STO_MIPS16) + if (ELF_ST_IS_MIPS16 (sym->st_other)) sym->st_value &= ~1; return TRUE; @@ -8721,7 +8721,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, } /* If this is a mips16 symbol, force the value to be even. */ - if (sym->st_other == STO_MIPS16) + if (ELF_ST_IS_MIPS16 (sym->st_other)) sym->st_value &= ~1; return TRUE; @@ -8893,7 +8893,7 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, } /* If this is a mips16 symbol, force the value to be even. */ - if (sym->st_other == STO_MIPS16) + if (ELF_ST_IS_MIPS16 (sym->st_other)) sym->st_value &= ~1; return TRUE; diff --git a/gas/ChangeLog b/gas/ChangeLog index 16ee4def211..447c152923d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2008-07-10 Richard Sandiford + + * config/tc-mips.c (mips16_mark_labels): Use ELF_ST_SET_MIPS16. + (mips_fix_adjustable): Likewise. + (mips_frob_file_after_relocs): Likewise. + 2008-07-08 Nathan Sidwell * config/tc-m68k.c (m68k_set_cpu, m68k_set_arch): Don't complain diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index d5ed84ceb2b..d12d3c412b6 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -2321,7 +2321,7 @@ mips16_mark_labels (void) #if defined(OBJ_ELF) || defined(OBJ_MAYBE_ELF) if (IS_ELF) - S_SET_OTHER (label, STO_MIPS16); + S_SET_OTHER (label, ELF_ST_SET_MIPS16 (S_GET_OTHER (label))); #endif if ((S_GET_VALUE (label) & 1) == 0 /* Don't adjust the address if the label is global or weak, or @@ -13976,7 +13976,7 @@ mips_fix_adjustable (fixS *fixp) that we have for MIPS16 symbols. */ if (IS_ELF && fixp->fx_subsy == NULL - && (S_GET_OTHER (fixp->fx_addsy) == STO_MIPS16 + && (ELF_ST_IS_MIPS16 (S_GET_OTHER (fixp->fx_addsy)) || *symbol_get_tc (fixp->fx_addsy))) return 0; #endif @@ -14453,7 +14453,7 @@ mips_frob_file_after_relocs (void) count = bfd_get_symcount (stdoutput); for (i = 0; i < count; i++, syms++) { - if (elf_symbol (*syms)->internal_elf_sym.st_other == STO_MIPS16 + if (ELF_ST_IS_MIPS16 (elf_symbol (*syms)->internal_elf_sym.st_other) && ((*syms)->value & 1) != 0) { (*syms)->value &= ~1; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index d3cead1b6a9..680badd06e5 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-07-10 Richard Sandiford + + * gas/mips/mips16-vis-1.d, gas/mips/mips16-vis-1.s: New tests. + * gas/mips/mips.exp: Run them. + 2008-07-09 Kai Tietz * gas/i386/i386.exp (x86-64-pcrel): Disable for w64. diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 8ee4646ecf0..16edfb73a9b 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -827,4 +827,6 @@ if { [istarget mips*-*-vxworks*] } { run_list_test_arches "mips-double-float-flag" \ "-32 -msingle-float -mdouble-float" \ [mips_arch_list_matching mips1] + + run_dump_test "mips16-vis-1" } diff --git a/gas/testsuite/gas/mips/mips16-vis-1.d b/gas/testsuite/gas/mips/mips16-vis-1.d new file mode 100644 index 00000000000..7cdce48265e --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-vis-1.d @@ -0,0 +1,3 @@ +# readelf: --symbols +#... +.*: 0+0 * 2 * FUNC * GLOBAL * HIDDEN \[MIPS16\] * [0-9]+ foo diff --git a/gas/testsuite/gas/mips/mips16-vis-1.s b/gas/testsuite/gas/mips/mips16-vis-1.s new file mode 100644 index 00000000000..01cb1baf41c --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-vis-1.s @@ -0,0 +1,7 @@ + .set mips16 + .globl foo + .hidden foo + .ent foo +foo: + nop + .end foo diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 9fc0fd8369f..9f6198255d3 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,7 @@ +2008-07-10 Richard Sandiford + + * mips.h (ELF_ST_IS_MIPS16, ELF_ST_SET_MIPS16): New macros. + 2008-06-18 M R Swami Reddy * common.h (EM_CR16): Correct value. diff --git a/include/elf/mips.h b/include/elf/mips.h index 55ecfb3c040..474f54ff4e8 100644 --- a/include/elf/mips.h +++ b/include/elf/mips.h @@ -725,6 +725,8 @@ extern void bfd_mips_elf32_swap_reginfo_out /* This value is used for a mips16 .text symbol. */ #define STO_MIPS16 0xf0 +#define ELF_ST_IS_MIPS16(OTHER) (((OTHER) & 0xf0) == STO_MIPS16) +#define ELF_ST_SET_MIPS16(OTHER) (((OTHER) & ~0xf0) | STO_MIPS16) /* This bit is used on Irix to indicate a symbol whose definition is optional - if, at final link time, it cannot be found, no diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 762c7247ac9..4110c10dfa0 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2008-07-10 Richard Sandiford + + * mips-dis.c (_print_insn_mips): Use ELF_ST_IS_MIPS16. + 2008-07-07 Adam Nemet * mips-opc.c (CP): New macro. diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c index 35a51191525..744d5a92bcb 100644 --- a/opcodes/mips-dis.c +++ b/opcodes/mips-dis.c @@ -2068,8 +2068,8 @@ _print_insn_mips (bfd_vma memaddr, if (info->mach == bfd_mach_mips16 || (info->symbols != NULL && bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour - && ((*(elf_symbol_type **) info->symbols)->internal_elf_sym.st_other - == STO_MIPS16))) + && ELF_ST_IS_MIPS16 ((*(elf_symbol_type **) info->symbols) + ->internal_elf_sym.st_other))) return print_insn_mips16 (memaddr, info); #endif