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

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>
parent 59126901
...@@ -41,6 +41,7 @@ FEATURE_TESTS_BASIC := \ ...@@ -41,6 +41,7 @@ FEATURE_TESTS_BASIC := \
gtk2 \ gtk2 \
gtk2-infobar \ gtk2-infobar \
libbfd \ libbfd \
libbfd-buildid \
libcap \ libcap \
libelf \ libelf \
libelf-getphdrnum \ libelf-getphdrnum \
...@@ -113,6 +114,7 @@ FEATURE_DISPLAY ?= \ ...@@ -113,6 +114,7 @@ FEATURE_DISPLAY ?= \
glibc \ glibc \
gtk2 \ gtk2 \
libbfd \ libbfd \
libbfd-buildid \
libcap \ libcap \
libelf \ libelf \
libnuma \ libnuma \
......
...@@ -15,6 +15,7 @@ FILES= \ ...@@ -15,6 +15,7 @@ FILES= \
test-hello.bin \ test-hello.bin \
test-libaudit.bin \ test-libaudit.bin \
test-libbfd.bin \ test-libbfd.bin \
test-libbfd-buildid.bin \
test-disassembler-four-args.bin \ test-disassembler-four-args.bin \
test-reallocarray.bin \ test-reallocarray.bin \
test-libbfd-liberty.bin \ test-libbfd-liberty.bin \
...@@ -229,6 +230,9 @@ $(OUTPUT)test-libpython-version.bin: ...@@ -229,6 +230,9 @@ $(OUTPUT)test-libpython-version.bin:
$(OUTPUT)test-libbfd.bin: $(OUTPUT)test-libbfd.bin:
$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
$(OUTPUT)test-libbfd-buildid.bin:
$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
$(OUTPUT)test-disassembler-four-args.bin: $(OUTPUT)test-disassembler-four-args.bin:
$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
......
...@@ -90,6 +90,10 @@ ...@@ -90,6 +90,10 @@
# include "test-libbfd.c" # include "test-libbfd.c"
#undef main #undef main
#define main main_test_libbfd_buildid
# include "test-libbfd-buildid.c"
#undef main
#define main main_test_backtrace #define main main_test_backtrace
# include "test-backtrace.c" # include "test-backtrace.c"
#undef main #undef main
...@@ -208,6 +212,7 @@ int main(int argc, char *argv[]) ...@@ -208,6 +212,7 @@ int main(int argc, char *argv[])
main_test_gtk2(argc, argv); main_test_gtk2(argc, argv);
main_test_gtk2_infobar(argc, argv); main_test_gtk2_infobar(argc, argv);
main_test_libbfd(); main_test_libbfd();
main_test_libbfd_buildid();
main_test_backtrace(); main_test_backtrace();
main_test_libnuma(); main_test_libnuma();
main_test_numa_num_possible_cpus(); main_test_numa_num_possible_cpus();
......
// 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);
}
...@@ -825,6 +825,12 @@ else ...@@ -825,6 +825,12 @@ else
$(call feature_check,disassembler-four-args) $(call feature_check,disassembler-four-args)
endif 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 ifdef NO_DEMANGLE
CFLAGS += -DNO_DEMANGLE CFLAGS += -DNO_DEMANGLE
else else
......
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