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

Commit a12e9ba7 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Greg Kroah-Hartman
Browse files

tools features: Add feature test to check if libbfd has buildid support



[ Upstream commit e71e19a9ea70952a53d58a99971820ce6c1794a8 ]

Which is needed by the PE executable support, for instance.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jacek Caban <jacek@codeweavers.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Remi Bernon <rbernon@codeweavers.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: 7822a8913f4c ("perf build: Update build rule for generated files")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 964e025c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ FEATURE_TESTS_BASIC := \
        gtk2-infobar                    \
        libaudit                        \
        libbfd                          \
        libbfd-buildid			\
        libcap                          \
        libelf                          \
        libelf-getphdrnum               \
@@ -110,6 +111,7 @@ FEATURE_DISPLAY ?= \
         gtk2                   \
         libaudit               \
         libbfd                 \
         libbfd-buildid		\
         libcap                 \
         libelf                 \
         libnuma                \
+4 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ FILES= \
         test-hello.bin                         \
         test-libaudit.bin                      \
         test-libbfd.bin                        \
         test-libbfd-buildid.bin		\
         test-disassembler-four-args.bin        \
         test-reallocarray.bin			\
         test-libbfd-liberty.bin                \
@@ -223,6 +224,9 @@ $(OUTPUT)test-libpython.bin:
$(OUTPUT)test-libbfd.bin:
	$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl

$(OUTPUT)test-libbfd-buildid.bin:
	$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl

$(OUTPUT)test-disassembler-four-args.bin:
	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes

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

#define main main_test_libbfd_buildid
# include "test-libbfd-buildid.c"
#undef main

#define main main_test_backtrace
# include "test-backtrace.c"
#undef main
@@ -208,6 +212,7 @@ int main(int argc, char *argv[])
	main_test_gtk2(argc, argv);
	main_test_gtk2_infobar(argc, argv);
	main_test_libbfd();
	main_test_libbfd_buildid();
	main_test_backtrace();
	main_test_libnuma();
	main_test_numa_num_possible_cpus();
+8 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#include <bfd.h>

int main(void)
{
	bfd *abfd = bfd_openr("Pedro", 0);
	return abfd && (!abfd->build_id || abfd->build_id->size > 0x506564726f);
}
+6 −0
Original line number Diff line number Diff line
@@ -775,6 +775,12 @@ else
  $(call feature_check,disassembler-four-args)
endif

ifeq ($(feature-libbfd-buildid), 1)
  CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
else
  msg := $(warning Old version of libbfd/binutils things like PE executable profiling will not be available);
endif

ifdef NO_DEMANGLE
  CFLAGS += -DNO_DEMANGLE
else