summaryrefslogtreecommitdiffstats
path: root/0015-handle-dllimport-properly-in-medium-model.patch
blob: 4de830e902baf421bddfdb85d7b77413bfb2b4e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 508940bebe9d116a1452c1c0b515201929d0738f Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Sat, 28 Jun 2014 09:52:21 +0800
Subject: [PATCH 15/24] handle dllimport properly in medium model

---
 gcc/config/i386/predicates.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 2ef1384..3fc6104 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -164,6 +164,7 @@
 	switch (XINT (XEXP (op, 0), 1))
 	  {
 	  case UNSPEC_GOTPCREL:
+	    if (TARGET_PECOFF) break;
 	  case UNSPEC_DTPOFF:
 	  case UNSPEC_GOTNTPOFF:
 	  case UNSPEC_NTPOFF:
@@ -268,6 +269,10 @@
       /* TLS symbols are not constant.  */
       if (SYMBOL_REF_TLS_MODEL (op))
 	return false;
+      /* Dll-imported symbols are always external.  */
+      if (TARGET_DLLIMPORT_DECL_ATTRIBUTES && SYMBOL_REF_DLLIMPORT_P (op))
+        return false;
+
       return (ix86_cmodel == CM_SMALL
 	      || (ix86_cmodel == CM_MEDIUM
 		  && !SYMBOL_REF_FAR_ADDR_P (op)));
-- 
2.1.1