From: Bart Van Assche Date: Thu, 6 Sep 2012 14:08:26 +0000 (+0000) Subject: drd: Suppress race reports on .got sections too X-Git-Tag: svn/VALGRIND_3_9_0~698 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f907e648010a3fd16a6822e964fb41663b8d4d5;p=thirdparty%2Fvalgrind.git drd: Suppress race reports on .got sections too This is a slightly modified version of a patch provided by Petar Jovanovic . git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12960 --- diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 218547bfea..21bf93317b 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -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; diff --git a/drd/drd_main.c b/drd/drd_main.c index 5e86f818a0..7b3570e755 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -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"); + } } } diff --git a/include/pub_tool_debuginfo.h b/include/pub_tool_debuginfo.h index 0604c9b9a2..133784a705 100644 --- a/include/pub_tool_debuginfo.h +++ b/include/pub_tool_debuginfo.h @@ -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 );