Author: jaewook
Date: 2011-04-14 18:10:29 -0400 (Thu, 14 Apr 2011)
New Revision: 3554

Modified:
   trunk/osprey/be/cg/calls.cxx
   trunk/osprey/be/cg/register.cxx
   trunk/osprey/be/cg/whirl2ops.cxx
   trunk/osprey/be/cg/x8664/cgemit_targ.cxx
   trunk/osprey/be/cg/x8664/exp_loadstore.cxx
   trunk/osprey/be/cg/x8664/expand.cxx
   trunk/osprey/common/com/config.cxx
   trunk/osprey/common/com/x8664/config_targ.cxx
Log:
This fixes bug 721, which is reopened after the earlier fix with r3530.
The earlier fix had some problems including the one reported as bug 762.
This fix completely reverts the earlier fix, thereby removing bug 762 as
well. This fix changes only one line in config.cxx compared to r3529.



Modified: trunk/osprey/be/cg/calls.cxx
===================================================================
--- trunk/osprey/be/cg/calls.cxx        2011-04-14 10:28:31 UTC (rev 3553)
+++ trunk/osprey/be/cg/calls.cxx        2011-04-14 22:10:29 UTC (rev 3554)
@@ -374,7 +374,7 @@
 #ifdef TARG_X8664
   if( CG_opt_level > 0  &&
       Is_Target_32bit() &&
-      (Gen_PIC_Shared || Gen_PIC_Call_Shared)    &&
+      Gen_PIC_Shared    &&
       !PU_References_GOT ){
     TN* ebx_tn = Ebx_TN();
     REGISTER_Set_Allocatable( TN_register_class(ebx_tn),
@@ -924,7 +924,7 @@
   }
 
 #ifdef TARG_X8664
-  if( Is_Target_32bit() && (Gen_PIC_Shared || Gen_PIC_Call_Shared) ){
+  if( Is_Target_32bit() && Gen_PIC_Shared ){
     EETARG_Generate_PIC_Entry_Code( bb, &ops );
   }
 #endif
@@ -1749,7 +1749,7 @@
     EETARG_Restore_Extra_Callee_Tns (&ops);
 
 #ifdef TARG_X8664
-  if( Is_Target_32bit() && (Gen_PIC_Call_Shared || Gen_PIC_Shared) ){
+  if( Is_Target_32bit() && Gen_PIC_Shared ){
     EETARG_Generate_PIC_Exit_Code( bb_epi, &ops );
   }
 #endif

Modified: trunk/osprey/be/cg/register.cxx
===================================================================
--- trunk/osprey/be/cg/register.cxx     2011-04-14 10:28:31 UTC (rev 3553)
+++ trunk/osprey/be/cg/register.cxx     2011-04-14 22:10:29 UTC (rev 3554)
@@ -776,7 +776,7 @@
        be used to hold the address pointing to the global offset table.
     */
     if( Is_Target_32bit() &&
-       (Gen_PIC_Shared || Gen_PIC_Call_Shared)   &&
+       Gen_PIC_Shared    &&
        rclass == TN_register_class(ebx_tn) ){
       reg_alloc_status[rclass][TN_register(ebx_tn)] = AS_not_allocatable;
       re_init = TRUE;

Modified: trunk/osprey/be/cg/whirl2ops.cxx
===================================================================
--- trunk/osprey/be/cg/whirl2ops.cxx    2011-04-14 10:28:31 UTC (rev 3553)
+++ trunk/osprey/be/cg/whirl2ops.cxx    2011-04-14 22:10:29 UTC (rev 3554)
@@ -1678,7 +1678,7 @@
 
 #ifdef TARG_X8664
   if( Is_Target_32bit() &&
-      (Gen_PIC_Shared || Gen_PIC_Call_Shared)    &&
+      Gen_PIC_Shared    &&
       call_st != NULL   &&
       !ST_is_export_local(call_st) ){
     PU_References_GOT = TRUE;
@@ -7784,7 +7784,7 @@
 
 #ifdef TARG_X8664
   if( Is_Target_32bit() &&
-      (Gen_PIC_Shared || Gen_PIC_Call_Shared)   &&
+      Gen_PIC_Shared    &&
       call_st != NULL   &&
       !ST_is_export_local(call_st) ){
     PU_References_GOT = TRUE;

Modified: trunk/osprey/be/cg/x8664/cgemit_targ.cxx
===================================================================
--- trunk/osprey/be/cg/x8664/cgemit_targ.cxx    2011-04-14 10:28:31 UTC (rev 
3553)
+++ trunk/osprey/be/cg/x8664/cgemit_targ.cxx    2011-04-14 22:10:29 UTC (rev 
3554)
@@ -3906,7 +3906,7 @@
     // Mach-O linker evidently handles this automatically
 #else /* defined(BUILD_OS_DARWIN) */
     // Add a reference to the PLT under -fPIC compilation.
-    if ( (Gen_PIC_Shared || Gen_PIC_Call_Shared) &&  
+    if ( Gen_PIC_Shared &&  
         !TN_is_label( OP_opnd(op,opnd) ) &&
          TOP_is_jump(topcode) &&
          opnd == OP_find_opnd_use(op,OU_target) ) {

Modified: trunk/osprey/be/cg/x8664/exp_loadstore.cxx
===================================================================
--- trunk/osprey/be/cg/x8664/exp_loadstore.cxx  2011-04-14 10:28:31 UTC (rev 
3553)
+++ trunk/osprey/be/cg/x8664/exp_loadstore.cxx  2011-04-14 22:10:29 UTC (rev 
3554)
@@ -1176,8 +1176,8 @@
       else if( Is_Target_64bit() ){
         FmtAssert(!ST_is_thread_local(base_sym),
                   ("Exp_Ldst: thread-local storage should not be handled 
here"));
-       if (Gen_PIC_Shared || Gen_PIC_Call_Shared) {
-         if ( ST_is_preemptible(base_sym) ) {
+       if (Gen_PIC_Shared) {
+         if ( !ST_is_export_local(base_sym) ) {
            TN *tmp = base_ofst == 0 ? tn : Build_TN_Like(tn);
            Build_OP( TOP_ld64, tmp, Rip_TN(), 
                      Gen_Symbol_TN( base_sym, 0, TN_RELOC_X8664_GOTPCREL ),
@@ -1225,8 +1225,7 @@
          ErrMsg(EC_Misc_User_Abort,
            ("Detected 64-bit address offset under -m32.  Try -m64 
-mcmodel=medium."));
 
-       if( (Gen_PIC_Shared || Gen_PIC_Call_Shared) && 
-           (!ST_is_export_local (base_sym) ||
+       if( Gen_PIC_Shared && (!ST_is_export_local (base_sym) ||
                               // function, even if export_local?
                               ST_class(base_sym) == CLASS_FUNC ||
                               // section?
@@ -1338,11 +1337,10 @@
        }
       }
 
-      if( (Gen_PIC_Shared || Gen_PIC_Call_Shared) && 
-         (!ST_is_export_local (base_sym) ||
-                             // section?
-                             (ST_class(base_sym) == CLASS_BLOCK &&
-                              STB_section(base_sym) /* bug 10097 */)) ){
+      if( Gen_PIC_Shared && (!ST_is_export_local (base_sym) ||
+                              // section?
+                             (ST_class(base_sym) == CLASS_BLOCK &&
+                              STB_section(base_sym) /* bug 10097 */)) ){
 
        if( Is_Target_64bit() ){
          TN *new_base = Build_TN_Of_Mtype(Pointer_Mtype);

Modified: trunk/osprey/be/cg/x8664/expand.cxx
===================================================================
--- trunk/osprey/be/cg/x8664/expand.cxx 2011-04-14 10:28:31 UTC (rev 3553)
+++ trunk/osprey/be/cg/x8664/expand.cxx 2011-04-14 22:10:29 UTC (rev 3554)
@@ -9890,7 +9890,7 @@
                 Gen_Literal_TN(4*(num_xmms-8), 4), ops);
       }
       Build_OP(TOP_neg64, r11_tn, r11_tn, ops);
-      if ( Gen_PIC_Shared || Gen_PIC_Call_Shared ) {
+      if ( Gen_PIC_Shared ) {
        Build_OP ( TOP_lea64, rax_tn, Rip_TN(), OP_opnd( op, 4 ), ops );
        ops->last->bb = bb; // to pass Verify_Operand
        Build_OP ( TOP_leax64, r11_tn, r11_tn, rax_tn, 

Modified: trunk/osprey/common/com/config.cxx
===================================================================
--- trunk/osprey/common/com/config.cxx  2011-04-14 10:28:31 UTC (rev 3553)
+++ trunk/osprey/common/com/config.cxx  2011-04-14 22:10:29 UTC (rev 3554)
@@ -1453,8 +1453,15 @@
 
   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;
+  /* If we get both TENV:CPIC and TENV:PIC, use only TENV:PIC.
+   *
+   * To fix bug 721, "use only TENV:CPIC" is changed to "use only TENV:PIC".
+   * While PIC, represented by Gen_PIC_Shared, is for 'shared objects', 
+   * CPIC, represented by Gen_PIC_Call_Shared, is for 'dynamic executables'
+   * that call functions in shared objects. Since CPIC should be the default,
+   * Gen_PIC_Call_Shared is not very useful.
+   */
+  if (Gen_PIC_Call_Shared && Gen_PIC_Shared) Gen_PIC_Call_Shared = FALSE;
 
   /* Select optimization options: */
 

Modified: trunk/osprey/common/com/x8664/config_targ.cxx
===================================================================
--- trunk/osprey/common/com/x8664/config_targ.cxx       2011-04-14 10:28:31 UTC 
(rev 3553)
+++ trunk/osprey/common/com/x8664/config_targ.cxx       2011-04-14 22:10:29 UTC 
(rev 3554)
@@ -818,9 +818,9 @@
   if ( DEBUG_Trap_Uv )
     FP_Exception_Enable_Min |= FPX_V;
 
-// TMP: ignore cpic until we figure out what to do with it
-//   if (Gen_PIC_Call_Shared)
-//     Gen_PIC_Call_Shared = FALSE;
+  // TMP: ignore cpic until we figure out what to do with it
+  if (Gen_PIC_Call_Shared)
+    Gen_PIC_Call_Shared = FALSE;
 
   return;
 }


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to