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

Commit 45757895 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Add feature check for libdw dwarf unwind



Adding feature check test code for libdw dwarf unwind.

Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1392825179-5228-4-git-send-email-jolsa@redhat.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7a0447d6
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -59,6 +59,18 @@ ifeq ($(NO_PERF_REGS),0)
  CFLAGS += -DHAVE_PERF_REGS_SUPPORT
endif

ifndef NO_LIBELF
  # for linking with debug library, run like:
  # make DEBUG=1 LIBDW_DIR=/opt/libdw/
  ifdef LIBDW_DIR
    LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
    LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib

    FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
    FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
  endif
endif

# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

@@ -267,13 +279,6 @@ else
      msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
    endif
  else
    # for linking with debug library, run like:
    # make DEBUG=1 LIBDW_DIR=/opt/libdw/
    ifdef LIBDW_DIR
      LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
      LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
    endif

    ifneq ($(feature-dwarf), 1)
      msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
      NO_DWARF := 1
+5 −1
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@ FILES= \
	test-libunwind-debug-frame.bin	\
	test-on-exit.bin		\
	test-stackprotector-all.bin	\
	test-timerfd.bin
	test-timerfd.bin		\
	test-libdw-dwarf-unwind.bin

CC := $(CROSS_COMPILE)gcc -MD
PKG_CONFIG := $(CROSS_COMPILE)pkg-config
@@ -141,6 +142,9 @@ test-backtrace.bin:
test-timerfd.bin:
	$(BUILD)

test-libdw-dwarf-unwind.bin:
	$(BUILD)

-include *.d

###############################
+5 −0
Original line number Diff line number Diff line
@@ -89,6 +89,10 @@
# include "test-stackprotector-all.c"
#undef main

#define main main_test_libdw_dwarf_unwind
# include "test-libdw-dwarf-unwind.c"
#undef main

int main(int argc, char *argv[])
{
	main_test_libpython();
@@ -111,6 +115,7 @@ int main(int argc, char *argv[])
	main_test_libnuma();
	main_test_timerfd();
	main_test_stackprotector_all();
	main_test_libdw_dwarf_unwind();

	return 0;
}
+13 −0
Original line number Diff line number Diff line

#include <elfutils/libdwfl.h>

int main(void)
{
	/*
	 * This function is guarded via: __nonnull_attribute__ (1, 2).
	 * Passing '1' as arguments value. This code is never executed,
	 * only compiled.
	 */
	dwfl_thread_getframes((void *) 1, (void *) 1, NULL);
	return 0;
}