[all-commits] [llvm/llvm-project] 945b8f: [BOLT][BTI] Patch ignored functions in place when ...

Gergely Bálint via All-commits all-commits at lists.llvm.org
Tue Feb 10 05:35:08 PST 2026


  Branch: refs/heads/users/bgergely0/bolt-bti-patch-no-cfg
  Home:   https://github.com/llvm/llvm-project
  Commit: 945b8fa1b5dee0ee1ba2fa58084ce885da8d7feb
      https://github.com/llvm/llvm-project/commit/945b8fa1b5dee0ee1ba2fa58084ce885da8d7feb
  Author: Gergely Balint <gergely.balint at arm.com>
  Date:   2026-02-10 (Tue, 10 Feb 2026)

  Changed paths:
    M bolt/include/bolt/Core/MCPlusBuilder.h
    M bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
    M bolt/test/AArch64/bti-long-jmp-ignored.s
    A bolt/test/AArch64/long-jmp-bti-ignored-nop.s

  Log Message:
  -----------
  [BOLT][BTI] Patch ignored functions in place when targeting them with
indirect branches

When applying BTI fixups to indirect branch targets, ignored functions are
considered a special case:
- these hold no instructions,
- have no CFG,
- and are not emitted in the new text section.

The solution is to patch the entry points in the original location.

If such a situation occurs in a binary, recompilation using the
-fpatchable-function-entry flag is required. This will place a nop at all
function starts, which BOLT can use to patch the original section.

Without the extra nop, BOLT cannot safely patch the original .text section.

An alternative solution could be to also ignore the function from which
the stub starts. This has not been tried as LongJmp pass - where most
stubs are inserted - is currently not equipped to ignore functions.

Testing: both the success and failure cases are covered with lit tests.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list