Skip to contentSkip to conversation

Manually setting libbfd unavailable will cause perf building aborted

DISCUSSION anzhou94 1 participant 1 message Apr 1, 2021

lore
Share & tools
lore

anzhou94

author
#0 lore raw

Hi, all

When buiiding perf, whether libbfd available and whether libbfd supports buildid feature will be checked. The check results are stored in two
variables: feature-libbfd and feature-libbfd-buildid. Then the variables will be used in tools/perf/Makefile.conf as follows:

ifeq ($(feature-libbfd), 1)
  EXTLIBS += -lbfd -lopcodes
else

  ...

endif

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

When compiling and executing the corresponding test program to get the check results, the above codes works well. While, when manually setting libbfd unavariable, i.e. feature-libbfd=0, these codes will cause building perf aborted.

Why? That's because whether libbfd is available and whether libbfd supports buildid are individually checked and used. When we manually setting feature-libbfd=0, value of feature-libbfd-buildid could be 1. I encountered such thing when building debian linux-image from source.

If libbfd unavailable, to check whether libbfd supports build is meaningless. Hence, unless libbfd available, we shouldn't check whether libbfd supports buildid. So, the above codes should be fixed:

ifeq ($(feature-libbfd), 1)
  EXTLIBS += -lbfd -lopcodes
else

  ...

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

endif