i386.c (legitimize_pic_address): Add treating of dllimport SYM_REF's.
authorKai Tietz <kai.tietz@onevision.com>
Mon, 7 Apr 2008 12:44:14 +0000 (12:44 +0000)
committerKai Tietz <ktietz@gcc.gnu.org>
Mon, 7 Apr 2008 12:44:14 +0000 (14:44 +0200)
2008-04-07  Kai Tietz  <kai.tietz@onevision.com>

        PR/35842
        * config/i386/i386.c (legitimize_pic_address): Add treating
        of dllimport SYM_REF's.
        (legitimize_dllimport_symbol): Add prototype.

From-SVN: r133981

gcc/ChangeLog
gcc/config/i386/i386.c

index b4e1c51..83c9493 100644 (file)
@@ -1,3 +1,10 @@
+2008-04-07  Kai Tietz  <kai.tietz@onevision.com>
+
+        PR/35842
+        * config/i386/i386.c (legitimize_pic_address): Add treating
+        of dllimport SYM_REF's.
+        (legitimize_dllimport_symbol): Add prototype.
+
 2008-04-07  Eric Botcazou  <ebotcazou@adacore.com>
 
        * fold-const.c (fold) <ARRAY_REF>: New case.  Try to fold constant
index 161f9e4..59d06c4 100644 (file)
@@ -54,6 +54,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "params.h"
 
 static int x86_builtin_vectorization_cost (bool);
+static rtx legitimize_dllimport_symbol (rtx, bool);
 
 #ifndef CHECK_STACK_LIMIT
 #define CHECK_STACK_LIMIT (-1)
@@ -7660,10 +7661,18 @@ legitimize_pic_address (rtx orig, rtx reg)
              see gotoff_operand.  */
           || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF))
     {
-      /* Given that we've already handled dllimport variables separately
-        in legitimize_address, and all other variables should satisfy
-        legitimate_pic_address_disp_p, we should never arrive here.  */
-      gcc_assert (!TARGET_64BIT_MS_ABI);
+      if (TARGET_DLLIMPORT_DECL_ATTRIBUTES)
+        {
+          if (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_DLLIMPORT_P (addr))
+            return legitimize_dllimport_symbol (addr, true);
+          if (GET_CODE (addr) == CONST && GET_CODE (XEXP (addr, 0)) == PLUS
+              && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF
+              && SYMBOL_REF_DLLIMPORT_P (XEXP (XEXP (addr, 0), 0)))
+            {
+              rtx t = legitimize_dllimport_symbol (XEXP (XEXP (addr, 0), 0), true);
+              return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1));
+            }
+        }
 
       if (TARGET_64BIT && ix86_cmodel != CM_LARGE_PIC)
        {