]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a redirection for the 'index' function.
authorFlorian Krohm <florian@eich-krohm.de>
Wed, 3 Sep 2014 16:01:10 +0000 (16:01 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Wed, 3 Sep 2014 16:01:10 +0000 (16:01 +0000)
Fixes BZ #327943

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14441

NEWS
coregrind/m_redir.c
coregrind/m_trampoline.S
coregrind/pub_core_trampoline.h
docs/internals/3_9_BUGSTATUS.txt

diff --git a/NEWS b/NEWS
index 8cf94130b954f4409a98899183c1549d354dc762..24f79ab39d823a98161f4a1471526a1f8e0e5118 100644 (file)
--- 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)
index 374b796bbc4b2fd3c6a873a08f6464735875cb62..9d3c9b13c06db4534a6c799d4add094e8ec2ab73 100644 (file)
@@ -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)) {
index 81a1b1e57a522ed4fea59746462c880e85a3c8b0..3d2be09ba762c61d060f836a8b53904bda487e1f 100644 (file)
@@ -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
index 51dbc13c73d226434e3cbe53da1c190c6c600a02..411a23cfd12a5ecbaf079bca38b25ddf1b58a263 100644 (file)
@@ -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)
index 06ef48408bb0c13ea1d0bfee80b0b73b71fa06a0..bf8dac7e6f6d0715e624e12f5a189ca183700bd5 100644 (file)
@@ -147,7 +147,6 @@ HERE
 
 === other/s390 =========================================================
 
-327943  s390x missing index/strchr suppression for ld.so (bad backtrace?)
 
 === other/MacOS ========================================================