1From 005bd11809a1ce65e9f2c28e884354a4741650b9 Mon Sep 17 00:00:00 2001
2From: Andre McCurdy <armccurdy@gmail.com>
3Date: Tue, 13 Dec 2016 11:29:55 +0800
4Subject: [PATCH] make ld-XXX.so strlen intercept optional
5
6Hack: Depending on how glibc was compiled (e.g. optimised for size or
7built with _FORTIFY_SOURCE enabled) the strlen symbol might not be
8found in ld-XXX.so. Therefore although we should still try to
9intercept it, don't make it mandatory to do so.
10
11Upstream-Status: Inappropriate
12
13Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
14Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
15---
16 coregrind/m_redir.c | 13 ++++++++++++-
17 1 file changed, 12 insertions(+), 1 deletion(-)
18
19diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
20index ff35009..d7d6816 100644
21--- a/coregrind/m_redir.c
22+++ b/coregrind/m_redir.c
23@@ -1275,7 +1275,18 @@ static void add_hardwired_spec (const  HChar* sopatt, const HChar* fnpatt,
24    spec->to_addr     = to_addr;
25    spec->isWrap      = False;
26    spec->isGlobal    = False;
27-   spec->mandatory   = mandatory;
28+
29+   /* Hack: Depending on how glibc was compiled (e.g. optimised for size or
30+      built with _FORTIFY_SOURCE enabled) the strlen symbol might not be found.
31+      Therefore although we should still try to intercept it, don't make it
32+      mandatory to do so. We over-ride "mandatory" here to avoid the need to
33+      patch the many different architecture specific callers to
34+      add_hardwired_spec(). */
35+   if (0==VG_(strcmp)("strlen", fnpatt))
36+      spec->mandatory = NULL;
37+   else
38+      spec->mandatory = mandatory;
39+
40    /* VARIABLE PARTS */
41    spec->mark        = False; /* not significant */
42    spec->done        = False; /* not significant */
43--
441.9.1
45
46