Commit 0215d59b authored by Vineet Gupta's avatar Vineet Gupta Committed by Arnaldo Carvalho de Melo

tools lib: Reinstate strlcpy() header guard with __UCLIBC__

perf tools build in recent kernels spews splat when cross compiling with uClibc:

|   CC       util/alias.o
| In file included from tools/perf/util/../ui/../util/cache.h:8:0,
|                 from tools/perf/util/../ui/helpline.h:7,
|                 from tools/perf/util/debug.h:8,
|                 from arch/../util/cpumap.h:9,
|                 from arch/../util/env.h:5,
|                 from arch/common.h:4,
|                 from arch/common.c:3:
| tools/include/linux/string.h:12:15: warning: redundant redeclaration of ‘strlcpy’ [-Wredundant-decls]
|  extern size_t strlcpy(char *dest, const char *src, size_t size);
This is after commit 61a6445e ("tools lib: Guard the strlcpy() header with

The problem is uClibc also defines __GLIBC__ for exported headers for
applications. So add that specific check to not trip for uClibc.
Signed-off-by: default avatarVineet Gupta <>
Cc: Adrian Hunter <>
Cc: Alexey Brodkin <>
Cc: David Ahern <>
Cc: Jiri Olsa <>
Cc: Josh Poimboeuf <>
Cc: Namhyung Kim <>
Cc: Peter Zijlstra <>
Cc: Petri Gynther <>
Cc: Wang Nan <>
Link: default avatarArnaldo Carvalho de Melo <>
parent 67540759
......@@ -8,7 +8,11 @@ void *memdup(const void *src, size_t len);
int strtobool(const char *s, bool *res);
#ifdef __GLIBC__
* glibc based builds needs the extern while uClibc doesn't.
* However uClibc headers also define __GLIBC__ hence the hack below
#if defined(__GLIBC__) && !defined(__UCLIBC__)
extern size_t strlcpy(char *dest, const char *src, size_t size);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment