[lkml]   [2012]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH v2 05/12] perf tools: include basename for non-glibc systems
    From: Irina Tirdea <>

    perf uses the glibc version of basename(), by defining _GNU_SOURCE, including
    string.h and not including libgen.h. The glibc version of basename is better
    than the POSIX version since it does not modify its argument.

    Android has only one version of basename which is defined in libgen.h.
    This version is the same as the glibc version.

    Error on Android:
    util/annotate.c: In function 'symbol__annotate_printf':
    util/annotate.c:503:3: error: implicit declaration of function 'basename'
    util/annotate.c:503:3: error: nested extern declaration of 'basename'
    util/annotate.c:503:14: error: assignment makes pointer from integer without
    a cast [-Werror]

    On Android libgen.h should be included to define basename.

    Signed-off-by: Irina Tirdea <>
    tools/perf/util/symbol.h | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
    index fc4b1e6..d3b330c 100644
    --- a/tools/perf/util/symbol.h
    +++ b/tools/perf/util/symbol.h
    @@ -10,6 +10,9 @@
    #include <linux/rbtree.h>
    #include <stdio.h>
    #include <byteswap.h>
    +#if defined(__BIONIC__)
    +#include <libgen.h>

    #include <libelf.h>

     \ /
      Last update: 2012-09-08 03:41    [W:0.022 / U:13.968 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site