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

Gergely Bálint via All-commits all-commits at lists.llvm.org
Thu Feb 12 03:48:01 PST 2026


  Branch: refs/heads/users/bgergely0/bolt-bti-patch-no-cfg
  Home:   https://github.com/llvm/llvm-project
  Commit: abc48e0bd4adc1b17442113ade50956a1f65ddd3
      https://github.com/llvm/llvm-project/commit/abc48e0bd4adc1b17442113ade50956a1f65ddd3
  Author: Gergely Balint <gergely.balint at arm.com>
  Date:   2026-02-12 (Thu, 12 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