LCOV - code coverage report
Current view: top level - lib/Target/ARM/MCTargetDesc - ARMMachObjectWriter.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 180 203 88.7 %
Date: 2017-09-14 15:23:50 Functions: 7 8 87.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- ARMMachObjectWriter.cpp - ARM Mach Object Writer ------------------===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : 
      10             : #include "MCTargetDesc/ARMBaseInfo.h"
      11             : #include "MCTargetDesc/ARMFixupKinds.h"
      12             : #include "MCTargetDesc/ARMMCTargetDesc.h"
      13             : #include "llvm/ADT/Twine.h"
      14             : #include "llvm/BinaryFormat/MachO.h"
      15             : #include "llvm/MC/MCAsmLayout.h"
      16             : #include "llvm/MC/MCAssembler.h"
      17             : #include "llvm/MC/MCContext.h"
      18             : #include "llvm/MC/MCExpr.h"
      19             : #include "llvm/MC/MCFixup.h"
      20             : #include "llvm/MC/MCFixupKindInfo.h"
      21             : #include "llvm/MC/MCMachObjectWriter.h"
      22             : #include "llvm/MC/MCSection.h"
      23             : #include "llvm/MC/MCValue.h"
      24             : #include "llvm/Support/ErrorHandling.h"
      25             : using namespace llvm;
      26             : 
      27             : namespace {
      28         112 : class ARMMachObjectWriter : public MCMachObjectTargetWriter {
      29             :   void RecordARMScatteredRelocation(MachObjectWriter *Writer,
      30             :                                     const MCAssembler &Asm,
      31             :                                     const MCAsmLayout &Layout,
      32             :                                     const MCFragment *Fragment,
      33             :                                     const MCFixup &Fixup,
      34             :                                     MCValue Target,
      35             :                                     unsigned Type,
      36             :                                     unsigned Log2Size,
      37             :                                     uint64_t &FixedValue);
      38             :   void RecordARMScatteredHalfRelocation(MachObjectWriter *Writer,
      39             :                                         const MCAssembler &Asm,
      40             :                                         const MCAsmLayout &Layout,
      41             :                                         const MCFragment *Fragment,
      42             :                                         const MCFixup &Fixup, MCValue Target,
      43             :                                         uint64_t &FixedValue);
      44             : 
      45             :   bool requiresExternRelocation(MachObjectWriter *Writer,
      46             :                                 const MCAssembler &Asm,
      47             :                                 const MCFragment &Fragment, unsigned RelocType,
      48             :                                 const MCSymbol &S, uint64_t FixedValue);
      49             : 
      50             : public:
      51             :   ARMMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
      52         112 :       : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
      53             : 
      54             :   void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
      55             :                         const MCAsmLayout &Layout, const MCFragment *Fragment,
      56             :                         const MCFixup &Fixup, MCValue Target,
      57             :                         uint64_t &FixedValue) override;
      58             : };
      59             : }
      60             : 
      61        1358 : static bool getARMFixupKindMachOInfo(unsigned Kind, unsigned &RelocType,
      62             :                               unsigned &Log2Size) {
      63        1358 :   RelocType = unsigned(MachO::ARM_RELOC_VANILLA);
      64        1358 :   Log2Size = ~0U;
      65             : 
      66        1358 :   switch (Kind) {
      67             :   default:
      68             :     return false;
      69             : 
      70           0 :   case FK_Data_1:
      71           0 :     Log2Size = llvm::Log2_32(1);
      72           0 :     return true;
      73           0 :   case FK_Data_2:
      74           0 :     Log2Size = llvm::Log2_32(2);
      75           0 :     return true;
      76         107 :   case FK_Data_4:
      77         107 :     Log2Size = llvm::Log2_32(4);
      78         107 :     return true;
      79           0 :   case FK_Data_8:
      80           0 :     Log2Size = llvm::Log2_32(8);
      81           0 :     return true;
      82             : 
      83             :     // These fixups are expected to always be resolvable at assembly time and
      84             :     // have no relocations supported.
      85             :   case ARM::fixup_arm_ldst_pcrel_12:
      86             :   case ARM::fixup_arm_pcrel_10:
      87             :   case ARM::fixup_arm_adr_pcrel_12:
      88             :   case ARM::fixup_arm_thumb_br:
      89             :     return false;
      90             : 
      91             :     // Handle 24-bit branch kinds.
      92         566 :   case ARM::fixup_arm_condbranch:
      93             :   case ARM::fixup_arm_uncondbranch:
      94             :   case ARM::fixup_arm_uncondbl:
      95             :   case ARM::fixup_arm_condbl:
      96             :   case ARM::fixup_arm_blx:
      97         566 :     RelocType = unsigned(MachO::ARM_RELOC_BR24);
      98             :     // Report as 'long', even though that is not quite accurate.
      99         566 :     Log2Size = llvm::Log2_32(4);
     100         566 :     return true;
     101             : 
     102         598 :   case ARM::fixup_t2_uncondbranch:
     103             :   case ARM::fixup_arm_thumb_bl:
     104             :   case ARM::fixup_arm_thumb_blx:
     105         598 :     RelocType = unsigned(MachO::ARM_THUMB_RELOC_BR22);
     106         598 :     Log2Size = llvm::Log2_32(4);
     107         598 :     return true;
     108             : 
     109             :   // For movw/movt r_type relocations they always have a pair following them and
     110             :   // the r_length bits are used differently.  The encoding of the r_length is as
     111             :   // follows:
     112             :   //   low bit of r_length:
     113             :   //      0 - :lower16: for movw instructions
     114             :   //      1 - :upper16: for movt instructions
     115             :   //   high bit of r_length:
     116             :   //      0 - arm instructions
     117             :   //      1 - thumb instructions
     118           8 :   case ARM::fixup_arm_movt_hi16:
     119           8 :     RelocType = unsigned(MachO::ARM_RELOC_HALF);
     120           8 :     Log2Size = 1;
     121           8 :     return true;
     122          32 :   case ARM::fixup_t2_movt_hi16:
     123          32 :     RelocType = unsigned(MachO::ARM_RELOC_HALF);
     124          32 :     Log2Size = 3;
     125          32 :     return true;
     126             : 
     127           8 :   case ARM::fixup_arm_movw_lo16:
     128           8 :     RelocType = unsigned(MachO::ARM_RELOC_HALF);
     129           8 :     Log2Size = 0;
     130           8 :     return true;
     131          31 :   case ARM::fixup_t2_movw_lo16:
     132          31 :     RelocType = unsigned(MachO::ARM_RELOC_HALF);
     133          31 :     Log2Size = 2;
     134          31 :     return true;
     135             :   }
     136             : }
     137             : 
     138          61 : void ARMMachObjectWriter::
     139             : RecordARMScatteredHalfRelocation(MachObjectWriter *Writer,
     140             :                                  const MCAssembler &Asm,
     141             :                                  const MCAsmLayout &Layout,
     142             :                                  const MCFragment *Fragment,
     143             :                                  const MCFixup &Fixup,
     144             :                                  MCValue Target,
     145             :                                  uint64_t &FixedValue) {
     146          61 :   uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset();
     147          61 :   unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
     148          61 :   unsigned Type = MachO::ARM_RELOC_HALF;
     149             : 
     150             :   // See <reloc.h>.
     151          61 :   const MCSymbol *A = &Target.getSymA()->getSymbol();
     152             : 
     153          61 :   if (!A->getFragment()) {
     154           0 :     Asm.getContext().reportError(Fixup.getLoc(),
     155           0 :                        "symbol '" + A->getName() +
     156           0 :                        "' can not be undefined in a subtraction expression");
     157           0 :     return;
     158             :   }
     159             : 
     160          61 :   uint32_t Value = Writer->getSymbolAddress(*A, Layout);
     161          61 :   uint32_t Value2 = 0;
     162         122 :   uint64_t SecAddr = Writer->getSectionAddress(A->getFragment()->getParent());
     163          61 :   FixedValue += SecAddr;
     164             : 
     165          61 :   if (const MCSymbolRefExpr *B = Target.getSymB()) {
     166          61 :     const MCSymbol *SB = &B->getSymbol();
     167             : 
     168          61 :     if (!SB->getFragment()) {
     169           0 :       Asm.getContext().reportError(Fixup.getLoc(),
     170           0 :                          "symbol '" + B->getSymbol().getName() +
     171           0 :                          "' can not be undefined in a subtraction expression");
     172             :       return;
     173             :     }
     174             : 
     175             :     // Select the appropriate difference relocation type.
     176          61 :     Type = MachO::ARM_RELOC_HALF_SECTDIFF;
     177          61 :     Value2 = Writer->getSymbolAddress(B->getSymbol(), Layout);
     178         122 :     FixedValue -= Writer->getSectionAddress(SB->getFragment()->getParent());
     179             :   }
     180             : 
     181             :   // Relocations are written out in reverse order, so the PAIR comes first.
     182             :   // ARM_RELOC_HALF and ARM_RELOC_HALF_SECTDIFF abuse the r_length field:
     183             :   //
     184             :   // For these two r_type relocations they always have a pair following them and
     185             :   // the r_length bits are used differently.  The encoding of the r_length is as
     186             :   // follows:
     187             :   //   low bit of r_length:
     188             :   //      0 - :lower16: for movw instructions
     189             :   //      1 - :upper16: for movt instructions
     190             :   //   high bit of r_length:
     191             :   //      0 - arm instructions
     192             :   //      1 - thumb instructions
     193             :   // the other half of the relocated expression is in the following pair
     194             :   // relocation entry in the low 16 bits of r_address field.
     195          61 :   unsigned ThumbBit = 0;
     196          61 :   unsigned MovtBit = 0;
     197          61 :   switch ((unsigned)Fixup.getKind()) {
     198             :   default: break;
     199           5 :   case ARM::fixup_arm_movt_hi16:
     200           5 :     MovtBit = 1;
     201             :     // The thumb bit shouldn't be set in the 'other-half' bit of the
     202             :     // relocation, but it will be set in FixedValue if the base symbol
     203             :     // is a thumb function. Clear it out here.
     204           5 :     if (Asm.isThumbFunc(A))
     205           0 :       FixedValue &= 0xfffffffe;
     206             :     break;
     207          26 :   case ARM::fixup_t2_movt_hi16:
     208          26 :     if (Asm.isThumbFunc(A))
     209           1 :       FixedValue &= 0xfffffffe;
     210             :     MovtBit = 1;
     211             :     LLVM_FALLTHROUGH;
     212             :   case ARM::fixup_t2_movw_lo16:
     213             :     ThumbBit = 1;
     214             :     break;
     215             :   }
     216             : 
     217          61 :   if (Type == MachO::ARM_RELOC_HALF_SECTDIFF) {
     218         122 :     uint32_t OtherHalf = MovtBit
     219          61 :       ? (FixedValue & 0xffff) : ((FixedValue & 0xffff0000) >> 16);
     220             : 
     221             :     MachO::any_relocation_info MRE;
     222          61 :     MRE.r_word0 = ((OtherHalf             <<  0) |
     223          61 :                    (MachO::ARM_RELOC_PAIR << 24) |
     224         122 :                    (MovtBit               << 28) |
     225         122 :                    (ThumbBit              << 29) |
     226         122 :                    (IsPCRel               << 30) |
     227             :                    MachO::R_SCATTERED);
     228          61 :     MRE.r_word1 = Value2;
     229          61 :     Writer->addRelocation(nullptr, Fragment->getParent(), MRE);
     230             :   }
     231             : 
     232             :   MachO::any_relocation_info MRE;
     233         122 :   MRE.r_word0 = ((FixupOffset <<  0) |
     234         122 :                  (Type        << 24) |
     235         122 :                  (MovtBit     << 28) |
     236         122 :                  (ThumbBit    << 29) |
     237         122 :                  (IsPCRel     << 30) |
     238             :                  MachO::R_SCATTERED);
     239          61 :   MRE.r_word1 = Value;
     240          61 :   Writer->addRelocation(nullptr, Fragment->getParent(), MRE);
     241             : }
     242             : 
     243          29 : void ARMMachObjectWriter::RecordARMScatteredRelocation(MachObjectWriter *Writer,
     244             :                                                     const MCAssembler &Asm,
     245             :                                                     const MCAsmLayout &Layout,
     246             :                                                     const MCFragment *Fragment,
     247             :                                                     const MCFixup &Fixup,
     248             :                                                     MCValue Target,
     249             :                                                     unsigned Type,
     250             :                                                     unsigned Log2Size,
     251             :                                                     uint64_t &FixedValue) {
     252          29 :   uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset();
     253          29 :   unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
     254             : 
     255             :   // See <reloc.h>.
     256          29 :   const MCSymbol *A = &Target.getSymA()->getSymbol();
     257             : 
     258          29 :   if (!A->getFragment()) {
     259           2 :     Asm.getContext().reportError(Fixup.getLoc(),
     260           4 :                        "symbol '" + A->getName() +
     261           2 :                        "' can not be undefined in a subtraction expression");
     262           2 :     return;
     263             :   }
     264             : 
     265          28 :   uint32_t Value = Writer->getSymbolAddress(*A, Layout);
     266          56 :   uint64_t SecAddr = Writer->getSectionAddress(A->getFragment()->getParent());
     267          28 :   FixedValue += SecAddr;
     268          28 :   uint32_t Value2 = 0;
     269             : 
     270          28 :   if (const MCSymbolRefExpr *B = Target.getSymB()) {
     271             :     assert(Type == MachO::ARM_RELOC_VANILLA && "invalid reloc for 2 symbols");
     272          21 :     const MCSymbol *SB = &B->getSymbol();
     273             : 
     274          21 :     if (!SB->getFragment()) {
     275           2 :       Asm.getContext().reportError(Fixup.getLoc(),
     276           5 :                          "symbol '" + B->getSymbol().getName() +
     277           2 :                          "' can not be undefined in a subtraction expression");
     278             :       return;
     279             :     }
     280             : 
     281             :     // Select the appropriate difference relocation type.
     282          20 :     Type = MachO::ARM_RELOC_SECTDIFF;
     283          20 :     Value2 = Writer->getSymbolAddress(B->getSymbol(), Layout);
     284          40 :     FixedValue -= Writer->getSectionAddress(SB->getFragment()->getParent());
     285             :   }
     286             : 
     287             :   // Relocations are written out in reverse order, so the PAIR comes first.
     288          27 :   if (Type == MachO::ARM_RELOC_SECTDIFF ||
     289             :       Type == MachO::ARM_RELOC_LOCAL_SECTDIFF) {
     290             :     MachO::any_relocation_info MRE;
     291          20 :     MRE.r_word0 = ((0                     <<  0) |
     292             :                    (MachO::ARM_RELOC_PAIR << 24) |
     293          40 :                    (Log2Size              << 28) |
     294          40 :                    (IsPCRel               << 30) |
     295             :                    MachO::R_SCATTERED);
     296          20 :     MRE.r_word1 = Value2;
     297          20 :     Writer->addRelocation(nullptr, Fragment->getParent(), MRE);
     298             :   }
     299             : 
     300             :   MachO::any_relocation_info MRE;
     301          54 :   MRE.r_word0 = ((FixupOffset <<  0) |
     302          54 :                  (Type        << 24) |
     303          54 :                  (Log2Size    << 28) |
     304          54 :                  (IsPCRel     << 30) |
     305             :                  MachO::R_SCATTERED);
     306          27 :   MRE.r_word1 = Value;
     307          27 :   Writer->addRelocation(nullptr, Fragment->getParent(), MRE);
     308             : }
     309             : 
     310        1260 : bool ARMMachObjectWriter::requiresExternRelocation(MachObjectWriter *Writer,
     311             :                                                    const MCAssembler &Asm,
     312             :                                                    const MCFragment &Fragment,
     313             :                                                    unsigned RelocType,
     314             :                                                    const MCSymbol &S,
     315             :                                                    uint64_t FixedValue) {
     316             :   // Most cases can be identified purely from the symbol.
     317        1260 :   if (Writer->doesSymbolRequireExternRelocation(S))
     318             :     return true;
     319         110 :   int64_t Value = (int64_t)FixedValue;  // The displacement is signed.
     320             :   int64_t Range;
     321         110 :   switch (RelocType) {
     322             :   default:
     323             :     return false;
     324           9 :   case MachO::ARM_RELOC_BR24:
     325             :     // An ARM call might be to a Thumb function, in which case the offset may
     326             :     // not be encodable in the instruction and we must use an external
     327             :     // relocation that explicitly mentions the function. Not a problem if it's
     328             :     // to a temporary "Lwhatever" symbol though, and in fact trying to use an
     329             :     // external relocation there causes more issues.
     330           9 :     if (!S.isTemporary())
     331             :        return true;
     332             : 
     333             :     // PC pre-adjustment of 8 for these instructions.
     334           1 :     Value -= 8;
     335             :     // ARM BL/BLX has a 25-bit offset.
     336           1 :     Range = 0x1ffffff;
     337             :     break;
     338          19 :   case MachO::ARM_THUMB_RELOC_BR22:
     339             :     // PC pre-adjustment of 4 for these instructions.
     340          19 :     Value -= 4;
     341             :     // Thumb BL/BLX has a 24-bit offset.
     342          19 :     Range = 0xffffff;
     343             :   }
     344             :   // BL/BLX also use external relocations when an internal relocation
     345             :   // would result in the target being out of range. This gives the linker
     346             :   // enough information to generate a branch island.
     347          40 :   Value += Writer->getSectionAddress(&S.getSection());
     348          40 :   Value -= Writer->getSectionAddress(Fragment.getParent());
     349             :   // If the resultant value would be out of range for an internal relocation,
     350             :   // use an external instead.
     351          20 :   if (Value > Range || Value < -(Range + 1))
     352             :     return true;
     353             :   return false;
     354             : }
     355             : 
     356        1358 : void ARMMachObjectWriter::recordRelocation(MachObjectWriter *Writer,
     357             :                                            MCAssembler &Asm,
     358             :                                            const MCAsmLayout &Layout,
     359             :                                            const MCFragment *Fragment,
     360             :                                            const MCFixup &Fixup, MCValue Target,
     361             :                                            uint64_t &FixedValue) {
     362        1358 :   unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
     363             :   unsigned Log2Size;
     364        1358 :   unsigned RelocType = MachO::ARM_RELOC_VANILLA;
     365        1358 :   if (!getARMFixupKindMachOInfo(Fixup.getKind(), RelocType, Log2Size)) {
     366             :     // If we failed to get fixup kind info, it's because there's no legal
     367             :     // relocation type for the fixup kind. This happens when it's a fixup that's
     368             :     // expected to always be resolvable at assembly time and not have any
     369             :     // relocations needed.
     370          16 :     Asm.getContext().reportError(Fixup.getLoc(),
     371             :                                  "unsupported relocation on symbol");
     372         106 :     return;
     373             :   }
     374             : 
     375             :   // If this is a difference or a defined symbol plus an offset, then we need a
     376             :   // scattered relocation entry.  Differences always require scattered
     377             :   // relocations.
     378        1350 :   if (Target.getSymB()) {
     379          83 :     if (RelocType == MachO::ARM_RELOC_HALF)
     380          61 :       return RecordARMScatteredHalfRelocation(Writer, Asm, Layout, Fragment,
     381          61 :                                               Fixup, Target, FixedValue);
     382          22 :     return RecordARMScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup,
     383             :                                         Target, RelocType, Log2Size,
     384          22 :                                         FixedValue);
     385             :   }
     386             : 
     387             :   // Get the symbol data, if any.
     388        1267 :   const MCSymbol *A = nullptr;
     389        1267 :   if (Target.getSymA())
     390        1267 :     A = &Target.getSymA()->getSymbol();
     391             : 
     392             :   // FIXME: For other platforms, we need to use scattered relocations for
     393             :   // internal relocations with offsets.  If this is an internal relocation with
     394             :   // an offset, it also needs a scattered relocation entry.
     395             :   //
     396             :   // Is this right for ARM?
     397        1267 :   uint32_t Offset = Target.getConstant();
     398        1267 :   if (IsPCRel && RelocType == MachO::ARM_RELOC_VANILLA)
     399           0 :     Offset += 1 << Log2Size;
     400        1274 :   if (Offset && A && !Writer->doesSymbolRequireExternRelocation(*A) &&
     401           7 :       RelocType != MachO::ARM_RELOC_HALF)
     402           7 :     return RecordARMScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup,
     403             :                                         Target, RelocType, Log2Size,
     404           7 :                                         FixedValue);
     405             : 
     406             :   // See <reloc.h>.
     407        1260 :   uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset();
     408        1260 :   unsigned Index = 0;
     409        1260 :   unsigned Type = 0;
     410        1260 :   const MCSymbol *RelSymbol = nullptr;
     411             : 
     412        1260 :   if (Target.isAbsolute()) { // constant
     413             :     // FIXME!
     414           0 :     report_fatal_error("FIXME: relocations to absolute targets "
     415             :                        "not yet implemented");
     416             :   } else {
     417             :     // Resolve constant variables.
     418        1260 :     if (A->isVariable()) {
     419             :       int64_t Res;
     420           0 :       if (A->getVariableValue()->evaluateAsAbsolute(
     421           0 :               Res, Layout, Writer->getSectionAddressMap())) {
     422           0 :         FixedValue = Res;
     423           0 :         return;
     424             :       }
     425             :     }
     426             : 
     427             :     // Check whether we need an external or internal relocation.
     428        1260 :     if (requiresExternRelocation(Writer, Asm, *Fragment, RelocType, *A,
     429             :                                  FixedValue)) {
     430        1159 :       RelSymbol = A;
     431             : 
     432             :       // For external relocations, make sure to offset the fixup value to
     433             :       // compensate for the addend of the symbol address, if it was
     434             :       // undefined. This occurs with weak definitions, for example.
     435        1159 :       if (!A->isUndefined())
     436           9 :         FixedValue -= Layout.getSymbolOffset(*A);
     437             :     } else {
     438             :       // The index is the section ordinal (1-based).
     439         101 :       const MCSection &Sec = A->getSection();
     440         101 :       Index = Sec.getOrdinal() + 1;
     441         101 :       FixedValue += Writer->getSectionAddress(&Sec);
     442             :     }
     443        1260 :     if (IsPCRel)
     444        2316 :       FixedValue -= Writer->getSectionAddress(Fragment->getParent());
     445             : 
     446             :     // The type is determined by the fixup kind.
     447        1260 :     Type = RelocType;
     448             :   }
     449             : 
     450             :   // struct relocation_info (8 bytes)
     451             :   MachO::any_relocation_info MRE;
     452        1260 :   MRE.r_word0 = FixupOffset;
     453        1260 :   MRE.r_word1 =
     454        1260 :       (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
     455             : 
     456             :   // Even when it's not a scattered relocation, movw/movt always uses
     457             :   // a PAIR relocation.
     458        1260 :   if (Type == MachO::ARM_RELOC_HALF) {
     459             :     // The entire addend is needed to correctly apply a relocation. One half is
     460             :     // extracted from the instruction itself, the other comes from this
     461             :     // PAIR. I.e. it's correct that we insert the high bits of the addend in the
     462             :     // MOVW case here.  relocation entries.
     463          18 :     uint32_t Value = 0;
     464          18 :     switch ((unsigned)Fixup.getKind()) {
     465             :     default: break;
     466           9 :     case ARM::fixup_arm_movw_lo16:
     467             :     case ARM::fixup_t2_movw_lo16:
     468           9 :       Value = (FixedValue >> 16) & 0xffff;
     469           9 :       break;
     470           9 :     case ARM::fixup_arm_movt_hi16:
     471             :     case ARM::fixup_t2_movt_hi16:
     472           9 :       Value = FixedValue & 0xffff;
     473           9 :       break;
     474             :     }
     475             :     MachO::any_relocation_info MREPair;
     476          18 :     MREPair.r_word0 = Value;
     477          18 :     MREPair.r_word1 = ((0xffffff              <<  0) |
     478          18 :                        (Log2Size              << 25) |
     479             :                        (MachO::ARM_RELOC_PAIR << 28));
     480             : 
     481          18 :     Writer->addRelocation(nullptr, Fragment->getParent(), MREPair);
     482             :   }
     483             : 
     484        1260 :   Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);
     485             : }
     486             : 
     487         112 : MCObjectWriter *llvm::createARMMachObjectWriter(raw_pwrite_stream &OS,
     488             :                                                 bool Is64Bit, uint32_t CPUType,
     489             :                                                 uint32_t CPUSubtype) {
     490             :   return createMachObjectWriter(new ARMMachObjectWriter(Is64Bit,
     491             :                                                         CPUType,
     492         224 :                                                         CPUSubtype),
     493         112 :                                 OS, /*IsLittleEndian=*/true);
     494             : }

Generated by: LCOV version 1.13