Skip to content

Commit ad5f604

Browse files
committed
perf test: Fix a compile error on pe-file-parsing.c
The dso__find_symbol_by_name() should be have idx pointer argument. Found during the build-test. $ make build-test ... CC /tmp/tmp.6JwPK1xbWG/tests/pe-file-parsing.o tests/pe-file-parsing.c: In function ‘run_dir’: tests/pe-file-parsing.c:64:15: error: too few arguments to function ‘dso__find_symbol_by_name’ 64 | sym = dso__find_symbol_by_name(dso, "main"); | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from tests/pe-file-parsing.c:16: /usr/local/google/home/namhyung/project/linux/tools/perf/util/symbol.h:135:16: note: declared here 135 | struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name, size_t *idx); | ^~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 259dce9 ("perf symbol: Remove symbol_name_rb_node") Acked-by: Ian Rogers <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 78987bb commit ad5f604

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

tools/perf/Makefile.config

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
315315

316316
FEATURE_CHECK_LDFLAGS-libaio = -lrt
317317

318+
FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
319+
FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
320+
318321
CORE_CFLAGS += -fno-omit-frame-pointer
319322
CORE_CFLAGS += -ggdb3
320323
CORE_CFLAGS += -funwind-tables
@@ -344,8 +347,8 @@ ifneq ($(TCMALLOC),)
344347
endif
345348

346349
ifeq ($(FEATURES_DUMP),)
347-
# We will display at the end of this Makefile.config, using $(call feature_display_entries),
348-
# as we may retry some feature detection here.
350+
# We will display at the end of this Makefile.config, using $(call feature_display_entries)
351+
# As we may retry some feature detection here, see the disassembler-four-args case, for instance
349352
FEATURE_DISPLAY_DEFERRED := 1
350353
include $(srctree)/tools/build/Makefile.feature
351354
else
@@ -907,9 +910,13 @@ ifdef BUILD_NONDISTRO
907910

908911
ifeq ($(feature-libbfd-liberty), 1)
909912
EXTLIBS += -lbfd -lopcodes -liberty
913+
FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
914+
FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
910915
else
911916
ifeq ($(feature-libbfd-liberty-z), 1)
912917
EXTLIBS += -lbfd -lopcodes -liberty -lz
918+
FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
919+
FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
913920
endif
914921
endif
915922
$(call feature_check,disassembler-four-args)
@@ -1333,6 +1340,6 @@ endif
13331340

13341341
# re-generate FEATURE-DUMP as we may have called feature_check, found out
13351342
# extra libraries to add to LDFLAGS of some other test and then redo those
1336-
# tests.
1343+
# tests, see the block about libbfd, disassembler-four-args, for instance.
13371344
$(shell rm -f $(FEATURE_DUMP_FILENAME))
13381345
$(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME)))

tools/perf/tests/pe-file-parsing.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static int run_dir(const char *d)
3434
struct dso *dso;
3535
struct symbol *sym;
3636
int ret;
37+
size_t idx;
3738

3839
scnprintf(filename, PATH_MAX, "%s/pe-file.exe", d);
3940
ret = filename__read_build_id(filename, &bid);
@@ -61,7 +62,7 @@ static int run_dir(const char *d)
6162
TEST_ASSERT_VAL("Failed to load symbols", ret == 0);
6263

6364
dso__sort_by_name(dso);
64-
sym = dso__find_symbol_by_name(dso, "main");
65+
sym = dso__find_symbol_by_name(dso, "main", &idx);
6566
TEST_ASSERT_VAL("Failed to find main", sym);
6667
dso__delete(dso);
6768

0 commit comments

Comments
 (0)