OSDN Git Service

* config/rs6000/rs6000.c (toc_relative_ok): Delete.
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Sep 2010 10:50:48 +0000 (10:50 +0000)
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Sep 2010 10:50:48 +0000 (10:50 +0000)
(rs6000_emit_move): Use SYMBOL_REF_LOCAL_P instead.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164553 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index 156f09c..3f2e66f 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-23  Alan Modra  <amodra@gmail.com>
+
+       * config/rs6000/rs6000.c (toc_relative_ok): Delete.
+       (rs6000_emit_move): Use SYMBOL_REF_LOCAL_P instead.
+
 2010-09-23  Bernd Schmidt  <bernds@codesourcery.com>
 
        PR rtl-optimization/44374
index 4dc7b80..55cb92f 100644 (file)
@@ -7032,46 +7032,6 @@ rs6000_eliminate_indexed_memrefs (rtx operands[2])
                               copy_addr_to_reg (XEXP (operands[1], 0)));
 }
 
-/* Return true if OP, a SYMBOL_REF, should be considered local when
-   generating -mcmodel=medium code.  */
-
-static bool
-toc_relative_ok (rtx op)
-{
-  tree decl;
-
-  if (!SYMBOL_REF_LOCAL_P (op))
-    return false;
-
-  /* This is a bit hard to explain.  When building shared libraries,
-     you are supposed to pass -fpic or -fPIC to the compiler.
-     -fpic/-fPIC not only generate position independent code but also
-     generate code that supports ELF shared library global function
-     or variable overriding.  ppc64 is always PIC and at least some of
-     the ELF shared libaray semantics of global variables happen to be
-     supported without -fpic/-fPIC.  So people may not be careful
-     about using -fPIC for shared libs.
-     With -mcmodel=medium this situation changes.  A shared library
-     built without -fpic/-fPIC requires text relocs for global var
-     access (and would fail to load since glibc ld.so doesn't support
-     the required dynamic relocs).  So avoid this potential
-     problem by using -mcmodel=large access for global vars, unless
-     we know we are compiling for an executable.  */
-  if (flag_pie)
-    return true;
-
-  decl = SYMBOL_REF_DECL (op);
-  if (!decl || !DECL_P (decl))
-    return true;
-  if (!TREE_PUBLIC (decl))
-    return true;
-  if (DECL_VISIBILITY (decl) != VISIBILITY_DEFAULT)
-    return true;
-
-  /* If we get here we must have a global var.  See binds_local_p.  */
-  return flag_whole_program;
-}
-
 /* Return true if memory accesses to DECL are known to never straddle
    a 32k boundary.  */
 
@@ -7427,7 +7387,7 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
          || (TARGET_CMODEL == CMODEL_MEDIUM
              && GET_CODE (operands[1]) == SYMBOL_REF
              && !CONSTANT_POOL_ADDRESS_P (operands[1])
-             && toc_relative_ok (operands[1])
+             && SYMBOL_REF_LOCAL_P (operands[1])
              && offsettable_ok_by_alignment (SYMBOL_REF_DECL (operands[1]))))
        {
          rtx reg = NULL_RTX;