Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alireza Haghdoost" <haghdoost@uber.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 1/4] perf symbols: Fix broken ELF_C_READ_MMAP fallback guard
Date: Sun, 20 Sep 2026 02:42:25 +0000	[thread overview]
Message-ID: <20260920024225.94EDC1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260919-perf-symbol-memory-send-v2-1-495b8f00ad7c@uber.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf: build failure on non-elfutils systems due to removed ELF_C_READ_MMAP fallback
--

commit 85681e93b31655f473355c4d4ba6288016a5ebcd
Author: Alireza Haghdoost <haghdoost@uber.com>

perf symbols: Fix broken ELF_C_READ_MMAP fallback guard

This commit removes the compile-time fallback guard for ELF_C_READ_MMAP,
relying on the assumption that perf already requires a recent elfutils version
that provides this enumerator. It replaces the conditional definition with an
unconditional one.

> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index d0bac824c79c8..46b1649c64fc7 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -57,15 +57,7 @@ static inline bool is_livepatch_symbol(const char *str)
>  	return strstarts(str, KLP_SYM_PREFIX);
>  }
>  
> -/*
> - * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
> - * for newer versions we can use mmap to reduce memory usage:
> - */
> -#ifdef ELF_C_READ_MMAP
> -# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
> -#else
> -# define PERF_ELF_C_READ_MMAP ELF_C_READ
> -#endif
> +#define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP

[Severity: Low]
Does this unconditional reference cause a build failure on systems using
alternative libelf implementations?

ELF_C_READ_MMAP is an elfutils-specific extension and is undefined in
alternative implementations like elftoolchain, or in older libelf releases.

The perf build system verifies basic libelf support via test-libelf.c, which
only probes for ELF_C_READ. If a non-elfutils libelf is installed, the feature
test successfully passes and sets HAVE_LIBELF_SUPPORT.

When the compiler then evaluates symbol.h, the unconditional reference to
ELF_C_READ_MMAP will trigger an 'undeclared identifier' error.

Should this optional library extension be dynamically probed (e.g., via 
test-libelf-mmap.c) and safely guarded with fallbacks to avoid breaking builds 
on non-elfutils systems?

>  
>  #ifdef HAVE_LIBELF_SUPPORT
>  Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260919-perf-symbol-memory-send-v2-0-495b8f00ad7c@uber.com?part=1

  reply	other threads:[~2026-09-20  2:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  2:33 [PATCH v2 0/4] perf script: Bounded and lazy symbol loading Alireza Haghdoost via B4 Relay
2026-09-20  2:33 ` [PATCH v2 1/4] perf symbols: Fix broken ELF_C_READ_MMAP fallback guard Alireza Haghdoost via B4 Relay
2026-09-20  2:42   ` sashiko-bot [this message]
2026-09-20 23:52   ` Namhyung Kim
2026-09-20  2:33 ` [PATCH v2 2/4] perf script: Add --max-symbol-bytes to bound ELF symbol memory Alireza Haghdoost via B4 Relay
2026-09-20  2:43   ` sashiko-bot
2026-09-21  0:03   ` Namhyung Kim
2026-09-21  4:27     ` Alireza Haghdoost
2026-09-20  2:33 ` [PATCH v2 3/4] perf script: Add --lazy-load-symbols for lazy symbol loading Alireza Haghdoost via B4 Relay
2026-09-20  2:45   ` sashiko-bot
2026-09-20 13:49     ` Alireza Haghdoost
2026-09-21  0:19   ` Namhyung Kim
2026-09-21  4:45     ` Alireza Haghdoost
2026-09-20  2:33 ` [PATCH v2 4/4] perf test: Test lazy symbol loading and symbol memory limits Alireza Haghdoost via B4 Relay
2026-09-20  2:39   ` sashiko-bot

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=20260920024225.94EDC1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=haghdoost@uber.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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