Accepting request 906664 from devel:tools
- Update to version 1.21+git175.1ef87b2 (jsc#SLE-17288): OBS-URL: https://build.opensuse.org/request/show/906664 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dwarves?expand=0&rev=32
This commit is contained in:
commit
a864a98c42
15
_service
Normal file
15
_service
Normal file
@ -0,0 +1,15 @@
|
||||
<services>
|
||||
<service name="tar_scm" mode="disabled">
|
||||
<param name="scm">git</param>
|
||||
<param name="url">git://git.kernel.org/pub/scm/devel/pahole/pahole</param>
|
||||
<param name="revision">master</param>
|
||||
<param name="versionrewrite-pattern">v(.*)</param>
|
||||
<param name="versionformat">@PARENT_TAG@+git@TAG_OFFSET@.%h</param>
|
||||
<param name="filename">dwarves</param>
|
||||
</service>
|
||||
<service name="recompress" mode="disabled">
|
||||
<param name="file">*.tar</param>
|
||||
<param name="compression">xz</param>
|
||||
</service>
|
||||
<service name="set_version" mode="disabled" />
|
||||
</services>
|
@ -1,84 +0,0 @@
|
||||
From 0d17503db0580a6635d103fed030724b38ba1364 Mon Sep 17 00:00:00 2001
|
||||
From: Andrii Nakryiko <andrii@kernel.org>
|
||||
Date: Mon, 24 May 2021 16:42:22 -0700
|
||||
Subject: [PATCH] btf_encoder: fix and complete filtering out zero-sized
|
||||
per-CPU variables
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Upstram: accepted - expected version 1.22
|
||||
Git-commit: 0d17503db0580a6635d103fed030724b38ba1364
|
||||
|
||||
btf_encoder is ignoring zero-sized per-CPU ELF symbols, but the same has to be
|
||||
done for DWARF variables when matching them with ELF symbols. This is due to
|
||||
zero-sized DWARF variables matching unrelated (non-zero-sized) variable that
|
||||
happens to be allocated at the exact same address, leading to a lot of
|
||||
confusion in BTF.
|
||||
|
||||
See [0] for when this causes big problems.
|
||||
|
||||
[0] https://lore.kernel.org/bpf/CAEf4BzZ0-sihSL-UAm21JcaCCY92CqfNxycHRZYXcoj8OYb=wA@mail.gmail.com/
|
||||
|
||||
Committer notes:
|
||||
|
||||
Kept the {} around the if block with more than one line, which
|
||||
simplifies the original patch by just removing that assignment
|
||||
to the 'dwarf_name' variable.
|
||||
|
||||
Reported-by: Michal Suchánek <msuchanek@suse.de>
|
||||
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
|
||||
Cc: Jiri Olsa <jolsa@kernel.org>
|
||||
Cc: bpf@vger.kernel.org
|
||||
Cc: dwarves@vger.kernel.org
|
||||
Cc: kernel-team@fb.com
|
||||
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
---
|
||||
btf_encoder.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/btf_encoder.c b/btf_encoder.c
|
||||
index c711f12..033c927 100644
|
||||
--- a/btf_encoder.c
|
||||
+++ b/btf_encoder.c
|
||||
@@ -538,6 +538,7 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
|
||||
cu__for_each_variable(cu, core_id, pos) {
|
||||
uint32_t size, type, linkage;
|
||||
const char *name, *dwarf_name;
|
||||
+ const struct tag *tag;
|
||||
uint64_t addr;
|
||||
int id;
|
||||
|
||||
@@ -550,6 +551,7 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
|
||||
|
||||
/* addr has to be recorded before we follow spec */
|
||||
addr = var->ip.addr;
|
||||
+ dwarf_name = variable__name(var, cu);
|
||||
|
||||
/* DWARF takes into account .data..percpu section offset
|
||||
* within its segment, which for vmlinux is 0, but for kernel
|
||||
@@ -583,7 +585,6 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
|
||||
* per-CPU symbols have non-zero values.
|
||||
*/
|
||||
if (var->ip.addr == 0) {
|
||||
- dwarf_name = variable__name(var, cu);
|
||||
if (!dwarf_name || strcmp(dwarf_name, name))
|
||||
continue;
|
||||
}
|
||||
@@ -600,6 +601,13 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
|
||||
break;
|
||||
}
|
||||
|
||||
+ tag = cu__type(cu, var->ip.tag.type);
|
||||
+ if (tag__size(tag, cu) == 0) {
|
||||
+ if (btf_elf__verbose)
|
||||
+ fprintf(stderr, "Ignoring zero-sized per-CPU variable '%s'...\n", dwarf_name ?: "<missing name>");
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
type = var->ip.tag.type + type_id_off;
|
||||
linkage = var->external ? BTF_VAR_GLOBAL_ALLOCATED : BTF_VAR_STATIC;
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
3
dwarves-1.21+git175.1ef87b2.tar.xz
Normal file
3
dwarves-1.21+git175.1ef87b2.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5ca6190d1ae24570a4162a085b9c525a9b7235e8c2a46ea655bbce248df90172
|
||||
size 910348
|
@ -1,7 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCYHRbEwAKCRCyPKLppCJ+
|
||||
J5LZAQCaEI/We6c5Qv/j2T6s+Ybeu4k6xWPj80MwCxjJKZBKpgD/b+fMM0g4FVcF
|
||||
dbiyE7Rca34D4M0vMH0mWwKs7SQ/YQI=
|
||||
=bOCB
|
||||
-----END PGP SIGNATURE-----
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:33a8bed6c0e1a5889578e01d1afed3f752353dc087d8bda36d258fe83e42a476
|
||||
size 910480
|
14
dwarves-Prep-1.22.patch
Normal file
14
dwarves-Prep-1.22.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- dwarves-1.21+git175.1ef87b2/CMakeLists.txt 2021-06-17 02:07:22.000000000 +0200
|
||||
+++ dwarves-1.21+git175.1ef87b2/CMakeLists.txt 2021-07-15 22:09:41.020434732 +0200
|
||||
@@ -53,9 +53,9 @@
|
||||
endif (NOT DEFINED BUILD_SHARED_LIBS)
|
||||
|
||||
# Just for grepping, DWARVES_VERSION isn't used anywhere anymore
|
||||
-# add_definitions(-D_GNU_SOURCE -DDWARVES_VERSION="v1.21")
|
||||
+# add_definitions(-D_GNU_SOURCE -DDWARVES_VERSION="v1.22")
|
||||
add_definitions(-D_GNU_SOURCE -DDWARVES_MAJOR_VERSION=1)
|
||||
-add_definitions(-D_GNU_SOURCE -DDWARVES_MINOR_VERSION=21)
|
||||
+add_definitions(-D_GNU_SOURCE -DDWARVES_MINOR_VERSION=22)
|
||||
find_package(DWARF REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
@ -1,3 +1,23 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 15 20:04:36 UTC 2021 - msuchanek@suse.com
|
||||
|
||||
- Update to version 1.21+git175.1ef87b2 (jsc#SLE-17288):
|
||||
* libbpf: bump dependency to >= 0.4.0
|
||||
* CMakeLists.txt: Enable SHARED and STATIC lib creation
|
||||
* libbpf: Allow to use packaged version
|
||||
* btfdiff: Support diffing DWARF vs detached BTF
|
||||
* pahole: Allow encoding BTF into a detached file
|
||||
* pahole: Add --kabi_prefix flag
|
||||
* btf_encoder: fix and complete filtering out zero-sized per-CPU variables
|
||||
* btf: Remove ftrace filter
|
||||
* pahole: Introduce --with_flexible_array option to show just types ending in a flexible array
|
||||
* Many updates to btf_encoder and bug fixes
|
||||
- Remove upstreamed patches
|
||||
- btf_encoder-fix-and-complete-filtering-out-zero-sized-per-CPU-variables.patch
|
||||
- remove-ftrace-filter.patch
|
||||
- Pretend version 1.22 to make kernel happy
|
||||
+ dwarves-Prep-1.22.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 2 14:05:24 UTC 2021 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
14
dwarves.spec
14
dwarves.spec
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: dwarves
|
||||
Version: 1.21
|
||||
Version: 1.21+git175.1ef87b2
|
||||
Release: 0
|
||||
Summary: DWARF utilities
|
||||
License: GPL-2.0-only
|
||||
@ -25,15 +25,16 @@ Group: Development/Tools/Debuggers
|
||||
URL: https://acmel.wordpress.com/
|
||||
#Git-Clone: git://git.kernel.org/pub/scm/devel/pahole/pahole
|
||||
#Git-Web: http://git.kernel.org/cgit/devel/pahole/pahole.git
|
||||
Source: https://fedorapeople.org/~acme/dwarves/dwarves-%version.tar.xz
|
||||
Source2: https://fedorapeople.org/~acme/dwarves/dwarves-%version.tar.sign
|
||||
Source: %{name}-%{version}.tar.xz
|
||||
#Source: https://fedorapeople.org/~acme/dwarves/dwarves-%version.tar.xz
|
||||
#Source2: https://fedorapeople.org/~acme/dwarves/dwarves-%version.tar.sign
|
||||
Source9: baselibs.conf
|
||||
Patch0: remove-ftrace-filter.patch
|
||||
Patch1: btf_encoder-fix-and-complete-filtering-out-zero-sized-per-CPU-variables.patch
|
||||
Patch0: dwarves-Prep-1.22.patch
|
||||
BuildRequires: cmake
|
||||
BuildRequires: libdw-devel >= 0.171
|
||||
BuildRequires: libelf-devel
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: pkgconfig(libbpf)
|
||||
BuildRequires: pkgconfig(zlib)
|
||||
# Also known by its most prominent tool
|
||||
Provides: pahole = %version-%release
|
||||
@ -90,7 +91,8 @@ for processing DWARF, a debugging data format for ELF files.
|
||||
|
||||
%build
|
||||
sv="$PWD/lib.v"
|
||||
echo "DWARVES_%version { global: *; };" >"$sv"
|
||||
ver=$(echo %version | cut -d+ -f1)
|
||||
echo "DWARVES_$ver{ global: *; };" >"$sv"
|
||||
%cmake -DCMAKE_SHARED_LINKER_FLAGS:STRING="-Wl,--version-script=$sv"
|
||||
%cmake_build
|
||||
|
||||
|
@ -1,343 +0,0 @@
|
||||
From: Jiri Slaby <jslaby@suse.cz>
|
||||
Date: Tue, 4 May 2021 08:09:50 +0200
|
||||
Subject: remove ftrace filter
|
||||
Patch-mainline: under discussion
|
||||
References: ppc64 kernel build failure
|
||||
|
||||
Functions in the .opd section on ppc64 are currently ignored as they
|
||||
don't contain mcount calls -- they are excluded by the ftrace filter.
|
||||
Therefore, pahole cannot produce a .BTF section from vmlinux and kernel
|
||||
build fails on ppc64.
|
||||
|
||||
Remove the ftrace filter completely as was discussed:
|
||||
https://lore.kernel.org/bpf/20210501001653.x3b4rk4vk4iqv3n7@kafai-mbp.dhcp.thefacebook.com/
|
||||
https://lore.kernel.org/bpf/YI%2FLgjLxo9VCN%2Fd+@krava/
|
||||
|
||||
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
|
||||
---
|
||||
btf_encoder.c | 272 +-------------------------------------------------
|
||||
1 file changed, 5 insertions(+), 267 deletions(-)
|
||||
|
||||
diff --git a/btf_encoder.c b/btf_encoder.c
|
||||
index 80e896961d4e..ba83bb088efa 100644
|
||||
--- a/btf_encoder.c
|
||||
+++ b/btf_encoder.c
|
||||
@@ -27,17 +27,8 @@
|
||||
*/
|
||||
#define KSYM_NAME_LEN 128
|
||||
|
||||
-struct funcs_layout {
|
||||
- unsigned long mcount_start;
|
||||
- unsigned long mcount_stop;
|
||||
- unsigned long mcount_sec_idx;
|
||||
-};
|
||||
-
|
||||
struct elf_function {
|
||||
const char *name;
|
||||
- unsigned long addr;
|
||||
- unsigned long size;
|
||||
- unsigned long sh_addr;
|
||||
bool generated;
|
||||
};
|
||||
|
||||
@@ -98,250 +89,11 @@ static int collect_function(struct btf_elf *btfe, GElf_Sym *sym,
|
||||
}
|
||||
|
||||
functions[functions_cnt].name = name;
|
||||
- functions[functions_cnt].addr = elf_sym__value(sym);
|
||||
- functions[functions_cnt].size = elf_sym__size(sym);
|
||||
- functions[functions_cnt].sh_addr = sh.sh_addr;
|
||||
functions[functions_cnt].generated = false;
|
||||
functions_cnt++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int addrs_cmp(const void *_a, const void *_b)
|
||||
-{
|
||||
- const __u64 *a = _a;
|
||||
- const __u64 *b = _b;
|
||||
-
|
||||
- if (*a == *b)
|
||||
- return 0;
|
||||
- return *a < *b ? -1 : 1;
|
||||
-}
|
||||
-
|
||||
-static int get_vmlinux_addrs(struct btf_elf *btfe, struct funcs_layout *fl,
|
||||
- __u64 **paddrs, __u64 *pcount)
|
||||
-{
|
||||
- __u64 *addrs, count, offset;
|
||||
- unsigned int addr_size, i;
|
||||
- Elf_Data *data;
|
||||
- GElf_Shdr shdr;
|
||||
- Elf_Scn *sec;
|
||||
-
|
||||
- /* Initialize for the sake of all error paths below. */
|
||||
- *paddrs = NULL;
|
||||
- *pcount = 0;
|
||||
-
|
||||
- if (!fl->mcount_start || !fl->mcount_stop)
|
||||
- return 0;
|
||||
-
|
||||
- /*
|
||||
- * Find mcount addressed marked by __start_mcount_loc
|
||||
- * and __stop_mcount_loc symbols and load them into
|
||||
- * sorted array.
|
||||
- */
|
||||
- sec = elf_getscn(btfe->elf, fl->mcount_sec_idx);
|
||||
- if (!sec || !gelf_getshdr(sec, &shdr)) {
|
||||
- fprintf(stderr, "Failed to get section(%lu) header.\n",
|
||||
- fl->mcount_sec_idx);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- /* Get address size from processed file's ELF class. */
|
||||
- addr_size = gelf_getclass(btfe->elf) == ELFCLASS32 ? 4 : 8;
|
||||
-
|
||||
- offset = fl->mcount_start - shdr.sh_addr;
|
||||
- count = (fl->mcount_stop - fl->mcount_start) / addr_size;
|
||||
-
|
||||
- data = elf_getdata(sec, 0);
|
||||
- if (!data) {
|
||||
- fprintf(stderr, "Failed to get section(%lu) data.\n",
|
||||
- fl->mcount_sec_idx);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- addrs = malloc(count * sizeof(addrs[0]));
|
||||
- if (!addrs) {
|
||||
- fprintf(stderr, "Failed to allocate memory for ftrace addresses.\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (addr_size == sizeof(__u64)) {
|
||||
- memcpy(addrs, data->d_buf + offset, count * addr_size);
|
||||
- } else {
|
||||
- for (i = 0; i < count; i++)
|
||||
- addrs[i] = (__u64) *((__u32 *) (data->d_buf + offset + i * addr_size));
|
||||
- }
|
||||
-
|
||||
- *paddrs = addrs;
|
||||
- *pcount = count;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
-get_kmod_addrs(struct btf_elf *btfe, __u64 **paddrs, __u64 *pcount)
|
||||
-{
|
||||
- __u64 *addrs, count;
|
||||
- unsigned int addr_size, i;
|
||||
- GElf_Shdr shdr_mcount;
|
||||
- Elf_Data *data;
|
||||
- Elf_Scn *sec;
|
||||
-
|
||||
- /* Initialize for the sake of all error paths below. */
|
||||
- *paddrs = NULL;
|
||||
- *pcount = 0;
|
||||
-
|
||||
- /* get __mcount_loc */
|
||||
- sec = elf_section_by_name(btfe->elf, &btfe->ehdr, &shdr_mcount,
|
||||
- "__mcount_loc", NULL);
|
||||
- if (!sec) {
|
||||
- if (btf_elf__verbose) {
|
||||
- printf("%s: '%s' doesn't have __mcount_loc section\n", __func__,
|
||||
- btfe->filename);
|
||||
- }
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- data = elf_getdata(sec, NULL);
|
||||
- if (!data) {
|
||||
- fprintf(stderr, "Failed to data for __mcount_loc section.\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- /* Get address size from processed file's ELF class. */
|
||||
- addr_size = gelf_getclass(btfe->elf) == ELFCLASS32 ? 4 : 8;
|
||||
-
|
||||
- count = data->d_size / addr_size;
|
||||
-
|
||||
- addrs = malloc(count * sizeof(addrs[0]));
|
||||
- if (!addrs) {
|
||||
- fprintf(stderr, "Failed to allocate memory for ftrace addresses.\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (addr_size == sizeof(__u64)) {
|
||||
- memcpy(addrs, data->d_buf, count * addr_size);
|
||||
- } else {
|
||||
- for (i = 0; i < count; i++)
|
||||
- addrs[i] = (__u64) *((__u32 *) (data->d_buf + i * addr_size));
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * We get Elf object from dwfl_module_getelf function,
|
||||
- * which performs all possible relocations, including
|
||||
- * __mcount_loc section.
|
||||
- *
|
||||
- * So addrs array now contains relocated values, which
|
||||
- * we need take into account when we compare them to
|
||||
- * functions values, see comment in setup_functions
|
||||
- * function.
|
||||
- */
|
||||
- *paddrs = addrs;
|
||||
- *pcount = count;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static int is_ftrace_func(struct elf_function *func, __u64 *addrs, __u64 count)
|
||||
-{
|
||||
- __u64 start = func->addr;
|
||||
- __u64 addr, end = func->addr + func->size;
|
||||
-
|
||||
- /*
|
||||
- * The invariant here is addr[r] that is the smallest address
|
||||
- * that is >= than function start addr. Except the corner case
|
||||
- * where there is no such r, but for that we have a final check
|
||||
- * in the return.
|
||||
- */
|
||||
- size_t l = 0, r = count - 1, m;
|
||||
-
|
||||
- /* make sure we don't use invalid r */
|
||||
- if (count == 0)
|
||||
- return false;
|
||||
-
|
||||
- while (l < r) {
|
||||
- m = l + (r - l) / 2;
|
||||
- addr = addrs[m];
|
||||
-
|
||||
- if (addr >= start) {
|
||||
- /* we satisfy invariant, so tighten r */
|
||||
- r = m;
|
||||
- } else {
|
||||
- /* m is not good enough as l, maybe m + 1 will be */
|
||||
- l = m + 1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return start <= addrs[r] && addrs[r] < end;
|
||||
-}
|
||||
-
|
||||
-static int setup_functions(struct btf_elf *btfe, struct funcs_layout *fl)
|
||||
-{
|
||||
- __u64 *addrs, count, i;
|
||||
- int functions_valid = 0;
|
||||
- bool kmod = false;
|
||||
-
|
||||
- /*
|
||||
- * Check if we are processing vmlinux image and
|
||||
- * get mcount data if it's detected.
|
||||
- */
|
||||
- if (get_vmlinux_addrs(btfe, fl, &addrs, &count))
|
||||
- return -1;
|
||||
-
|
||||
- /*
|
||||
- * Check if we are processing kernel module and
|
||||
- * get mcount data if it's detected.
|
||||
- */
|
||||
- if (!addrs) {
|
||||
- if (get_kmod_addrs(btfe, &addrs, &count))
|
||||
- return -1;
|
||||
- kmod = true;
|
||||
- }
|
||||
-
|
||||
- if (!addrs) {
|
||||
- if (btf_elf__verbose)
|
||||
- printf("ftrace symbols not detected, falling back to DWARF data\n");
|
||||
- delete_functions();
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- qsort(addrs, count, sizeof(addrs[0]), addrs_cmp);
|
||||
- qsort(functions, functions_cnt, sizeof(functions[0]), functions_cmp);
|
||||
-
|
||||
- /*
|
||||
- * Let's got through all collected functions and filter
|
||||
- * out those that are not in ftrace.
|
||||
- */
|
||||
- for (i = 0; i < functions_cnt; i++) {
|
||||
- struct elf_function *func = &functions[i];
|
||||
- /*
|
||||
- * For vmlinux image both addrs[x] and functions[x]::addr
|
||||
- * values are final address and are comparable.
|
||||
- *
|
||||
- * For kernel module addrs[x] is final address, but
|
||||
- * functions[x]::addr is relative address within section
|
||||
- * and needs to be relocated by adding sh_addr.
|
||||
- */
|
||||
- if (kmod)
|
||||
- func->addr += func->sh_addr;
|
||||
-
|
||||
- /* Make sure function is within ftrace addresses. */
|
||||
- if (is_ftrace_func(func, addrs, count)) {
|
||||
- /*
|
||||
- * We iterate over sorted array, so we can easily skip
|
||||
- * not valid item and move following valid field into
|
||||
- * its place, and still keep the 'new' array sorted.
|
||||
- */
|
||||
- if (i != functions_valid)
|
||||
- functions[functions_valid] = functions[i];
|
||||
- functions_valid++;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- functions_cnt = functions_valid;
|
||||
- free(addrs);
|
||||
-
|
||||
- if (btf_elf__verbose)
|
||||
- printf("Found %d functions!\n", functions_cnt);
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static struct elf_function *find_function(const struct btf_elf *btfe,
|
||||
const char *name)
|
||||
{
|
||||
@@ -620,23 +372,8 @@ static int collect_percpu_var(struct btf_elf *btfe, GElf_Sym *sym,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void collect_symbol(GElf_Sym *sym, struct funcs_layout *fl,
|
||||
- size_t sym_sec_idx)
|
||||
-{
|
||||
- if (!fl->mcount_start &&
|
||||
- !strcmp("__start_mcount_loc", elf_sym__name(sym, btfe->symtab))) {
|
||||
- fl->mcount_start = sym->st_value;
|
||||
- fl->mcount_sec_idx = sym_sec_idx;
|
||||
- }
|
||||
-
|
||||
- if (!fl->mcount_stop &&
|
||||
- !strcmp("__stop_mcount_loc", elf_sym__name(sym, btfe->symtab)))
|
||||
- fl->mcount_stop = sym->st_value;
|
||||
-}
|
||||
-
|
||||
static int collect_symbols(struct btf_elf *btfe, bool collect_percpu_vars)
|
||||
{
|
||||
- struct funcs_layout fl = { };
|
||||
Elf32_Word sym_sec_idx;
|
||||
uint32_t core_id;
|
||||
GElf_Sym sym;
|
||||
@@ -650,7 +387,6 @@ static int collect_symbols(struct btf_elf *btfe, bool collect_percpu_vars)
|
||||
return -1;
|
||||
if (collect_function(btfe, &sym, sym_sec_idx))
|
||||
return -1;
|
||||
- collect_symbol(&sym, &fl, sym_sec_idx);
|
||||
}
|
||||
|
||||
if (collect_percpu_vars) {
|
||||
@@ -661,9 +397,11 @@ static int collect_symbols(struct btf_elf *btfe, bool collect_percpu_vars)
|
||||
printf("Found %d per-CPU variables!\n", percpu_var_cnt);
|
||||
}
|
||||
|
||||
- if (functions_cnt && setup_functions(btfe, &fl)) {
|
||||
- fprintf(stderr, "Failed to filter DWARF functions\n");
|
||||
- return -1;
|
||||
+ if (functions_cnt) {
|
||||
+ qsort(functions, functions_cnt, sizeof(functions[0]), functions_cmp);
|
||||
+
|
||||
+ if (btf_elf__verbose)
|
||||
+ printf("Found %d functions!\n", functions_cnt);
|
||||
}
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.31.1
|
||||
|
Loading…
Reference in New Issue
Block a user