[PATCH] D66539: [ELF][ARM] Simplify some llvm-objdump tests with both ARM/Thumb states
    Fangrui Song via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Aug 21 08:21:48 PDT 2019
    
    
  
MaskRay added a comment.
How can we fix the MCInstrAnalysis problem? Shall we (a) have two MCInstrAnalysis (how) or (b) pass an extra parameter to evaluateBranch?
In tools/llvm-objdump/llvm-objdump.cpp
  if (MIA && (MIA->isCall(Inst) || MIA->isUnconditionalBranch(Inst) ||
              MIA->isConditionalBranch(Inst))) {
    uint64_t Target;
    if (MIA->evaluateBranch(Inst, SectionAddr + Index, Size, Target)) {  // We know the current ARM/Thumb state but MIT is decided by -triple=
For MCSubtargetInfo and MCDisassembler, we can obtain the secondary one with:
  if (isArmElf(Obj) && !STI->checkFeatures("+mclass")) {
    if (STI->checkFeatures("+thumb-mode"))
      Features.AddFeature("-thumb-mode");
    else
      Features.AddFeature("+thumb-mode");
    SecondarySTI.reset(TheTarget->createMCSubtargetInfo(TripleName, MCPU,
                                                        Features.getString()));
    SecondaryDisAsm.reset(TheTarget->createMCDisassembler(*SecondarySTI, Ctx));
  }
  
  std::unique_ptr<const MCInstrAnalysis> MIA(          /////////// fixed
      TheTarget->createMCInstrAnalysis(MII.get()));
Repository:
  rLLD LLVM Linker
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66539/new/
https://reviews.llvm.org/D66539
    
    
More information about the llvm-commits
mailing list