]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[RS6000] Weak functions may not be file local
authorAlan Modra <amodra@gmail.com>
Tue, 1 Sep 2015 23:25:48 +0000 (08:55 +0930)
committerAlan Modra <amodra@gcc.gnu.org>
Tue, 1 Sep 2015 23:25:48 +0000 (08:55 +0930)
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

gcc/ChangeLog
gcc/config/rs6000/predicates.md
gcc/config/rs6000/rs6000.c

index 04577f836856228af4a271f7c80a79246fdd04fb..c05558fc750980e0af97f88545a542fde7c692b0 100644 (file)
@@ -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-08-27  Pat Haugen  <pthaugen@us.ibm.com>
 
        Backport from mainline:
index 3193a3e032bba7576a9eb0e3583cdc24ab568a04..8729d9b0ef141a3995f8c3bb3baf8f2c19013eaf 100644 (file)
 (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"
index 0221f3af8d60448593f5f0d2f65bb304ea3a485a..859476aafa8afa3ec88c5c2c2184acc8328f13e3 100644 (file)
@@ -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