Skip to content

kbuild: try readelf first in gen_symversions#1767

Open
opsiff wants to merge 1 commit into
deepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-05-27-readelf
Open

kbuild: try readelf first in gen_symversions#1767
opsiff wants to merge 1 commit into
deepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-05-27-readelf

Conversation

@opsiff
Copy link
Copy Markdown
Member

@opsiff opsiff commented May 26, 2026

deepin inclusion
category: performance

Instead of nm, readelf is more faster, and significantly improve build speed when enable CONFIG_GENKSYMS.

Summary by Sourcery

Enhancements:

  • Optimize symbol version generation by using readelf before falling back to nm, reducing overhead during builds with CONFIG_GENKSYMS enabled.

deepin inclusion
category: performance

Instead of nm, readelf is more faster, and significantly improve build speed
when enable CONFIG_GENKSYMS.

Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 26, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Switches gen_symversions in the kernel build system to prefer readelf over nm for extracting symbol information, aiming to improve build performance when CONFIG_GENKSYMS is enabled.

File-Level Changes

Change Details Files
Prefer readelf over nm in gen_symversions to speed up symbol version generation with CONFIG_GENKSYMS.
  • Update the gen_symversions command pipeline to invoke readelf as the primary tool for reading symbol information.
  • Retain nm as a fallback (if implemented) to preserve compatibility where readelf may not behave as expected.
  • Adjust any related build logic or conditionals in the kbuild scripts to reflect the new tool preference.
scripts/Makefile.build

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Avenger-285714
Copy link
Copy Markdown
Member

it's suggested to try to send it upstream

@Avenger-285714
Copy link
Copy Markdown
Member

/approve

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Avenger-285714

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR changes the export-symbol probe in gen_symversions from nm to readelf -sW to speed up builds when CONFIG_MODVERSIONS is enabled. The check runs once per compiled object that may export symbols, so using the faster readelf reduces overall build time.

Changes:

  • Replace $(NM) $@ with $(READELF) -sW $@ for the __export_symbol_ probe in the gen_symversions helper.
  • Drop the leading space from the grep pattern (since readelf -sW formats output differently than nm).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants