Skip to content

Compare the inlined kernel tables by their sites in rk sections-diff - #39

Merged
tamnd merged 1 commit into
mainfrom
sites-by-identity
Oct 3, 2026
Merged

tamnd merged 1 commit into
mainfrom
sites-by-identity

Conversation

@tamnd

@tamnd tamnd commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

__jump_table, __bug_table, __ex_table and .altinstructions get an entry for each copy of the code that writes them. When a function with a static_branch_unlikely is inlined into three callers, the table gets three entries. So their counts follow the inliner the same way __mcount_loc and the objtool site lists do, and plan 9.4 already compares those per function for that reason. Requiring equal counts for these four tables meant matching gcc's inliner call for call in every object, which is not what the check is for.

What the check is for is a dropped site: a lost asm goto, a template whose .pushsection went missing, or a key that never got referenced. This change compares these four tables by the set of distinct sites in each object. A site is whatever the entry holds apart from code addresses:

  • __jump_table: the static key and branch bit, named by the symbol it falls in, since gas writes a reference to a static as section plus offset.
  • __bug_table: the format and file strings by their text, plus line and flags.
  • __ex_table: the fixup type and immediate, with the register bits masked out because they follow register allocation.
  • .altinstructions: the CPU feature and flags.

Sizes and relocation counts are still recorded and saved, so tables that track counts keep working. The other kernel tables are compared exactly as before. Plan 9.4 has the new rule.

Effect on the 7.2.8 defconfig comparison

what before after
all differences 608 267
__jump_table 97 20
__bug_table 251 90
__ex_table 40 0
.altinstructions 63 0

The __jump_table and __bug_table differences left are real. Each one is a key or a WARN_ON that one compiler keeps and the other folds away.

Tests

  • The existing table test now writes real jump entries with keys, and checks that a site gone from one object is reported.
  • A new test checks that three copies of one site against one copy is not a difference.

@tamnd tamnd added kind/feature New capability in the harness area/rk The rk command line row/x64 x86-64 labels Oct 3, 2026
@tamnd
tamnd merged commit ce46ccd into main Oct 3, 2026
3 of 5 checks passed
@tamnd
tamnd deleted the sites-by-identity branch October 3, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/rk The rk command line kind/feature New capability in the harness row/x64 x86-64

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant