We have been using the wrong register to hold GOT in 64-bit large model,
which is used by the large model PLT.  The only reason we haven't run into
any problem is linker doesn't support the large model PLT. I am looking
into linker issue.  This patch corrects REAL_PIC_OFFSET_TABLE_REGNUM for
64-bit large model.  OK to install?

Thanks.

H.J.
---
2014-11-12  H.J. Lu  <hongjiu...@intel.com>

         PR target/63833
         * config/i386/i386.h (REAL_PIC_OFFSET_TABLE_REGNUM): Use
         R15_REG for 64-bit.
         * config/i386/rdos64.h (REAL_PIC_OFFSET_TABLE_REGNUM): Removed.

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 53dfd22..0ccfb21 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1244,7 +1244,7 @@ extern const char *host_detect_local_cpu (int argc, const 
char **argv);
    the pic register when possible.  The change is visible after the
    prologue has been emitted.  */
 
-#define REAL_PIC_OFFSET_TABLE_REGNUM  BX_REG
+#define REAL_PIC_OFFSET_TABLE_REGNUM  (TARGET_64BIT ? R15_REG : BX_REG)
 
 #define PIC_OFFSET_TABLE_REGNUM                                                
\
   ((TARGET_64BIT && (ix86_cmodel == CM_SMALL_PIC                       \
diff --git a/gcc/config/i386/rdos64.h b/gcc/config/i386/rdos64.h
index e6f089a..f902651 100644
--- a/gcc/config/i386/rdos64.h
+++ b/gcc/config/i386/rdos64.h
@@ -17,8 +17,5 @@ You should have received a copy of the GNU General Public 
License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#undef REAL_PIC_OFFSET_TABLE_REGNUM
-#define REAL_PIC_OFFSET_TABLE_REGNUM  R15_REG
-
 #undef DEFAULT_LARGE_SECTION_THRESHOLD
 #define DEFAULT_LARGE_SECTION_THRESHOLD 16

Reply via email to