diff options
author | Bob Wilson <bob.wilson@acm.org> | 2003-09-15 23:19:21 +0000 |
---|---|---|
committer | Bob Wilson <bwilson@gcc.gnu.org> | 2003-09-15 23:19:21 +0000 |
commit | cadafd1ffdceb92393f7394d763f66faf4598340 (patch) | |
tree | d1911da1482a3dff567f9d484e6fa20931165cee /gcc/config/xtensa/xtensa.c | |
parent | fb0317c6ea843e496fafa2fa4054f9982961d3ba (diff) | |
download | gcc-cadafd1ffdceb92393f7394d763f66faf4598340.zip gcc-cadafd1ffdceb92393f7394d763f66faf4598340.tar.gz gcc-cadafd1ffdceb92393f7394d763f66faf4598340.tar.bz2 |
xtensa.c (xtensa_multibss_section_type_flags): Add ATTRIBUTE_UNUSED.
* config/xtensa/xtensa.c (xtensa_multibss_section_type_flags): Add
ATTRIBUTE_UNUSED.
(call_insn_operand): For PIC, don't allow a direct call to a
function in a different section than the current one.
From-SVN: r71415
Diffstat (limited to 'gcc/config/xtensa/xtensa.c')
-rw-r--r-- | gcc/config/xtensa/xtensa.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 3c382d9..32d5030 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -200,7 +200,7 @@ static struct machine_function * xtensa_init_machine_status PARAMS ((void)); static void printx PARAMS ((FILE *, signed int)); static void xtensa_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static unsigned int xtensa_multibss_section_type_flags - PARAMS ((tree, const char *, int)); + PARAMS ((tree, const char *, int)) ATTRIBUTE_UNUSED; static void xtensa_select_rtx_section PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); static bool xtensa_rtx_costs PARAMS ((rtx, int, int, int *)); @@ -581,8 +581,37 @@ call_insn_operand (op, mode) if (CONSTANT_ADDRESS_P (op)) { /* Direct calls only allowed to static functions with PIC. */ - return (!flag_pic - || (GET_CODE (op) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (op))); + if (flag_pic) + { + tree callee, callee_sec, caller_sec; + + if (GET_CODE (op) != SYMBOL_REF || !SYMBOL_REF_LOCAL_P (op)) + return FALSE; + + /* Don't attempt a direct call if the callee is known to be in + a different section, since there's a good chance it will be + out of range. */ + + if (flag_function_sections + || DECL_ONE_ONLY (current_function_decl)) + return FALSE; + caller_sec = DECL_SECTION_NAME (current_function_decl); + callee = SYMBOL_REF_DECL (op); + if (callee) + { + if (DECL_ONE_ONLY (callee)) + return FALSE; + callee_sec = DECL_SECTION_NAME (callee); + if (((caller_sec == NULL_TREE) ^ (callee_sec == NULL_TREE)) + || (caller_sec != NULL_TREE + && strcmp (TREE_STRING_POINTER (caller_sec), + TREE_STRING_POINTER (callee_sec)) != 0)) + return FALSE; + } + else if (caller_sec != NULL_TREE) + return FALSE; + } + return TRUE; } return FALSE; |