LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] perf tools: Add an option to build without libbfd
@ 2021-09-10 22:57 Ian Rogers
  2021-09-11 19:07 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2021-09-10 22:57 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, linux-kernel
  Cc: Tony Garnock-Jones, Ian Rogers

Some distributions, like debian, don't link perf with libbfd. Add a
build flag to make this configuration buildable and testable.
This was inspired by:
https://lore.kernel.org/linux-perf-users/20210910102307.2055484-1-tonyg@leastfixedpoint.com/T/#u

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/Makefile.config | 47 ++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index b66cf128cbc7..446180401e26 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -827,33 +827,36 @@ else
   endif
 endif
 
-ifeq ($(feature-libbfd), 1)
-  EXTLIBS += -lbfd -lopcodes
-else
-  # we are on a system that requires -liberty and (maybe) -lz
-  # to link against -lbfd; test each case individually here
-
-  # call all detections now so we get correct
-  # status in VF output
-  $(call feature_check,libbfd-liberty)
-  $(call feature_check,libbfd-liberty-z)
 
-  ifeq ($(feature-libbfd-liberty), 1)
-    EXTLIBS += -lbfd -lopcodes -liberty
-    FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
+ifndef NO_LIBBFD
+  ifeq ($(feature-libbfd), 1)
+    EXTLIBS += -lbfd -lopcodes
   else
-    ifeq ($(feature-libbfd-liberty-z), 1)
-      EXTLIBS += -lbfd -lopcodes -liberty -lz
-      FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
+    # we are on a system that requires -liberty and (maybe) -lz
+    # to link against -lbfd; test each case individually here
+
+    # call all detections now so we get correct
+    # status in VF output
+    $(call feature_check,libbfd-liberty)
+    $(call feature_check,libbfd-liberty-z)
+
+    ifeq ($(feature-libbfd-liberty), 1)
+      EXTLIBS += -lbfd -lopcodes -liberty
+      FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
+    else
+      ifeq ($(feature-libbfd-liberty-z), 1)
+        EXTLIBS += -lbfd -lopcodes -liberty -lz
+        FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
+      endif
     endif
+    $(call feature_check,disassembler-four-args)
   endif
-  $(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);
+  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
 endif
 
 ifdef NO_DEMANGLE
-- 
2.33.0.309.g3052b89438-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf tools: Add an option to build without libbfd
  2021-09-10 22:57 [PATCH] perf tools: Add an option to build without libbfd Ian Rogers
@ 2021-09-11 19:07 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-09-11 19:07 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-perf-users, linux-kernel,
	Tony Garnock-Jones

Em Fri, Sep 10, 2021 at 03:57:56PM -0700, Ian Rogers escreveu:
> Some distributions, like debian, don't link perf with libbfd. Add a
> build flag to make this configuration buildable and testable.
> This was inspired by:
> https://lore.kernel.org/linux-perf-users/20210910102307.2055484-1-tonyg@leastfixedpoint.com/T/#u

Looks ok, applied.

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/Makefile.config | 47 ++++++++++++++++++++------------------
>  1 file changed, 25 insertions(+), 22 deletions(-)
> 
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index b66cf128cbc7..446180401e26 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -827,33 +827,36 @@ else
>    endif
>  endif
>  
> -ifeq ($(feature-libbfd), 1)
> -  EXTLIBS += -lbfd -lopcodes
> -else
> -  # we are on a system that requires -liberty and (maybe) -lz
> -  # to link against -lbfd; test each case individually here
> -
> -  # call all detections now so we get correct
> -  # status in VF output
> -  $(call feature_check,libbfd-liberty)
> -  $(call feature_check,libbfd-liberty-z)
>  
> -  ifeq ($(feature-libbfd-liberty), 1)
> -    EXTLIBS += -lbfd -lopcodes -liberty
> -    FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
> +ifndef NO_LIBBFD
> +  ifeq ($(feature-libbfd), 1)
> +    EXTLIBS += -lbfd -lopcodes
>    else
> -    ifeq ($(feature-libbfd-liberty-z), 1)
> -      EXTLIBS += -lbfd -lopcodes -liberty -lz
> -      FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
> +    # we are on a system that requires -liberty and (maybe) -lz
> +    # to link against -lbfd; test each case individually here
> +
> +    # call all detections now so we get correct
> +    # status in VF output
> +    $(call feature_check,libbfd-liberty)
> +    $(call feature_check,libbfd-liberty-z)
> +
> +    ifeq ($(feature-libbfd-liberty), 1)
> +      EXTLIBS += -lbfd -lopcodes -liberty
> +      FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
> +    else
> +      ifeq ($(feature-libbfd-liberty-z), 1)
> +        EXTLIBS += -lbfd -lopcodes -liberty -lz
> +        FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
> +      endif
>      endif
> +    $(call feature_check,disassembler-four-args)
>    endif
> -  $(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);
> +  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
>  endif
>  
>  ifdef NO_DEMANGLE
> -- 
> 2.33.0.309.g3052b89438-goog

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-11 19:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 22:57 [PATCH] perf tools: Add an option to build without libbfd Ian Rogers
2021-09-11 19:07 ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).