This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Fix -minterlink-mips16 for weak symbols
- From: Richard Sandiford <rsandifo at nildram dot co dot uk>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 06 Dec 2007 18:02:00 +0000
- Subject: [committed] Fix -minterlink-mips16 for weak symbols
This patch fixes a silly bug: the -minterlink-mips16 code was
allowing calls to all locally-defined functions, rather than to all
functions that are both locally-defined and locally-binding. This broke
libstdc++ testing for some -mips16 tests on mipsisa64-elfoabi (once the
C++ libraries were built with optimisation enabled) because we had sibling
calls to locally-defined weak functions.
Tested on mipsisa64-elfoabi and applied.
Richard
gcc/
* config/mips/mips.c (mips_function_ok_for_sibcall): Check
targetm.binds_local_p as well as DECL_EXTERNAL.
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c 2007-12-05 22:50:39.000000000 +0000
+++ gcc/config/mips/mips.c 2007-12-06 17:33:32.000000000 +0000
@@ -5611,12 +5611,12 @@ mips_function_ok_for_sibcall (tree decl,
&& const_call_insn_operand (XEXP (DECL_RTL (decl), 0), VOIDmode))
return false;
- /* When -minterlink-mips16 is in effect, assume that external
- functions could be MIPS16 ones unless an attribute explicitly
- tells us otherwise. */
+ /* When -minterlink-mips16 is in effect, assume that non-locally-binding
+ functions could be MIPS16 ones unless an attribute explicitly tells
+ us otherwise. */
if (TARGET_INTERLINK_MIPS16
&& decl
- && DECL_EXTERNAL (decl)
+ && (DECL_EXTERNAL (decl) || !targetm.binds_local_p (decl))
&& !mips_nomips16_decl_p (decl)
&& const_call_insn_operand (XEXP (DECL_RTL (decl), 0), VOIDmode))
return false;