drd: Suppress race reports on .got sections too
authorbart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Thu, 6 Sep 2012 14:08:26 +0000 (14:08 +0000)
committerbart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Thu, 6 Sep 2012 14:08:26 +0000 (14:08 +0000)
This is a slightly modified version of a patch provided by Petar Jovanovic
<petar.jovanovic@rt-rk.com>.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12960 a5019735-40e9-0310-863c-91ae7b9d1cf9

coregrind/m_debuginfo/debuginfo.c
drd/drd_main.c
include/pub_tool_debuginfo.h

index 218547bfeaea57ed8ecec560f6f3a8723172ca74..21bf93317b0c77922a40dce311f344c64b06eddd 100644 (file)
@@ -3788,6 +3788,16 @@ SizeT VG_(DebugInfo_get_gotplt_size)(const DebugInfo* di)
    return di->gotplt_present ? di->gotplt_size : 0; 
 }
 
+Addr VG_(DebugInfo_get_got_avma)(const DebugInfo* di)
+{
+   return di->got_present ? di->got_avma : 0; 
+}
+
+SizeT VG_(DebugInfo_get_got_size)(const DebugInfo* di)
+{
+   return di->got_present ? di->got_size : 0; 
+}
+
 const UChar* VG_(DebugInfo_get_soname)(const DebugInfo* di)
 {
    return di->soname;
index 5e86f818a00019f7ca83df95e284cc0d18dcc483..7b3570e755e1058a9a57a0097c4445f184662a4d 100644 (file)
@@ -412,7 +412,7 @@ void DRD_(clean_memory)(const Addr a1, const SizeT len)
 static const Bool trace_sectsuppr = False;
 
 /**
- * Suppress data race reports on all addresses contained in .plt and
+ * Suppress data race reports on all addresses contained in .plt, .got and
  * .got.plt sections inside the address range [ a, a + len [. The data in
  * these sections is modified by _dl_relocate_object() every time a function
  * in a shared library is called for the first time. Since the first call
@@ -420,6 +420,7 @@ static const Bool trace_sectsuppr = False;
  * such calls can cause conflicting accesses. See also Ulrich Drepper's
  * paper "How to Write Shared Libraries" for more information about relocation
  * (http://people.redhat.com/drepper/dsohowto.pdf).
+ * Note: the contents of the .got section is only modified by the MIPS resolver.
  */
 static void DRD_(suppress_relocation_conflicts)(const Addr a, const SizeT len)
 {
@@ -455,6 +456,16 @@ static void DRD_(suppress_relocation_conflicts)(const Addr a, const SizeT len)
          tl_assert(VG_(DebugInfo_sect_kind)(NULL, 0, avma) == Vg_SectGOTPLT);
          DRD_(start_suppression)(avma, avma + size, ".gotplt");
       }
+
+      avma = VG_(DebugInfo_get_got_avma)(di);
+      size = VG_(DebugInfo_get_got_size)(di);
+      tl_assert((avma && size) || (avma == 0 && size == 0));
+      if (size > 0) {
+        if (trace_sectsuppr)
+           VG_(dmsg)("Suppressing .got @ 0x%lx size %ld\n", avma, size);
+         tl_assert(VG_(DebugInfo_sect_kind)(NULL, 0, avma) == Vg_SectGOT);
+         DRD_(start_suppression)(avma, avma + size, ".got");
+      }
    }
 }
 
index 0604c9b9a26acfc7abc74271e9e13b195da184bf..133784a705fa8bfa1e7dacb83bac8fc57e7a52d2 100644 (file)
@@ -188,6 +188,8 @@ Addr          VG_(DebugInfo_get_plt_avma)    ( const DebugInfo *di );
 SizeT         VG_(DebugInfo_get_plt_size)    ( const DebugInfo *di );
 Addr          VG_(DebugInfo_get_gotplt_avma) ( const DebugInfo *di );
 SizeT         VG_(DebugInfo_get_gotplt_size) ( const DebugInfo *di );
+Addr          VG_(DebugInfo_get_got_avma)    ( const DebugInfo *di );
+SizeT         VG_(DebugInfo_get_got_size)    ( const DebugInfo *di );
 const UChar*  VG_(DebugInfo_get_soname)      ( const DebugInfo *di );
 const UChar*  VG_(DebugInfo_get_filename)    ( const DebugInfo *di );
 PtrdiffT      VG_(DebugInfo_get_text_bias)   ( const DebugInfo *di );