//===- bolt/Passes/FixRelaxationPass.cpp ------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "bolt/Passes/FixRelaxationPass.h" #include "bolt/Core/ParallelUtilities.h" usingnamespacellvm; namespace llvm { namespace bolt { // This function finds ADRP+ADD instruction sequences that originally before // linker relaxations were ADRP+LDR. We've modified LDR/ADD relocation properly // during relocation reading, so its targeting right symbol. As for ADRP its // target is wrong before this pass since we won't be able to recognize and // properly change R_AARCH64_ADR_GOT_PAGE relocation to // R_AARCH64_ADR_PREL_PG_HI21 during relocation reading. Now we're searching for // ADRP+ADD sequences, checking that ADRP points to the GOT-table symbol and the // target of ADD is another symbol. When found change ADRP symbol reference to // the ADDs one. void FixRelaxations::runOnFunction(BinaryFunction &BF) { … } Error FixRelaxations::runOnFunctions(BinaryContext &BC) { … } } // namespace bolt } // namespace llvm