I think you are in the wrong track. I'd like to know the symbol attribute of the string that became part of the erronous code. The bug is not in IPA, nor the CPIC/PIC flag themselves. Those are concepts that, if turned off, of course a lot of things will start working, because you basically turned off every optimization that comes with it. For printf strings, x86 opt people might have put that into "const table" and that one arguably can make that string "hidden" or even stronger, thus one doesn't have to go through GOT for it. But, the caller must reconcil that fact also, the compiler might not have generated the GOT entry, yet the call site still thinks that it needs to. Look at CG. Sun
On Tue, Feb 8, 2011 at 3:29 AM, Feng Zhou <fengzho...@gmail.com> wrote: > Sun, > > Based on your email, I changed my fix to the following (also as attachment): > > Index: osprey/common/com/config.cxx > =================================================================== > --- osprey/common/com/config.cxx (revision 3471) > +++ osprey/common/com/config.cxx (working copy) > @@ -1453,9 +1453,6 @@ > > if ( Use_Large_GOT ) Guaranteed_Small_GOT = FALSE; > > - /* if we get both TENV:CPIC and TENV:PIC, use only TENV:CPIC */ > - if (Gen_PIC_Call_Shared && Gen_PIC_Shared) Gen_PIC_Shared = FALSE; > - > /* Select optimization options: */ > > /* Are we skipping any PUs for optimization? */ > > The above code, I think, affects all targets. Was there any reason of it? > > --Feng Zhou > > > > On Wed, Jan 26, 2011 at 3:07 PM, Sun Chan <sun.c...@gmail.com> wrote: >> I am not familiar with x86, my understanding of the generic SVR4 ABI >> is that cpic is a subset of PIC. IOWs, even if cpic code goes through >> GOT, it is just a performance issue. CPIC assumes that whatever is >> being accessed do not have to go through GOT. The side effect of which >> is that for symbols that are not pre-emptible, one does not have to >> have got entry. This is the only case that could cause problem. But a >> string in printf is not necessarily non-preemptible (I don't believe >> language says so, but i could be outdated now). >> Sun >> >> On Thu, Jan 27, 2011 at 6:45 AM, Feng Zhou <fengzho...@gmail.com> wrote: >>> 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 >>> >>> ------------------------------------------------------------------------------ >>> 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 >>> >>> >> > ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel