Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb1c9185 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

tools/perf: Turn strlcpy() into a __weak function

The strlcpy() feature check slows every build unnecessarily - so make it
a __weak function so it does not have to be auto-detected.

If the libc (or any other library) has an strlcpy() implementation it will
be used - otherwise our fallback is active.

Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-zjbrcupapu08ePsyYhhhxiwk@git.kernel.org


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 7a10822a
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -121,7 +121,6 @@ FEATURE_TESTS = \
	libperl				\
	libpython			\
	libpython-version		\
	strlcpy				\
	libbfd				\
	on-exit				\
	backtrace			\
@@ -436,12 +435,6 @@ else
  endif
endif

ifndef NO_STRLCPY
  ifeq ($(feature-strlcpy), 1)
    CFLAGS += -DHAVE_STRLCPY_SUPPORT
  endif
endif

ifndef NO_ON_EXIT
  ifeq ($(feature-on-exit), 1)
    CFLAGS += -DHAVE_ON_EXIT_SUPPORT
+0 −4
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ FILES= \
	test-libperl			\
	test-libpython			\
	test-libpython-version		\
	test-strlcpy			\
	test-libbfd			\
	test-on-exit			\
	test-backtrace			\
@@ -116,9 +115,6 @@ test-libpython:
test-libpython-version:
	$(BUILD) $(FLAGS_PYTHON_EMBED)

test-strlcpy:
	$(BUILD)

test-libbfd:
	$(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl

+0 −8
Original line number Diff line number Diff line
#include <stdlib.h>
extern size_t strlcpy(char *dest, const char *src, size_t size);

int main(void)
{
	strlcpy(NULL, NULL, 0);
	return 0;
}
+1 −2
Original line number Diff line number Diff line
@@ -70,8 +70,7 @@ extern char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2
extern char *perf_pathdup(const char *fmt, ...)
	__attribute__((format (printf, 1, 2)));

#ifndef HAVE_STRLCPY_SUPPORT
/* Matches the libc/libbsd function attribute so we declare this unconditionally: */
extern size_t strlcpy(char *dest, const char *src, size_t size);
#endif

#endif /* __PERF_CACHE_H */
+4 −0
Original line number Diff line number Diff line
@@ -23,4 +23,8 @@
# define __force
#endif

#ifndef __weak
# define __weak			__attribute__((weak))
#endif

#endif
Loading