public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
Date: Sat, 17 Sep 2022 21:46:08 +0000 (UTC)	[thread overview]
Message-ID: <1663450906.c026e499608c9a6a71ad316d526d5e46d03690ef.sam@gentoo> (raw)

commit:     c026e499608c9a6a71ad316d526d5e46d03690ef
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Wed Sep 14 05:33:18 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 17 21:41:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c026e499

dev-util/bpftrace: fix build failure with binutils-2.39

Closes: https://bugs.gentoo.org/868120
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Closes: https://github.com/gentoo/gentoo/pull/27243
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild        |  1 +
 .../files/bpftrace-0.15.0-binutils-2.39.patch      | 87 ++++++++++++++++++++++
 2 files changed, 88 insertions(+)

diff --git a/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild b/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild
index 51346cb3d38d..566a14a29b4a 100644
--- a/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild
+++ b/dev-util/bpftrace/bpftrace-0.15.0-r1.ebuild
@@ -53,6 +53,7 @@ PATCHES=(
 	"${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
 	"${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
 	"${FILESDIR}/bpftrace-0.15.0-bcc-025.patch"
+	"${FILESDIR}/bpftrace-0.15.0-binutils-2.39.patch"
 )
 
 pkg_pretend() {

diff --git a/dev-util/bpftrace/files/bpftrace-0.15.0-binutils-2.39.patch b/dev-util/bpftrace/files/bpftrace-0.15.0-binutils-2.39.patch
new file mode 100644
index 000000000000..cb4b8a9bb2d2
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.15.0-binutils-2.39.patch
@@ -0,0 +1,87 @@
+
+Patch taken from: https://github.com/iovisor/bpftrace/pull/2328
+Removed hunk #1 (CHANGELOG.md) since it conflicts and is not required.
+Bug: https://bugs.gentoo.org/868120
+
+From 3be6e708d514d3378a4fe985ab907643ecbc77ee Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Mon, 15 Aug 2022 15:13:14 +0200
+Subject: [PATCH] Fix builds against libbfd(binutils) >=2.39
+
+Binutils 2.39 changed signature of the init_disassemble_info function by
+adding an extra parameter for styled printf function. Let CMake detect
+which of the versions is present and call it appropriately.
+---
+ CHANGELOG.md           |  2 ++
+ CMakeLists.txt         |  3 +++
+ cmake/FindLibBfd.cmake | 10 ++++++++++
+ src/bfd-disasm.cpp     | 14 ++++++++++++++
+ 4 files changed, 29 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8f7995afd2..2e54eb84f8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -249,6 +249,9 @@ if(HAVE_BFD_DISASM)
+   if(LIBBFD_DISASM_FOUR_ARGS_SIGNATURE)
+     set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" LIBBFD_DISASM_FOUR_ARGS_SIGNATURE)
+   endif(LIBBFD_DISASM_FOUR_ARGS_SIGNATURE)
++  if(LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE)
++    set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE)
++  endif(LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE)
+ endif(HAVE_BFD_DISASM)
+ 
+ if (LIBBPF_BTF_DUMP_FOUND)
+diff --git a/cmake/FindLibBfd.cmake b/cmake/FindLibBfd.cmake
+index 4f4b8c4e20..5d917b188c 100644
+--- a/cmake/FindLibBfd.cmake
++++ b/cmake/FindLibBfd.cmake
+@@ -75,5 +75,15 @@ int main(void) {
+                abfd);
+   return 0;
+ }" LIBBFD_DISASM_FOUR_ARGS_SIGNATURE)
++CHECK_CXX_SOURCE_COMPILES("
++// See comment in bfd-disasm.cpp for why this needs to exist
++#define PACKAGE \"bpftrace-test\"
++#include <dis-asm.h>
++
++int main(void) {
++  init_disassemble_info(NULL, NULL, NULL, NULL);
++  return 0;
++}
++" LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ endif()
+diff --git a/src/bfd-disasm.cpp b/src/bfd-disasm.cpp
+index f846468cd8..d4165dfac5 100644
+--- a/src/bfd-disasm.cpp
++++ b/src/bfd-disasm.cpp
+@@ -38,6 +38,16 @@ static int fprintf_nop(void *out __attribute__((unused)), const char *fmt __attr
+   return 0;
+ }
+ 
++#ifdef LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE
++static int fprintf_styled_nop(void *out __attribute__((unused)),
++                              enum disassembler_style s __attribute__((unused)),
++                              const char *fmt __attribute__((unused)),
++                              ...)
++{
++  return 0;
++}
++#endif
++
+ static AlignState is_aligned_buf(void *buf, uint64_t size, uint64_t offset)
+ {
+   disassembler_ftype disassemble;
+@@ -55,7 +65,11 @@ static AlignState is_aligned_buf(void *buf, uint64_t size, uint64_t offset)
+     return AlignState::Fail;
+   }
+ 
++#ifdef LIBBFD_INIT_DISASM_INFO_FOUR_ARGS_SIGNATURE
++  init_disassemble_info(&info, stdout, fprintf_nop, fprintf_styled_nop);
++#else
+   init_disassemble_info(&info, stdout, fprintf_nop);
++#endif
+ 
+   info.arch = bfd_get_arch(bfdf);
+   info.mach = bfd_get_mach(bfdf);


             reply	other threads:[~2022-09-17 21:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-17 21:46 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-31 18:35 [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/ Patrick McLean
2023-05-15 19:34 Patrick McLean
2023-05-15 19:34 Patrick McLean
2023-03-19 17:34 Michał Górny
2023-02-06  2:04 Patrick McLean
2023-01-26 18:57 Patrick McLean
2022-08-29 17:40 Patrick McLean
2022-05-24 17:47 Patrick McLean
2021-12-02 18:02 Patrick McLean
2021-12-02 17:30 Patrick McLean
2021-11-07 20:59 Jakov Smolić
2021-10-26 22:07 Patrick McLean
2021-07-09 17:11 Patrick McLean
2021-04-19 23:50 Patrick McLean
2020-11-27 19:01 Patrick McLean
2020-06-20 19:23 Patrick McLean
2020-04-14  2:07 Patrick McLean
2020-03-09  6:01 Patrick McLean
2019-11-21 18:29 Patrick McLean
2019-03-20 21:27 Patrick McLean
2019-03-12  2:16 Patrick McLean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1663450906.c026e499608c9a6a71ad316d526d5e46d03690ef.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox