Fix x86 libio -O2 miscompilation problem.
authorJim Wilson <wilson@cygnus.com>
Thu, 28 Aug 1997 20:04:19 +0000 (20:04 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Thu, 28 Aug 1997 20:04:19 +0000 (13:04 -0700)
* i386.c (ix86_expand_epilogue): Emit blockage instruction when pic.

From-SVN: r14992

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

index d135b4b..33fec6b 100644 (file)
@@ -1,3 +1,7 @@
+Thu Aug 28 13:01:43 1997  Jim Wilson  <wilson@cygnus.com>
+
+       * i386.c (ix86_expand_epilogue): Emit blockage instruction when pic.
+
 Thu Aug 28 07:03:15 1997  Jeffrey A Law  (law@cygnus.com)
 
        * version.c: Bump for latest snapshot.
index 35dbc62..d8d9757 100644 (file)
@@ -2128,6 +2128,16 @@ ix86_expand_epilogue ()
 
   xops[2] = stack_pointer_rtx;
 
+  /* When -fpic, we must emit a scheduling barrier, so that the instruction
+     that restores %ebx (which is PIC_OFFSET_TABLE_REGNUM), does not get
+     moved before any instruction which implicitly uses the got.  This
+     includes any instruction which uses a SYMBOL_REF or a LABEL_REF.
+
+     Alternatively, this could be fixed by making the dependence on the
+     PIC_OFFSET_TABLE_REGNUM explicit in the RTL.  */
+  if (flag_pic)
+    emit_insn (gen_blockage ());
+
   if (nregs > 1 || ! frame_pointer_needed)
     {
       if (frame_pointer_needed)