[OE-core] [PATCH] glibc: add -fno-builtin-strlen when not using -O2

Huang, Jie (Jackie) Jackie.Huang at windriver.com
Wed Dec 14 02:38:37 UTC 2016



> -----Original Message-----
> From: Andre McCurdy [mailto:armccurdy at gmail.com]
> Sent: Tuesday, December 13, 2016 5:17 PM
> To: Huang, Jie (Jackie)
> Cc: Khem Raj; Patches and discussions about the oe-core layer
> Subject: Re: [OE-core] [PATCH] glibc: add -fno-builtin-strlen when not using -O2
> 
> On Mon, Dec 12, 2016 at 9:14 PM, Huang, Jie (Jackie)
> <Jackie.Huang at windriver.com> wrote:
> >> From: Andre McCurdy [mailto:armccurdy at gmail.com]
> >> For reference, here's the patch I've been using. It's a slightly more
> >> generic fix than the one in the KDE bug report.
> >
> > Thanks, It's a better patch and I will take it and send as v2 of this issue if you're
> > not going to send it yourself, is it fine for you and could you provide extra info
> > for the patch header like, upstream-status, written by or Signed-off-by?
> 
> Sure. I forget why I didn't submit this at the time. The full patch is:

Thanks, I rebased the patch since valgrind updated  and sent v2 for this issue:

[OE-core] [v2][PATCH] valgrind: make ld-XXX.so strlen intercept optional

Thanks,
Jackie


> 
> From d34e2a50ca5493f5a0ce9ccad83a36ac33689266 Mon Sep 17 00:00:00 2001
> From: Andre McCurdy <armccurdy at gmail.com>
> Date: Fri, 12 Feb 2016 18:22:12 -0800
> Subject: [PATCH] make ld-XXX.so strlen intercept optional
> 
> Hack: Depending on how glibc was compiled (e.g. optimised for size or
> built with _FORTIFY_SOURCE enabled) the strlen symbol might not be
> found in ld-XXX.so. Therefore although we should still try to
> intercept it, don't make it mandatory to do so.
> 
> Upstream-Status: Inappropriate
> 
> Signed-off-by: Andre McCurdy <armccurdy at gmail.com>
> ---
>  coregrind/m_redir.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
> index 7e4df8d..640a346 100644
> --- a/coregrind/m_redir.c
> +++ b/coregrind/m_redir.c
> @@ -1220,7 +1220,18 @@ static void add_hardwired_spec (const  HChar*
> sopatt, const HChar* fnpatt,
>     spec->from_fnpatt = CONST_CAST(HChar *,fnpatt);
>     spec->to_addr     = to_addr;
>     spec->isWrap      = False;
> -   spec->mandatory   = mandatory;
> +
> +   /* Hack: Depending on how glibc was compiled (e.g. optimised for size or
> +      built with _FORTIFY_SOURCE enabled) the strlen symbol might not be found.
> +      Therefore although we should still try to intercept it, don't make it
> +      mandatory to do so. We over-ride "mandatory" here to avoid the need to
> +      patch the many different architecture specific callers to
> +      add_hardwired_spec(). */
> +   if (0==VG_(strcmp)("strlen", fnpatt))
> +      spec->mandatory = NULL;
> +   else
> +      spec->mandatory = mandatory;
> +
>     /* VARIABLE PARTS */
>     spec->mark        = False; /* not significant */
>     spec->done        = False; /* not significant */
> --
> 1.9.1


More information about the Openembedded-core mailing list