OSDN Git Service

PR target/51900
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Jan 2012 19:55:35 +0000 (19:55 +0000)
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Jan 2012 19:55:35 +0000 (19:55 +0000)
* config/i386/predicates.md (symbolic_operand): Allow
UNSPEC_PCREL as PIC expression for lea.
* config/i386/winnt.c (i386_pe_binds_local_p): Reworked.
* config/i386/i386.c (ix86_delegitimize_address): Handle
UNSPEC_PCREL for none-MEM, too.

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

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/predicates.md
gcc/config/i386/winnt.c

index c86d926..82b574a 100644 (file)
@@ -1,3 +1,12 @@
+2012-01-23  Kai Tietz  <ktietz@redhat.com>
+
+       PR target/51900
+       * config/i386/predicates.md (symbolic_operand): Allow
+       UNSPEC_PCREL as PIC expression for lea.
+       * config/i386/winnt.c (i386_pe_binds_local_p): Reworked.
+       * config/i386/i386.c (ix86_delegitimize_address): Handle
+       UNSPEC_PCREL for none-MEM, too.
+
 2012-01-23  Aldy Hernandez  <aldyh@redhat.com>
 
        * trans-mem.c (ipa_tm_create_version): Set externally_visible.
index 88637a4..a50d871 100644 (file)
@@ -13231,10 +13231,10 @@ ix86_delegitimize_address (rtx x)
          || GET_CODE (XEXP (x, 0)) != UNSPEC
          || (XINT (XEXP (x, 0), 1) != UNSPEC_GOTPCREL
              && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL)
-         || !MEM_P (orig_x))
+         || (!MEM_P (orig_x) && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL))
        return ix86_delegitimize_tls_address (orig_x);
       x = XVECEXP (XEXP (x, 0), 0, 0);
-      if (GET_MODE (orig_x) != GET_MODE (x))
+      if (GET_MODE (orig_x) != GET_MODE (x) && MEM_P (orig_x))
        {
          x = simplify_gen_subreg (GET_MODE (orig_x), x,
                                   GET_MODE (x), 0);
index 1dda585..32f73da 100644 (file)
          || (GET_CODE (op) == UNSPEC
              && (XINT (op, 1) == UNSPEC_GOT
                  || XINT (op, 1) == UNSPEC_GOTOFF
+                 || XINT (op, 1) == UNSPEC_PCREL
                  || XINT (op, 1) == UNSPEC_GOTPCREL)))
        return true;
       if (GET_CODE (op) != PLUS
index af3f975..79cbb6b 100644 (file)
@@ -350,21 +350,22 @@ i386_pe_encode_section_info (tree decl, rtx rtl, int first)
   SYMBOL_REF_FLAGS (symbol) = flags;
 }
 
+
 bool
 i386_pe_binds_local_p (const_tree exp)
 {
-  /* PE does not do dynamic binding.  Indeed, the only kind of
-     non-local reference comes from a dllimport'd symbol.  */
   if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL)
       && DECL_DLLIMPORT_P (exp))
     return false;
 
-  /* Or a weak one, now that they are supported.  */
-  if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL)
-      && DECL_WEAK (exp))
-    return false;
-
-  return true;
+  /* External public symbols, which aren't weakref-s,
+     have local-binding for PE targets.  */
+  if (DECL_P (exp)
+      && !lookup_attribute ("weakref", DECL_ATTRIBUTES (exp))
+      && TREE_PUBLIC (exp)
+      && DECL_EXTERNAL (exp))
+    return true;
+  return default_binds_local_p_1 (exp, 0);
 }
 
 /* Also strip the fastcall prefix and stdcall suffix.  */