binutils: Update to version 2.40

binutils 2.39: https://lists.gnu.org/archive/html/info-gnu/2022-08/msg00002.html
binutils 2.40: https://lists.gnu.org/archive/html/info-gnu/2023-01/msg00003.html

This version includes a new libsframe.so library, pack it into the
libbfd package as it is used by this library. Also deactivate some
optional configuration options for now.

An extra patch to fix compile problem in AARCH64 is added.
gprofng needs a C++ standard library, deactivate it for now.

Activate feature-disassembler-init-styled in bpftools too to fix
compilation with the updated binutils.

An bpftool version 7.0 or later is needed for binutils 2.39 and later.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Hauke Mehrtens 2023-02-26 15:47:09 +01:00
parent 26a65e852c
commit a03076cc39
3 changed files with 97 additions and 5 deletions

View File

@ -8,16 +8,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=binutils
PKG_VERSION:=2.38
PKG_VERSION:=2.40
PKG_RELEASE:=1
PKG_SOURCE_URL:=@GNU/binutils
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_VERSION:=$(PKG_VERSION)
PKG_HASH:=e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024
PKG_HASH:=0f8a4c272d7f17f369ded10a4aca28b8e304828e95526da482b0ccc4dfc9d8e1
PKG_FIXUP:=patch-libtool
PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld libiberty gold intl
PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof gprofng binutils ld libiberty gold intl libctf libsframe
PKG_REMOVE_FILES:=libtool.m4
PKG_INSTALL:=1
@ -87,7 +87,10 @@ CONFIGURE_ARGS += \
--enable-shared \
--enable-install-libiberty \
--enable-install-libbfd \
--enable-install-libctf
--enable-install-libctf \
--with-system-zlib \
--without-zstd \
--disable-gprofng
define Build/Install
$(call Build/Install/Default)
@ -105,6 +108,7 @@ endef
define Package/libbfd/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so* $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsframe*.so* $(1)/usr/lib/
endef
define Package/libctf/install

View File

@ -0,0 +1,88 @@
Fix this compile error:
----------------------
./../common/cpuid.c:27:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__get_cpuid'
27 | __get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
| ^~~~~~~~~~~
----------------------
and this error:
----------------------
unwind.c: In function '__collector_ext_return_address':
unwind.c:236:34: error: '__u64' undeclared (first use in this function)
236 | context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
| ^~~~~
unwind.c:490:3: note: in expansion of macro 'FILL_CONTEXT'
490 | FILL_CONTEXT ((&context));
----------------------
--- a/gprofng/common/cpuid.c
+++ b/gprofng/common/cpuid.c
@@ -23,7 +23,7 @@
#elif defined(__aarch64__)
#define ATTRIBUTE_UNUSED __attribute__((unused))
-static inline uint_t __attribute_const__
+static inline uint_t __attribute__((__const__))
__get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
unsigned int *ebx ATTRIBUTE_UNUSED,
unsigned int *ecx ATTRIBUTE_UNUSED, unsigned int *edx ATTRIBUTE_UNUSED)
--- a/gprofng/libcollector/unwind.c
+++ b/gprofng/libcollector/unwind.c
@@ -233,7 +233,7 @@ memory_error_func (int status ATTRIBUTE_
#elif ARCH(Aarch64)
#define FILL_CONTEXT(context) \
{ CALL_UTIL (getcontext) (context); \
- context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
+ context->uc_mcontext.sp = (uint64_t) __builtin_frame_address(0); \
}
#endif /* ARCH() */
@@ -4579,11 +4579,11 @@ stack_unwind (char *buf, int size, void
if (buf && bptr && eptr && context && size + mode > 0)
getByteInstruction ((unsigned char *) eptr);
int ind = 0;
- __u64 *lbuf = (void *) buf;
- int lsize = size / sizeof (__u64);
- __u64 pc = context->uc_mcontext.pc;
- __u64 sp = context->uc_mcontext.sp;
- __u64 stack_base;
+ uint64_t *lbuf = (void *) buf;
+ int lsize = size / sizeof (uint64_t);
+ uint64_t pc = context->uc_mcontext.pc;
+ uint64_t sp = context->uc_mcontext.sp;
+ uint64_t stack_base;
unsigned long tbgn = 0;
unsigned long tend = 0;
@@ -4594,7 +4594,7 @@ stack_unwind (char *buf, int size, void
{
stack_base = sp + 0x100000;
if (stack_base < sp) // overflow
- stack_base = (__u64) -1;
+ stack_base = (uint64_t) -1;
}
DprintfT (SP_DUMP_UNWIND,
"unwind.c:%d stack_unwind %2d pc=0x%llx sp=0x%llx stack_base=0x%llx\n",
@@ -4625,17 +4625,17 @@ stack_unwind (char *buf, int size, void
__LINE__, (unsigned long) sp);
break;
}
- pc = ((__u64 *) sp)[1];
- __u64 old_sp = sp;
- sp = ((__u64 *) sp)[0];
+ pc = ((uint64_t *) sp)[1];
+ uint64_t old_sp = sp;
+ sp = ((uint64_t *) sp)[0];
if (sp < old_sp)
break;
}
if (ind >= lsize)
{
ind = lsize - 1;
- lbuf[ind++] = (__u64) SP_TRUNC_STACK_MARKER;
+ lbuf[ind++] = (uint64_t) SP_TRUNC_STACK_MARKER;
}
- return ind * sizeof (__u64);
+ return ind * sizeof (uint64_t);
}
#endif /* ARCH() */

View File

@ -106,7 +106,7 @@ MAKE_FLAGS += \
feature-llvm=0 \
feature-libcap=0 \
feature-disassembler-four-args=1 \
feature-disassembler-init-styled=0
feature-disassembler-init-styled=1
ifeq ($(BUILD_VARIANT),lib)
MAKE_PATH = libbpf/src