[all-commits] [llvm/llvm-project] 3d2404: [BOLT] Skip out-of-range pending relocations (#116...

Paschalis Mpeis via All-commits all-commits at lists.llvm.org
Fri Apr 4 09:31:35 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d24046b3306cbc682aa1f17426169a942d8931a
      https://github.com/llvm/llvm-project/commit/3d24046b3306cbc682aa1f17426169a942d8931a
  Author: Paschalis Mpeis <paschalis.mpeis at arm.com>
  Date:   2025-04-04 (Fri, 04 Apr 2025)

  Changed paths:
    M bolt/include/bolt/Core/Relocation.h
    M bolt/lib/Core/BinaryFunction.cpp
    M bolt/lib/Core/BinarySection.cpp
    M bolt/lib/Core/Relocation.cpp
    M bolt/unittests/Core/BinaryContext.cpp
    M bolt/unittests/Core/CMakeLists.txt

  Log Message:
  -----------
  [BOLT] Skip out-of-range pending relocations (#116964)

When a pending relocation is created it is also marked whether it is
optional or not. It can be optional when such relocation is added as
part of an optimization (i.e., `scanExternalRefs`).

When bolt tries to `flushPendingRelocations`, it safely skips any
optional relocations that cannot be encoded due to being out of
range. A pre-requisite to that is the usage of the `-force-patch`
flag. Alternatrively, BOLT will bail out with a relevant message.

Background:
BOLT, as part of scanExternalRefs, identifies external references from
calls and creates some pending relocations for them. Those when
flushed will update references to point to the optimized functions.
This optimization can be disabled using `--no-scan`.

BOLT can assert if any of these pending relocations cannot be encoded.

This patch does not disable this optimization but instead selectively
applies it given that a pending relocation is optional and `-force-patch`
was enabled.



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