[all-commits] [llvm/llvm-project] 17ed8f: [BOLT][AArch64] Handle adrp+ld64 linker relaxations

Vladislav Khmelevsky via All-commits all-commits at lists.llvm.org
Thu Dec 22 13:20:37 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 17ed8f29287b1c0495d25025a28f065c0f53bbc7
      https://github.com/llvm/llvm-project/commit/17ed8f29287b1c0495d25025a28f065c0f53bbc7
  Author: Vladislav Khmelevsky <och95 at yandex.ru>
  Date:   2022-12-23 (Fri, 23 Dec 2022)

  Changed paths:
    M bolt/include/bolt/Core/MCPlusBuilder.h
    M bolt/include/bolt/Core/Relocation.h
    A bolt/include/bolt/Passes/FixRelaxationPass.h
    M bolt/include/bolt/Rewrite/RewriteInstance.h
    M bolt/lib/Core/Relocation.cpp
    M bolt/lib/Passes/CMakeLists.txt
    A bolt/lib/Passes/FixRelaxationPass.cpp
    M bolt/lib/Rewrite/BinaryPassManager.cpp
    M bolt/lib/Rewrite/RewriteInstance.cpp
    M bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
    A bolt/test/AArch64/Inputs/got-ld64-relaxation.yaml
    A bolt/test/AArch64/got-ld64-relaxation.test

  Log Message:
  -----------
  [BOLT][AArch64] Handle adrp+ld64 linker relaxations

Linker might relax adrp + ldr got address loading to adrp + add for
local non-preemptible symbols (e.g. hidden/protected symbols in
executable). As usually linker doesn't change relocations properly after
relaxation, so we have to handle such cases by ourselves. To do that
during relocations reading we change LD64 reloc to ADD if instruction
mismatch found and introduce FixRelaxationPass that searches for ADRP+ADD
pairs and after performing some checks we're replacing ADRP target symbol
to already fixed ADDs one.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Differential Revision: https://reviews.llvm.org/D138097




More information about the All-commits mailing list