Author: yug
Date: 2012-04-19 04:19:07 -0400 (Thu, 19 Apr 2012)
New Revision: 3910

Modified:
   trunk/osprey/be/cg/cgdwarf.cxx
Log:
fix for bug783.

In dwarf frame sections, for -fpic -g code, unified 4byte upointer_size 
is used to represent the reference to the code in text  no matter 
-m32 or -m64. So, in handling the relocations in .debug_frame, 
we should always use PC-relative relocation instead of absolute one as 
we did in .eh_frame. 

Code Reivew: Lai Jian-Xin.


Modified: trunk/osprey/be/cg/cgdwarf.cxx
===================================================================
--- trunk/osprey/be/cg/cgdwarf.cxx      2012-04-16 08:19:56 UTC (rev 3909)
+++ trunk/osprey/be/cg/cgdwarf.cxx      2012-04-19 08:19:07 UTC (rev 3910)
@@ -3701,8 +3701,16 @@
 #ifdef TARG_X8664
       // don't want to affect other sections, although they may also need
       // to be updated under fPIC
+      
+      // open64.net bug783.
+      // Since ".debug_frame" also use PC relative addressing
+      // R_X86_64_PC32/R_386_PC32
+      // in the relocating for symbols, we should not miss them.
+      // Otherwise, wrong relocation generated.
+
       bool gen_pic = ((Gen_PIC_Call_Shared || Gen_PIC_Shared) &&
-                      !strcmp (section_name, EH_FRAME_SECTNAME));
+                      (!strcmp (section_name, EH_FRAME_SECTNAME) ||
+                       !strcmp (section_name, DEBUG_FRAME_SECTNAME)));
 #endif
       switch (reloc_buffer[k].drd_type) {
       case dwarf_drt_none:


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to