Hello,

Attached is my fix to bug #721 (https://bugs.open64.net/show_bug.cgi?id=721),
can gatekeeper review this fix for me please? Thank you very much.

============
Bug Analysis
============
This bug happens with -Ofast -pie -fpie option on. However, it does not
happen at other optimization levels, say -O3. Further investigation shows
that even a very simple printf("hello world\n"); program shows the same
symptoms. This is caused by compiler generating wrong code for loading
string constant ("hello world"). When -pie option is on, the compiler should
not generate
the loading code using indirect load from GOT table (e.g.  movq
$(.rodata),%rdi vs. leaq .rodata(%rip),%rdi).

However, this difference is caused by the ipa. The problem is that with IPA
and -pie specified, ipa_link passes both -TENV:CPIC (-pic1) and -TENV:PIC to
subsequent compilation phases. However, these two options can not work
together, at least on X86-64. At first, the effect of -TNEV:PIC option is
nullified by -TENV:CPIC in common/com/config.cxx:1457 (if
(Gen_PIC_Call_Shared && Gen_PIC_Shared) Gen_PIC_Shared = FALSE). Then, the
effect of -TENV:CPIC is reset by common//com/x8664/config_targ.cxx:822:

// TMP: ignore cpic until we figure out what to do with it
  if (Gen_PIC_Call_Shared)
    Gen_PIC_Call_Shared = FALSE;


Fix to this problem is to change IPA so that it does not pass -pic1 option
to subsequent phases when the target is X8664. It seems to me that
-TENV:CPIC is unsupported on X8664 in the compiler.

-- Feng Zhou

Attachment: bug721_v2.patch
Description: Binary data

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to