diff options
author | Alan Modra <amodra@gmail.com> | 2015-09-02 08:33:19 +0930 |
---|---|---|
committer | Alan Modra <amodra@gcc.gnu.org> | 2015-09-02 08:33:19 +0930 |
commit | b2c72901da7c6a7202a0451b23601c9b864ab99c (patch) | |
tree | 593153c5267b87b5614ee8569453ade4a75d229e | |
parent | 22219d9b1a5bcf9b96020f830493fed6525d936c (diff) | |
download | gcc-b2c72901da7c6a7202a0451b23601c9b864ab99c.zip gcc-b2c72901da7c6a7202a0451b23601c9b864ab99c.tar.gz gcc-b2c72901da7c6a7202a0451b23601c9b864ab99c.tar.bz2 |
[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: r227386
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/rs6000/predicates.md | 12 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 1 |
3 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9e7bac..ba0a8f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-09-02 Alan Modra <amodra@gmail.com> + + 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-09-01 Matthew Fortune <matthew.fortune@imgtec.com> Andrew Bennett <andrew.bennett@imgtec.com> diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index b111df6..3edb477 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -902,12 +902,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 500effa..8107bec 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -22833,6 +22833,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 |