From: Julian Seward Date: Tue, 27 Sep 2011 08:06:14 +0000 (+0000) Subject: Android only: don't ignore zero-sized symbols, since some of them X-Git-Tag: svn/VALGRIND_3_7_0~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bda076043c1075f25fadb8d5a1ba0061673cfc4a;p=thirdparty%2Fvalgrind.git Android only: don't ignore zero-sized symbols, since some of them are ones that m_redir really needs to see. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12055 --- diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index 08bb4f2343..a15c534736 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -360,14 +360,35 @@ Bool get_elf_symbol_info ( if (!plausible) return False; - /* Ignore if nameless, or zero-sized. */ - if (sym->st_name == (ElfXX_Word)0 + /* Ignore if nameless. */ + if (sym_name == (ElfXX_Word)0 || /* VG_(strlen)(sym_name) == 0 */ /* equivalent but cheaper ... */ - sym_name[0] == 0 - || sym->st_size == 0) { + sym_name[0] == 0) { + TRACE_SYMTAB(" ignore -- nameless: %s\n", sym_name); + return False; + } + + /* Ignore if zero-sized. Except on Android: + + On Android 2.3.5, some of the symbols that Memcheck needs to + intercept (for noise reduction purposes) have zero size, due to + lack of .size directives in handwritten assembly sources. So we + can't reject them out of hand -- instead give them a bogusly + large size and let canonicaliseSymtab trim them so they don't + overlap any following symbols. At least the following symbols + are known to be affected: + + in /system/lib/libc.so: strlen strcmp strcpy memcmp memcpy + in /system/bin/linker: __dl_strcmp __dl_strlen + */ + if (sym->st_size == 0) { +# if defined(VGPV_arm_linux_android) + *sym_size_out = 1024; +# else TRACE_SYMTAB(" ignore -- size=0: %s\n", sym_name); return False; +# endif } /* This seems to significantly reduce the number of junk