Author: jaewook
Date: 2011-03-31 13:04:20 -0400 (Thu, 31 Mar 2011)
New Revision: 3530
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/x8664/config_targ.cxx
Log:
This fixes bug 721, which is a linker error for helloworld.c when "-fpie
-pie -ipa" is given. Gen_PIC_Call_Shared is also checked now for some
code where only Gen_PIC_Shared used to be checked. Reviewed and approved
by Sun Chan.
Modified: trunk/osprey/be/cg/calls.cxx
===================================================================
--- trunk/osprey/be/cg/calls.cxx 2011-03-30 18:00:06 UTC (rev 3529)
+++ trunk/osprey/be/cg/calls.cxx 2011-03-31 17:04:20 UTC (rev 3530)
@@ -374,7 +374,7 @@
#ifdef TARG_X8664
if( CG_opt_level > 0 &&
Is_Target_32bit() &&
- Gen_PIC_Shared &&
+ (Gen_PIC_Shared || Gen_PIC_Call_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 ){
+ if( Is_Target_32bit() && (Gen_PIC_Shared || Gen_PIC_Call_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_Shared ){
+ if( Is_Target_32bit() && (Gen_PIC_Call_Shared || 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-03-30 18:00:06 UTC (rev 3529)
+++ trunk/osprey/be/cg/register.cxx 2011-03-31 17:04:20 UTC (rev 3530)
@@ -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_Shared || Gen_PIC_Call_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-03-30 18:00:06 UTC (rev 3529)
+++ trunk/osprey/be/cg/whirl2ops.cxx 2011-03-31 17:04:20 UTC (rev 3530)
@@ -1678,7 +1678,7 @@
#ifdef TARG_X8664
if( Is_Target_32bit() &&
- Gen_PIC_Shared &&
+ (Gen_PIC_Shared || Gen_PIC_Call_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_Shared || Gen_PIC_Call_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-03-30 18:00:06 UTC (rev
3529)
+++ trunk/osprey/be/cg/x8664/cgemit_targ.cxx 2011-03-31 17:04:20 UTC (rev
3530)
@@ -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 &&
+ if ( (Gen_PIC_Shared || Gen_PIC_Call_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-03-30 18:00:06 UTC (rev
3529)
+++ trunk/osprey/be/cg/x8664/exp_loadstore.cxx 2011-03-31 17:04:20 UTC (rev
3530)
@@ -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) {
- if ( !ST_is_export_local(base_sym) ) {
+ if (Gen_PIC_Shared || Gen_PIC_Call_Shared) {
+ if ( ST_is_preemptible(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,7 +1225,8 @@
ErrMsg(EC_Misc_User_Abort,
("Detected 64-bit address offset under -m32. Try -m64
-mcmodel=medium."));
- if( Gen_PIC_Shared && (!ST_is_export_local (base_sym) ||
+ if( (Gen_PIC_Shared || Gen_PIC_Call_Shared) &&
+ (!ST_is_export_local (base_sym) ||
// function, even if export_local?
ST_class(base_sym) == CLASS_FUNC ||
// section?
@@ -1337,10 +1338,11 @@
}
}
- if( Gen_PIC_Shared && (!ST_is_export_local (base_sym) ||
- // section?
- (ST_class(base_sym) == CLASS_BLOCK &&
- STB_section(base_sym) /* bug 10097 */)) ){
+ 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( 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-03-30 18:00:06 UTC (rev 3529)
+++ trunk/osprey/be/cg/x8664/expand.cxx 2011-03-31 17:04:20 UTC (rev 3530)
@@ -9845,7 +9845,7 @@
Gen_Literal_TN(4*(num_xmms-8), 4), ops);
}
Build_OP(TOP_neg64, r11_tn, r11_tn, ops);
- if ( Gen_PIC_Shared ) {
+ if ( Gen_PIC_Shared || Gen_PIC_Call_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/x8664/config_targ.cxx
===================================================================
--- trunk/osprey/common/com/x8664/config_targ.cxx 2011-03-30 18:00:06 UTC
(rev 3529)
+++ trunk/osprey/common/com/x8664/config_targ.cxx 2011-03-31 17:04:20 UTC
(rev 3530)
@@ -819,8 +819,8 @@
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;
+// if (Gen_PIC_Call_Shared)
+// Gen_PIC_Call_Shared = FALSE;
return;
}
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel