From: Florian Krohm Date: Wed, 3 Sep 2014 16:01:10 +0000 (+0000) Subject: Add a redirection for the 'index' function. X-Git-Tag: svn/VALGRIND_3_10_0~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2ecdcb67cfc8866aab7b225e3236f4bfa9491c1;p=thirdparty%2Fvalgrind.git Add a redirection for the 'index' function. Fixes BZ #327943 git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14441 --- diff --git a/NEWS b/NEWS index 8cf94130b9..24f79ab39d 100644 --- a/NEWS +++ b/NEWS @@ -217,6 +217,7 @@ where XXXXXX is the bug number as listed below. 327639 vex amd64->IR pcmpestri SSE4.2 instruction is unsupported 0x34 327837 dwz compressed alternate .debug_info and .debug_str not read correctly 327916 DW_TAG_typedef may have no name +327943 s390x: add a redirection for the 'index' function 328100 XABORT not implemented 328205 Implement additional Xen hypercalls 328454 add support Backtraces with ARM unwind tables (EXIDX) diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c index 374b796bbc..9d3c9b13c0 100644 --- a/coregrind/m_redir.c +++ b/coregrind/m_redir.c @@ -1467,7 +1467,12 @@ void VG_(redir_initialise) ( void ) } # elif defined(VGP_s390x_linux) - /* nothing so far */ + if (0==VG_(strcmp)("Memcheck", VG_(details).name)) { + // added in rsponse to BZ 327943 + add_hardwired_spec("ld64.so.1", "index", + (Addr)&VG_(s390x_linux_REDIR_FOR_index), + complain_about_stripped_glibc_ldso); + } # elif defined(VGP_mips32_linux) if (0==VG_(strcmp)("Memcheck", VG_(details).name)) { diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S index 81a1b1e57a..3d2be09ba7 100644 --- a/coregrind/m_trampoline.S +++ b/coregrind/m_trampoline.S @@ -1189,6 +1189,28 @@ VG_(s390x_linux_SUBST_FOR_rt_sigreturn): svc __NR_rt_sigreturn .short 0 +.global VG_(s390x_linux_REDIR_FOR_index) +.type VG_(s390x_linux_REDIR_FOR_index),@function +VG_(s390x_linux_REDIR_FOR_index): +# +# %r2 = addess of string +# %r3 = character to find +# + lghi %r0,255 + ngr %r0,%r3 # r0 = (unsigned char)r3 + lghi %r4,0 +.L1: + llgc %r1,0(%r2) # r1 = byte from string + cr %r1,%r0 # compare + ber %r14 # return if found + cr %r1,%r4 # end of string ? + je .L2 + aghi %r2,1 # increment r2 + j .L1 +.L2: lghi %r2,0 # return value 0 + br %r14 +.size VG_(s390x_linux_REDIR_FOR_index), .-VG_(s390x_linux_REDIR_FOR_index) + .globl VG_(trampoline_stuff_end) VG_(trampoline_stuff_end): .fill 2048, 2, 0x0000 diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h index 51dbc13c73..411a23cfd1 100644 --- a/coregrind/pub_core_trampoline.h +++ b/coregrind/pub_core_trampoline.h @@ -138,6 +138,11 @@ extern UInt VG_(amd64_darwin_REDIR_FOR_arc4random)( void ); #if defined(VGP_s390x_linux) extern Addr VG_(s390x_linux_SUBST_FOR_sigreturn); extern Addr VG_(s390x_linux_SUBST_FOR_rt_sigreturn); +// Note: Long for the 2nd parameter because according to z-series ABI, +// section "Parameter Passing" SIMPLE_ARG: +// "Values shorter than 64 bits are sign- or zero-extended +// (as appropriate) to 64 bits." +extern void* VG_(s390x_linux_REDIR_FOR_index) ( void*, Long ); #endif #if defined(VGP_mips32_linux) diff --git a/docs/internals/3_9_BUGSTATUS.txt b/docs/internals/3_9_BUGSTATUS.txt index 06ef48408b..bf8dac7e6f 100644 --- a/docs/internals/3_9_BUGSTATUS.txt +++ b/docs/internals/3_9_BUGSTATUS.txt @@ -147,7 +147,6 @@ HERE === other/s390 ========================================================= -327943 s390x missing index/strchr suppression for ld.so (bad backtrace?) === other/MacOS ========================================================