From 00fc09e1496ef843e27f98c53f19cb6141993526 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Thu, 28 Aug 1997 20:04:19 +0000 Subject: [PATCH] Fix x86 libio -O2 miscompilation problem. * i386.c (ix86_expand_epilogue): Emit blockage instruction when pic. From-SVN: r14992 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/i386.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d135b4bd6c4..33fec6b96dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +Thu Aug 28 13:01:43 1997 Jim Wilson + + * 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. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 35dbc62a81b..d8d9757e759 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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) -- 2.30.2