From: Alan Modra Date: Tue, 1 Sep 2015 23:25:48 +0000 (+0930) Subject: [RS6000] Weak functions may not be file local X-Git-Tag: releases/gcc-4.9.4~621 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60439e2fcb7fd9bd86e53bdfd50439d33d683d54;p=thirdparty%2Fgcc.git [RS6000] Weak functions may not be file local A weak symbol defined in the current object file may not turn out to be the definition used at link time, if other copies of the symbol exist. This means they can't be considered file local. PR target/67417 * config/rs6000/predicates.md (current_file_function_operand): Don't return true for weak symbols. * config/rs6000/rs6000.c (rs6000_function_ok_for_sibcall): Likewise. From-SVN: r227389 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 04577f836856..c05558fc7509 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-09-02 Alan Modra + + PR target/67417 + * config/rs6000/predicates.md (current_file_function_operand): Don't + return true for weak symbols. + * config/rs6000/rs6000.c (rs6000_function_ok_for_sibcall): Likewise. + 2015-08-27 Pat Haugen Backport from mainline: diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index 3193a3e032bb..8729d9b0ef14 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -1063,12 +1063,12 @@ (define_predicate "current_file_function_operand" (and (match_code "symbol_ref") (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op)) - && ((SYMBOL_REF_LOCAL_P (op) - && ((DEFAULT_ABI != ABI_AIX - && DEFAULT_ABI != ABI_ELFv2) - || !SYMBOL_REF_EXTERNAL_P (op))) - || (op == XEXP (DECL_RTL (current_function_decl), - 0)))"))) + && (SYMBOL_REF_LOCAL_P (op) + || op == XEXP (DECL_RTL (current_function_decl), 0)) + && !((DEFAULT_ABI == ABI_AIX + || DEFAULT_ABI == ABI_ELFv2) + && (SYMBOL_REF_EXTERNAL_P (op) + || SYMBOL_REF_WEAK (op)))"))) ;; Return 1 if this operand is a valid input for a move insn. (define_predicate "input_operand" diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 0221f3af8d60..859476aafa8a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -21866,6 +21866,7 @@ rs6000_function_ok_for_sibcall (tree decl, tree exp) || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && decl && !DECL_EXTERNAL (decl) + && !DECL_WEAK (decl) && (*targetm.binds_local_p) (decl)) || (DEFAULT_ABI == ABI_V4 && (!TARGET_SECURE_PLT