!4 [sync] PR-3: 升级dwarves版本到1.22
From: @openeuler-sync-bot Reviewed-by: @bitcoffee Signed-off-by: @bitcoffee
This commit is contained in:
commit
7956e6356f
BIN
393a058.tar.gz
Normal file
BIN
393a058.tar.gz
Normal file
Binary file not shown.
@ -1,59 +0,0 @@
|
||||
From 66d12e4790b7c5e508b75e805589849fee782a49 Mon Sep 17 00:00:00 2001
|
||||
From: Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
Date: Tue, 2 Feb 2021 09:38:46 -0300
|
||||
Subject: [PATCH] dtagnames: Stop using the deprecated mallinfo() function
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Bulding on fedora rawhide gets us:
|
||||
|
||||
/home/acme/git/pahole/dtagnames.c:17:16: error: ‘mallinfo’ is deprecated [-Werror=deprecated-declarations]
|
||||
17 | struct mallinfo m = mallinfo();
|
||||
| ^~~~~~~~
|
||||
In file included from /home/acme/git/pahole/dtagnames.c:10:
|
||||
/usr/include/malloc.h:118:24: note: declared here
|
||||
118 | extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED;
|
||||
| ^~~~~~~~
|
||||
cc1: all warnings being treated as errors
|
||||
|
||||
glibc-2.32.9000-26.fc34.x86_64
|
||||
|
||||
So stop using it, was just for debugging/assessing memory usage.
|
||||
|
||||
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
---
|
||||
dtagnames.c | 9 ---------
|
||||
1 file changed, 9 deletions(-)
|
||||
|
||||
diff --git a/dtagnames.c b/dtagnames.c
|
||||
index 0ffcbf7..6a24c37 100644
|
||||
--- a/dtagnames.c
|
||||
+++ b/dtagnames.c
|
||||
@@ -7,18 +7,10 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
-#include <malloc.h>
|
||||
|
||||
#include "dwarves.h"
|
||||
#include "dutil.h"
|
||||
|
||||
-static void print_malloc_stats(void)
|
||||
-{
|
||||
- struct mallinfo m = mallinfo();
|
||||
-
|
||||
- fprintf(stderr, "size: %u\n", m.uordblks);
|
||||
-}
|
||||
-
|
||||
static int class__tag_name(struct tag *tag, struct cu *cu __unused,
|
||||
void *cookie __unused)
|
||||
{
|
||||
@@ -54,7 +46,6 @@ int main(int argc __unused, char *argv[])
|
||||
}
|
||||
|
||||
cus__dump_class_tag_names(cus);
|
||||
- print_malloc_stats();
|
||||
rc = EXIT_SUCCESS;
|
||||
out:
|
||||
cus__delete(cus);
|
||||
20
dwarves.spec
20
dwarves.spec
@ -1,22 +1,22 @@
|
||||
%define libname libdwarves
|
||||
%define libver 1
|
||||
%define libbpfver 0.1.0
|
||||
%define libbpfver 393a058
|
||||
|
||||
Name: dwarves
|
||||
Version: 1.17
|
||||
Release: 2
|
||||
Version: 1.22
|
||||
Release: 1
|
||||
License: GPLv2
|
||||
Summary: Debugging Information Manipulation Tools
|
||||
URL: http://acmel.wordpress.com
|
||||
Source: http://github.com/acmel/dwarves/archive/v%{version}.tar.gz
|
||||
Source1: http://github.com/libbpf/libbpf/archive/v%{libbpfver}.tar.gz
|
||||
Source1: http://github.com/libbpf/libbpf/archive/%{libbpfver}.tar.gz
|
||||
Requires: %{libname}%{libver} = %{version}-%{release}
|
||||
BuildRequires: gcc
|
||||
BuildRequires: cmake
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: elfutils-devel >= 0.170
|
||||
|
||||
Patch6000: dtagnames-stop-using-the-deprecated-mallinfo-function.patch
|
||||
Patch0: replace-deprecated-libbpf-APIs-with-new-ones.patch
|
||||
|
||||
%description
|
||||
dwarves is a set of tools that use the debugging information inserted in
|
||||
@ -41,6 +41,10 @@ Debugging information processing library development files.
|
||||
tar -zxvf %{SOURCE1} --strip-components 1 -C %{_builddir}/%{name}-%{version}/lib/bpf/
|
||||
|
||||
%build
|
||||
# Remove _FORTIFY_SOURCE from CFLAGS or else will get below error:
|
||||
# error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
|
||||
export CFLAGS=$(echo %optflags | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//g')
|
||||
|
||||
%cmake .
|
||||
make VERBOSE=1 %{?_smp_mflags}
|
||||
|
||||
@ -80,6 +84,12 @@ make install DESTDIR=%{buildroot}
|
||||
%{_libdir}/%{libname}_reorganize.so
|
||||
|
||||
%changelog
|
||||
* Mon Mar 21 2022 - Kai Liu <kai.liu@suse.com> - 1.22-1
|
||||
- Upgrade to v1.22. Also upgrade bundled libbpf to commit 393a058,
|
||||
the same as upstream submodule version.
|
||||
Introduce a patch from upstream commit 73383b3a3 to avoid using
|
||||
deprecated libbpf APIs.
|
||||
|
||||
* Mon May 24 2021 xiaqirong <xiaqirong1@huawei.com> - 1.17-2
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
113
replace-deprecated-libbpf-APIs-with-new-ones.patch
Normal file
113
replace-deprecated-libbpf-APIs-with-new-ones.patch
Normal file
@ -0,0 +1,113 @@
|
||||
From 73383b3a39afe86b22e098773e47b8546c48a649 Mon Sep 17 00:00:00 2001
|
||||
From: Kui-Feng Lee <kuifeng@fb.com>
|
||||
Date: Wed, 26 Jan 2022 11:20:39 -0800
|
||||
Subject: [PATCH] libbpf: Update libbpf to the latest git HEAD
|
||||
|
||||
Replace deprecated APIs with new ones.
|
||||
|
||||
Signed-off-by: Kui-Feng Lee <kuifeng@fb.com>
|
||||
Acked-by: Andrii Nakryiko <andrii@kernel.org>
|
||||
Cc: Alexei Starovoitov <ast@kernel.org>
|
||||
Cc: Daniel Borkmann <daniel@iogearbox.net>
|
||||
Cc: bpf@vger.kernel.org
|
||||
Cc: dwarves@vger.kernel.org
|
||||
Link: https://lore.kernel.org/r/20220126192039.2840752-5-kuifeng@fb.com
|
||||
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
Signed-off-by: Kai Liu <kai.liu@suse.com>
|
||||
---
|
||||
btf_encoder.c | 20 ++++++++++----------
|
||||
btf_loader.c | 2 +-
|
||||
lib/bpf | 2 +-
|
||||
3 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/btf_encoder.c b/btf_encoder.c
|
||||
index 56a76f5d..fa29824f 100644
|
||||
--- a/btf_encoder.c
|
||||
+++ b/btf_encoder.c
|
||||
@@ -172,7 +172,7 @@ __attribute ((format (printf, 5, 6)))
|
||||
static void btf__log_err(const struct btf *btf, int kind, const char *name,
|
||||
bool output_cr, const char *fmt, ...)
|
||||
{
|
||||
- fprintf(stderr, "[%u] %s %s", btf__get_nr_types(btf) + 1,
|
||||
+ fprintf(stderr, "[%u] %s %s", btf__type_cnt(btf),
|
||||
btf_kind_str[kind], name ?: "(anon)");
|
||||
|
||||
if (fmt && *fmt) {
|
||||
@@ -203,7 +203,7 @@ static void btf_encoder__log_type(const struct btf_encoder *encoder, const struc
|
||||
out = err ? stderr : stdout;
|
||||
|
||||
fprintf(out, "[%u] %s %s",
|
||||
- btf__get_nr_types(btf), btf_kind_str[kind],
|
||||
+ btf__type_cnt(btf) - 1, btf_kind_str[kind],
|
||||
btf__printable_name(btf, t->name_off));
|
||||
|
||||
if (fmt && *fmt) {
|
||||
@@ -449,10 +449,10 @@ static int btf_encoder__add_field(struct btf_encoder *encoder, const char *name,
|
||||
int err;
|
||||
|
||||
err = btf__add_field(btf, name, type, offset, bitfield_size);
|
||||
- t = btf__type_by_id(btf, btf__get_nr_types(btf));
|
||||
+ t = btf__type_by_id(btf, btf__type_cnt(btf) - 1);
|
||||
if (err) {
|
||||
fprintf(stderr, "[%u] %s %s's field '%s' offset=%u bit_size=%u type=%u Error emitting field\n",
|
||||
- btf__get_nr_types(btf), btf_kind_str[btf_kind(t)],
|
||||
+ btf__type_cnt(btf) - 1, btf_kind_str[btf_kind(t)],
|
||||
btf__printable_name(btf, t->name_off),
|
||||
name, offset, bitfield_size, type);
|
||||
} else {
|
||||
@@ -899,9 +899,9 @@ static int btf_encoder__write_raw_file(struct btf_encoder *encoder)
|
||||
const void *raw_btf_data;
|
||||
int fd, err;
|
||||
|
||||
- raw_btf_data = btf__get_raw_data(encoder->btf, &raw_btf_size);
|
||||
+ raw_btf_data = btf__raw_data(encoder->btf, &raw_btf_size);
|
||||
if (raw_btf_data == NULL) {
|
||||
- fprintf(stderr, "%s: btf__get_raw_data failed!\n", __func__);
|
||||
+ fprintf(stderr, "%s: btf__raw_data failed!\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -976,7 +976,7 @@ static int btf_encoder__write_elf(struct btf_encoder *encoder)
|
||||
}
|
||||
}
|
||||
|
||||
- raw_btf_data = btf__get_raw_data(btf, &raw_btf_size);
|
||||
+ raw_btf_data = btf__raw_data(btf, &raw_btf_size);
|
||||
|
||||
if (btf_data) {
|
||||
/* Existing .BTF section found */
|
||||
@@ -1043,10 +1043,10 @@ int btf_encoder__encode(struct btf_encoder *encoder)
|
||||
btf_encoder__add_datasec(encoder, PERCPU_SECTION);
|
||||
|
||||
/* Empty file, nothing to do, so... done! */
|
||||
- if (btf__get_nr_types(encoder->btf) == 0)
|
||||
+ if (btf__type_cnt(encoder->btf) == 1)
|
||||
return 0;
|
||||
|
||||
- if (btf__dedup(encoder->btf, NULL, NULL)) {
|
||||
+ if (btf__dedup(encoder->btf, NULL)) {
|
||||
fprintf(stderr, "%s: btf__dedup failed!\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
@@ -1403,7 +1403,7 @@ void btf_encoder__delete(struct btf_encoder *encoder)
|
||||
|
||||
int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu)
|
||||
{
|
||||
- uint32_t type_id_off = btf__get_nr_types(encoder->btf);
|
||||
+ uint32_t type_id_off = btf__type_cnt(encoder->btf) - 1;
|
||||
uint32_t core_id;
|
||||
struct function *fn;
|
||||
struct tag *pos;
|
||||
diff --git a/btf_loader.c b/btf_loader.c
|
||||
index b61cadd5..b5d44464 100644
|
||||
--- a/btf_loader.c
|
||||
+++ b/btf_loader.c
|
||||
@@ -399,7 +399,7 @@ static int btf__load_types(struct btf *btf, struct cu *cu)
|
||||
uint32_t type_index;
|
||||
int err;
|
||||
|
||||
- for (type_index = 1; type_index <= btf__get_nr_types(btf); type_index++) {
|
||||
+ for (type_index = 1; type_index < btf__type_cnt(btf); type_index++) {
|
||||
const struct btf_type *type_ptr = btf__type_by_id(btf, type_index);
|
||||
uint32_t type = btf_kind(type_ptr);
|
||||
|
||||
BIN
v0.1.0.tar.gz
BIN
v0.1.0.tar.gz
Binary file not shown.
BIN
v1.17.tar.gz
BIN
v1.17.tar.gz
Binary file not shown.
BIN
v1.22.tar.gz
Normal file
BIN
v1.22.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user