d04297dca8bc58be45bbedd7e5b13815a8259aed
[AGL/meta-agl.git] / meta-agl-profile-core / recipes-devtools / valgrind / valgrind / valgrind-make-ld-XXX.so-strlen-intercept-optional.patch
1 From 005bd11809a1ce65e9f2c28e884354a4741650b9 Mon Sep 17 00:00:00 2001
2 From: Andre McCurdy <armccurdy@gmail.com>
3 Date: Tue, 13 Dec 2016 11:29:55 +0800
4 Subject: [PATCH] make ld-XXX.so strlen intercept optional
5
6 Hack: Depending on how glibc was compiled (e.g. optimised for size or
7 built with _FORTIFY_SOURCE enabled) the strlen symbol might not be
8 found in ld-XXX.so. Therefore although we should still try to
9 intercept it, don't make it mandatory to do so.
10
11 Upstream-Status: Inappropriate
12
13 Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
14 Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
15 ---
16  coregrind/m_redir.c | 13 ++++++++++++-
17  1 file changed, 12 insertions(+), 1 deletion(-)
18
19 diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
20 index 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 -- 
44 1.9.1
45