diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def index 8f5159601938..6b7a7412f4d9 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.def +++ b/llvm/include/llvm/BinaryFormat/Dwarf.def @@ -18,8 +18,7 @@ defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \ defined HANDLE_DW_CC || defined HANDLE_DW_LNS || defined HANDLE_DW_LNE || \ defined HANDLE_DW_LNCT || defined HANDLE_DW_MACRO || \ - defined HANDLE_DW_RLE || \ - (defined HANDLE_DW_CFA && defined HANDLE_DW_CFA_PRED) || \ + defined HANDLE_DW_RLE || defined HANDLE_DW_CFA || \ defined HANDLE_DW_APPLE_PROPERTY || defined HANDLE_DW_UT || \ defined HANDLE_DWARF_SECTION || defined HANDLE_DW_IDX || \ defined HANDLE_DW_END) @@ -86,10 +85,6 @@ #define HANDLE_DW_CFA(ID, NAME) #endif -#ifndef HANDLE_DW_CFA_PRED -#define HANDLE_DW_CFA_PRED(ID, NAME, PRED) -#endif - #ifndef HANDLE_DW_APPLE_PROPERTY #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) #endif @@ -836,10 +831,9 @@ HANDLE_DW_CFA(0x14, val_offset) HANDLE_DW_CFA(0x15, val_offset_sf) HANDLE_DW_CFA(0x16, val_expression) // Vendor extensions: -HANDLE_DW_CFA_PRED(0x1d, MIPS_advance_loc8, SELECT_MIPS64) -HANDLE_DW_CFA_PRED(0x2d, GNU_window_save, SELECT_SPARC) -HANDLE_DW_CFA_PRED(0x2d, AARCH64_negate_ra_state, SELECT_AARCH64) -HANDLE_DW_CFA_PRED(0x2e, GNU_args_size, SELECT_X86) +HANDLE_DW_CFA(0x1d, MIPS_advance_loc8) +HANDLE_DW_CFA(0x2d, GNU_window_save) +HANDLE_DW_CFA(0x2e, GNU_args_size) // Apple Objective-C Property Attributes. // Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind! @@ -921,7 +915,6 @@ HANDLE_DW_IDX(0x05, type_hash) #undef HANDLE_DW_MACRO #undef HANDLE_DW_RLE #undef HANDLE_DW_CFA -#undef HANDLE_DW_CFA_PRED #undef HANDLE_DW_APPLE_PROPERTY #undef HANDLE_DW_UT #undef HANDLE_DWARF_SECTION diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h index c25b6cd0966b..330e31cffae6 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.h +++ b/llvm/include/llvm/BinaryFormat/Dwarf.h @@ -26,7 +26,6 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Format.h" #include "llvm/Support/FormatVariadicDetails.h" -#include "llvm/ADT/Triple.h" namespace llvm { class StringRef; @@ -273,7 +272,6 @@ enum RangeListEntries { /// Call frame instruction encodings. enum CallFrameInfo { #define HANDLE_DW_CFA(ID, NAME) DW_CFA_##NAME = ID, -#define HANDLE_DW_CFA_PRED(ID, NAME, ARCH) DW_CFA_##NAME = ID, #include "llvm/BinaryFormat/Dwarf.def" DW_CFA_extended = 0x00, @@ -432,7 +430,7 @@ StringRef LNStandardString(unsigned Standard); StringRef LNExtendedString(unsigned Encoding); StringRef MacinfoString(unsigned Encoding); StringRef RangeListEncodingString(unsigned Encoding); -StringRef CallFrameString(unsigned Encoding, Triple::ArchType Arch); +StringRef CallFrameString(unsigned Encoding); StringRef ApplePropertyString(unsigned); StringRef UnitTypeString(unsigned); StringRef AtomTypeString(unsigned Atom); diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h index b090e2525891..9218e4bd2daa 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h @@ -90,7 +90,6 @@ class DWARFContext : public DIContext { bool CheckedForDWP = false; std::string DWPName; - Triple::ArchType Arch; std::unique_ptr RegInfo; /// Read compile units from the debug_info section (if necessary) @@ -342,7 +341,7 @@ public: /// Loads register info for the architecture of the provided object file. /// Improves readability of dumped DWARF expressions. Requires the caller to /// have initialized the relevant target descriptions. - Error loadArchitectureInfo(const object::ObjectFile &Obj); + Error loadRegisterInfo(const object::ObjectFile &Obj); /// Get address size from CUs. /// TODO: refactor compile_units() to make this const. diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h index 7dc07d774aba..ff1c7fb38389 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h @@ -13,7 +13,6 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/iterator.h" #include "llvm/ADT/SmallString.h" -#include "llvm/ADT/Triple.h" #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h" #include "llvm/DebugInfo/DWARF/DWARFExpression.h" #include "llvm/Support/Error.h" @@ -60,11 +59,9 @@ public: unsigned size() const { return (unsigned)Instructions.size(); } bool empty() const { return Instructions.empty(); } - CFIProgram(uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor, - Triple::ArchType Arch) + CFIProgram(uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor) : CodeAlignmentFactor(CodeAlignmentFactor), - DataAlignmentFactor(DataAlignmentFactor), - Arch(Arch) {} + DataAlignmentFactor(DataAlignmentFactor) {} /// Parse and store a sequence of CFI instructions from Data, /// starting at *Offset and ending at EndOffset. *Offset is updated @@ -79,7 +76,6 @@ private: std::vector Instructions; const uint64_t CodeAlignmentFactor; const int64_t DataAlignmentFactor; - Triple::ArchType Arch; /// Convenience method to add a new instruction with the given opcode. void addInstruction(uint8_t Opcode) { @@ -134,9 +130,8 @@ public: enum FrameKind { FK_CIE, FK_FDE }; FrameEntry(FrameKind K, uint64_t Offset, uint64_t Length, uint64_t CodeAlign, - int64_t DataAlign, Triple::ArchType Arch) - : Kind(K), Offset(Offset), Length(Length), - CFIs(CodeAlign, DataAlign, Arch) {} + int64_t DataAlign) + : Kind(K), Offset(Offset), Length(Length), CFIs(CodeAlign, DataAlign) {} virtual ~FrameEntry() {} @@ -173,9 +168,9 @@ public: int64_t DataAlignmentFactor, uint64_t ReturnAddressRegister, SmallString<8> AugmentationData, uint32_t FDEPointerEncoding, uint32_t LSDAPointerEncoding, Optional Personality, - Optional PersonalityEnc, Triple::ArchType Arch) + Optional PersonalityEnc) : FrameEntry(FK_CIE, Offset, Length, CodeAlignmentFactor, - DataAlignmentFactor, Arch), + DataAlignmentFactor), Version(Version), Augmentation(std::move(Augmentation)), AddressSize(AddressSize), SegmentDescriptorSize(SegmentDescriptorSize), CodeAlignmentFactor(CodeAlignmentFactor), @@ -229,11 +224,10 @@ public: // is obtained lazily once it's actually required. FDE(uint64_t Offset, uint64_t Length, int64_t LinkedCIEOffset, uint64_t InitialLocation, uint64_t AddressRange, CIE *Cie, - Optional LSDAAddress, Triple::ArchType Arch) + Optional LSDAAddress) : FrameEntry(FK_FDE, Offset, Length, Cie ? Cie->getCodeAlignmentFactor() : 0, - Cie ? Cie->getDataAlignmentFactor() : 0, - Arch), + Cie ? Cie->getDataAlignmentFactor() : 0), LinkedCIEOffset(LinkedCIEOffset), InitialLocation(InitialLocation), AddressRange(AddressRange), LinkedCIE(Cie), LSDAAddress(LSDAAddress) {} @@ -262,7 +256,6 @@ private: /// A parsed .debug_frame or .eh_frame section class DWARFDebugFrame { - const Triple::ArchType Arch; // True if this is parsing an eh_frame section. const bool IsEH; // Not zero for sane pointer values coming out of eh_frame @@ -279,8 +272,7 @@ public: // it is a .debug_frame section. EHFrameAddress should be different // than zero for correct parsing of .eh_frame addresses when they // use a PC-relative encoding. - DWARFDebugFrame(Triple::ArchType Arch, - bool IsEH = false, uint64_t EHFrameAddress = 0); + DWARFDebugFrame(bool IsEH = false, uint64_t EHFrameAddress = 0); ~DWARFDebugFrame(); /// Dump the section data into the given stream. diff --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h index aeaa4e55879b..2bfaf19cf2c6 100644 --- a/llvm/include/llvm/MC/MCDwarf.h +++ b/llvm/include/llvm/MC/MCDwarf.h @@ -430,7 +430,6 @@ public: OpUndefined, OpRegister, OpWindowSave, - OpNegateRAState, OpGnuArgsSize }; @@ -510,11 +509,6 @@ public: return MCCFIInstruction(OpWindowSave, L, 0, 0, ""); } - /// .cfi_negate_ra_state AArch64 negate RA state. - static MCCFIInstruction createNegateRAState(MCSymbol *L) { - return MCCFIInstruction(OpNegateRAState, L, 0, 0, ""); - } - /// .cfi_restore says that the rule for Register is now the same as it /// was at the beginning of the function, after all initial instructions added /// by .cfi_startproc were executed. diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h index f7425dfa1213..91fb4e537b4c 100644 --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -891,7 +891,6 @@ public: virtual void EmitCFIUndefined(int64_t Register); virtual void EmitCFIRegister(int64_t Register1, int64_t Register2); virtual void EmitCFIWindowSave(); - virtual void EmitCFINegateRAState(); virtual void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc = SMLoc()); virtual void EmitWinCFIEndProc(SMLoc Loc = SMLoc()); diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp index c28acb94c4b9..5984de73ae63 100644 --- a/llvm/lib/BinaryFormat/Dwarf.cpp +++ b/llvm/lib/BinaryFormat/Dwarf.cpp @@ -13,7 +13,6 @@ #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/ADT/StringSwitch.h" -#include "llvm/ADT/Triple.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -456,31 +455,14 @@ StringRef llvm::dwarf::RangeListEncodingString(unsigned Encoding) { } } -StringRef llvm::dwarf::CallFrameString(unsigned Encoding, - Triple::ArchType Arch) { -#define SELECT_AARCH64 (Arch == llvm::Triple::aarch64_be || Arch == llvm::Triple::aarch64) -#define SELECT_MIPS64 Arch == llvm::Triple::mips64 -#define SELECT_SPARC (Arch == llvm::Triple::sparc || Arch == llvm::Triple::sparcv9) -#define SELECT_X86 (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64) -#define HANDLE_DW_CFA(ID, NAME) -#define HANDLE_DW_CFA_PRED(ID, NAME, PRED) \ - if (ID == Encoding && PRED) \ - return "DW_CFA_" #NAME; -#include "llvm/BinaryFormat/Dwarf.def" - +StringRef llvm::dwarf::CallFrameString(unsigned Encoding) { switch (Encoding) { default: return StringRef(); -#define HANDLE_DW_CFA_PRED(ID, NAME, PRED) #define HANDLE_DW_CFA(ID, NAME) \ case DW_CFA_##NAME: \ return "DW_CFA_" #NAME; #include "llvm/BinaryFormat/Dwarf.def" - -#undef SELECT_X86 -#undef SELECT_SPARC -#undef SELECT_MIPS64 -#undef SELECT_AARCH64 } } diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp index afce3ad3133b..605588470670 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -212,9 +212,6 @@ void AsmPrinter::emitCFIInstruction(const MCCFIInstruction &Inst) const { case MCCFIInstruction::OpWindowSave: OutStreamer->EmitCFIWindowSave(); break; - case MCCFIInstruction::OpNegateRAState: - OutStreamer->EmitCFINegateRAState(); - break; case MCCFIInstruction::OpSameValue: OutStreamer->EmitCFISameValue(Inst.getRegister()); break; diff --git a/llvm/lib/CodeGen/CFIInstrInserter.cpp b/llvm/lib/CodeGen/CFIInstrInserter.cpp index c4799855a2b3..4fd119430cff 100644 --- a/llvm/lib/CodeGen/CFIInstrInserter.cpp +++ b/llvm/lib/CodeGen/CFIInstrInserter.cpp @@ -207,7 +207,6 @@ void CFIInstrInserter::calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo) { case MCCFIInstruction::OpUndefined: case MCCFIInstruction::OpRegister: case MCCFIInstruction::OpWindowSave: - case MCCFIInstruction::OpNegateRAState: case MCCFIInstruction::OpGnuArgsSize: break; } diff --git a/llvm/lib/CodeGen/MIRParser/MILexer.cpp b/llvm/lib/CodeGen/MIRParser/MILexer.cpp index ce061f8e9b80..f7cc94e34a59 100644 --- a/llvm/lib/CodeGen/MIRParser/MILexer.cpp +++ b/llvm/lib/CodeGen/MIRParser/MILexer.cpp @@ -220,7 +220,6 @@ static MIToken::TokenKind getIdentifierKind(StringRef Identifier) { .Case("undefined", MIToken::kw_cfi_undefined) .Case("register", MIToken::kw_cfi_register) .Case("window_save", MIToken::kw_cfi_window_save) - .Case("negate_ra_sign_state", MIToken::kw_cfi_aarch64_negate_ra_sign_state) .Case("blockaddress", MIToken::kw_blockaddress) .Case("intrinsic", MIToken::kw_intrinsic) .Case("target-index", MIToken::kw_target_index) diff --git a/llvm/lib/CodeGen/MIRParser/MILexer.h b/llvm/lib/CodeGen/MIRParser/MILexer.h index 813c539f648d..dffa4f745444 100644 --- a/llvm/lib/CodeGen/MIRParser/MILexer.h +++ b/llvm/lib/CodeGen/MIRParser/MILexer.h @@ -89,7 +89,6 @@ struct MIToken { kw_cfi_restore_state, kw_cfi_undefined, kw_cfi_window_save, - kw_cfi_aarch64_negate_ra_sign_state, kw_blockaddress, kw_intrinsic, kw_target_index, diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 4cdf2b437f54..5c6a41af97ad 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -1816,9 +1816,6 @@ bool MIParser::parseCFIOperand(MachineOperand &Dest) { case MIToken::kw_cfi_window_save: CFIIndex = MF.addFrameInst(MCCFIInstruction::createWindowSave(nullptr)); break; - case MIToken::kw_cfi_aarch64_negate_ra_sign_state: - CFIIndex = MF.addFrameInst(MCCFIInstruction::createNegateRAState(nullptr)); - break; case MIToken::kw_cfi_escape: { std::string Values; if (parseCFIEscapeValues(Values)) @@ -2111,7 +2108,6 @@ bool MIParser::parseMachineOperand(MachineOperand &Dest, case MIToken::kw_cfi_restore_state: case MIToken::kw_cfi_undefined: case MIToken::kw_cfi_window_save: - case MIToken::kw_cfi_aarch64_negate_ra_sign_state: return parseCFIOperand(Dest); case MIToken::kw_blockaddress: return parseBlockAddressOperand(Dest); diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp index 792aa9f0f16d..a116d8fe877d 100644 --- a/llvm/lib/CodeGen/MachineOperand.cpp +++ b/llvm/lib/CodeGen/MachineOperand.cpp @@ -696,11 +696,6 @@ static void printCFI(raw_ostream &OS, const MCCFIInstruction &CFI, if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); break; - case MCCFIInstruction::OpNegateRAState: - OS << "negate_ra_sign_state "; - if (MCSymbol *Label = CFI.getLabel()) - MachineOperand::printSymbol(OS, *Label); - break; default: // TODO: Print the other CFI Operations. OS << ""; diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index 73fb90981abf..a5c31a56fad3 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -724,7 +724,7 @@ const DWARFDebugFrame *DWARFContext::getDebugFrame() { // http://lists.dwarfstd.org/htdig.cgi/dwarf-discuss-dwarfstd.org/2011-December/001173.html DWARFDataExtractor debugFrameData(DObj->getDebugFrameSection(), isLittleEndian(), DObj->getAddressSize()); - DebugFrame.reset(new DWARFDebugFrame(Arch, false /* IsEH */)); + DebugFrame.reset(new DWARFDebugFrame(false /* IsEH */)); DebugFrame->parse(debugFrameData); return DebugFrame.get(); } @@ -735,7 +735,7 @@ const DWARFDebugFrame *DWARFContext::getEHFrame() { DWARFDataExtractor debugFrameData(DObj->getEHFrameSection(), isLittleEndian(), DObj->getAddressSize()); - DebugFrame.reset(new DWARFDebugFrame(Arch, true /* IsEH */)); + DebugFrame.reset(new DWARFDebugFrame(true /* IsEH */)); DebugFrame->parse(debugFrameData); return DebugFrame.get(); } @@ -1581,11 +1581,9 @@ DWARFContext::create(const StringMap> &Sections, return llvm::make_unique(std::move(DObj), ""); } -Error DWARFContext::loadArchitectureInfo(const object::ObjectFile &Obj) { +Error DWARFContext::loadRegisterInfo(const object::ObjectFile &Obj) { // Detect the architecture from the object file. We usually don't need OS // info to lookup a target and create register info. - Arch = Triple::ArchType(Obj.getArch()); - Triple TT; TT.setArch(Triple::ArchType(Obj.getArch())); TT.setVendor(Triple::UnknownVendor); diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp index d85ab6bd8a5e..d725255fe4c5 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp @@ -225,7 +225,7 @@ void CFIProgram::printOperand(raw_ostream &OS, const MCRegisterInfo *MRI, switch (Type) { case OT_Unset: { OS << " Unsupported " << (OperandIdx ? "second" : "first") << " operand to"; - auto OpcodeName = CallFrameString(Opcode, Arch); + auto OpcodeName = CallFrameString(Opcode); if (!OpcodeName.empty()) OS << " " << OpcodeName; else @@ -279,7 +279,7 @@ void CFIProgram::dump(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH, if (Opcode & DWARF_CFI_PRIMARY_OPCODE_MASK) Opcode &= DWARF_CFI_PRIMARY_OPCODE_MASK; OS.indent(2 * IndentLevel); - OS << CallFrameString(Opcode, Arch) << ":"; + OS << CallFrameString(Opcode) << ":"; for (unsigned i = 0; i < Instr.Ops.size(); ++i) printOperand(OS, MRI, IsEH, Instr, i, Instr.Ops[i]); OS << '\n'; @@ -325,9 +325,8 @@ void FDE::dump(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH) const { OS << "\n"; } -DWARFDebugFrame::DWARFDebugFrame(Triple::ArchType Arch, - bool IsEH, uint64_t EHFrameAddress) - : Arch(Arch), IsEH(IsEH), EHFrameAddress(EHFrameAddress) {} +DWARFDebugFrame::DWARFDebugFrame(bool IsEH, uint64_t EHFrameAddress) + : IsEH(IsEH), EHFrameAddress(EHFrameAddress) {} DWARFDebugFrame::~DWARFDebugFrame() = default; @@ -461,7 +460,7 @@ void DWARFDebugFrame::parse(DWARFDataExtractor Data) { StartOffset, Length, Version, AugmentationString, AddressSize, SegmentDescriptorSize, CodeAlignmentFactor, DataAlignmentFactor, ReturnAddressRegister, AugmentationData, FDEPointerEncoding, - LSDAPointerEncoding, Personality, PersonalityEncoding, Arch); + LSDAPointerEncoding, Personality, PersonalityEncoding); CIEs[StartOffset] = Cie.get(); Entries.emplace_back(std::move(Cie)); } else { @@ -513,7 +512,7 @@ void DWARFDebugFrame::parse(DWARFDataExtractor Data) { Entries.emplace_back(new FDE(StartOffset, Length, CIEPointer, InitialLocation, AddressRange, - Cie, LSDAAddress, Arch)); + Cie, LSDAAddress)); } if (Error E = diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index 58c400a71320..c4744ac5d51a 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -285,7 +285,6 @@ public: void EmitCFIUndefined(int64_t Register) override; void EmitCFIRegister(int64_t Register1, int64_t Register2) override; void EmitCFIWindowSave() override; - void EmitCFINegateRAState() override; void EmitCFIReturnColumn(int64_t Register) override; void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc) override; @@ -1565,12 +1564,6 @@ void MCAsmStreamer::EmitCFIWindowSave() { EmitEOL(); } -void MCAsmStreamer::EmitCFINegateRAState() { - MCStreamer::EmitCFINegateRAState(); - OS << "\t.cfi_negate_ra_state"; - EmitEOL(); -} - void MCAsmStreamer::EmitCFIReturnColumn(int64_t Register) { MCStreamer::EmitCFIReturnColumn(Register); OS << "\t.cfi_return_column " << Register; diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index 2899242ee4cf..7093446815f3 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -1332,10 +1332,6 @@ void FrameEmitterImpl::EmitCFIInstruction(const MCCFIInstruction &Instr) { Streamer.EmitIntValue(dwarf::DW_CFA_GNU_window_save, 1); return; - case MCCFIInstruction::OpNegateRAState: - Streamer.EmitIntValue(dwarf::DW_CFA_AARCH64_negate_ra_state, 1); - return; - case MCCFIInstruction::OpUndefined: { unsigned Reg = Instr.getRegister(); Streamer.EmitIntValue(dwarf::DW_CFA_undefined, 1); diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index bb8f3b8ccece..fa0d1f46cbb5 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -565,15 +565,6 @@ void MCStreamer::EmitCFIWindowSave() { CurFrame->Instructions.push_back(Instruction); } -void MCStreamer::EmitCFINegateRAState() { - MCSymbol *Label = EmitCFILabel(); - MCCFIInstruction Instruction = MCCFIInstruction::createNegateRAState(Label); - MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo(); - if (!CurFrame) - return; - CurFrame->Instructions.push_back(Instruction); -} - void MCStreamer::EmitCFIReturnColumn(int64_t Register) { MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo(); if (!CurFrame) diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp index 2e377127302c..f2d7ea9ba3ea 100644 --- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp @@ -622,12 +622,6 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF, if (ShouldSignReturnAddress(MF)) { BuildMI(MBB, MBBI, DL, TII->get(AArch64::PACIASP)) .setMIFlag(MachineInstr::FrameSetup); - - unsigned CFIIndex = - MF.addFrameInst(MCCFIInstruction::createNegateRAState(nullptr)); - BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) - .addCFIIndex(CFIIndex) - .setMIFlags(MachineInstr::FrameSetup); } // All calls are tail calls in GHC calling conv, and functions have no diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index 0f156185387d..8b5db516bad1 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -175,7 +175,6 @@ private: bool parseDirectiveReq(StringRef Name, SMLoc L); bool parseDirectiveUnreq(SMLoc L); - bool parseDirectiveCFINegateRAState(); bool validateInstruction(MCInst &Inst, SMLoc &IDLoc, SmallVectorImpl &Loc); @@ -4926,8 +4925,6 @@ bool AArch64AsmParser::ParseDirective(AsmToken DirectiveID) { parseDirectiveUnreq(Loc); else if (IDVal == ".inst") parseDirectiveInst(Loc); - else if (IDVal == ".cfi_negate_ra_state") - parseDirectiveCFINegateRAState(); else if (IsMachO) { if (IDVal == MCLOHDirectiveName()) parseDirectiveLOH(IDVal, Loc); @@ -5301,13 +5298,6 @@ bool AArch64AsmParser::parseDirectiveUnreq(SMLoc L) { return false; } -bool AArch64AsmParser::parseDirectiveCFINegateRAState() { - if (parseToken(AsmToken::EndOfStatement, "unexpected token in directive")) - return true; - getStreamer().EmitCFINegateRAState(); - return false; -} - bool AArch64AsmParser::classifySymbolRef(const MCExpr *Expr, AArch64MCExpr::VariantKind &ELFRefKind, diff --git a/llvm/test/CodeGen/AArch64/sign-return-address.ll b/llvm/test/CodeGen/AArch64/sign-return-address.ll index 6515dcaf7737..a0c73058a301 100644 --- a/llvm/test/CodeGen/AArch64/sign-return-address.ll +++ b/llvm/test/CodeGen/AArch64/sign-return-address.ll @@ -24,17 +24,17 @@ define i32 @leaf_sign_non_leaf(i32 %x) "sign-return-address"="non-leaf" { ; CHECK-LABEL: @leaf_sign_all ; CHECK: paciasp ; CHECK: autiasp -; CHECK: ret +; CHECK-NEXT: ret define i32 @leaf_sign_all(i32 %x) "sign-return-address"="all" { ret i32 %x } ; CHECK: @leaf_clobbers_lr ; CHECK: paciasp -; CHECK: str x30, [sp, #-16]! +; CHECK-NEXT: str x30, [sp, #-16]! ; CHECK: ldr x30, [sp], #16 ; CHECK-NEXT: autiasp -; CHECK: ret +; CHECK-NEXT: ret define i64 @leaf_clobbers_lr(i64 %x) "sign-return-address"="non-leaf" { call void asm sideeffect "mov x30, $0", "r,~{lr}"(i64 %x) #1 ret i64 %x @@ -45,7 +45,7 @@ declare i32 @foo(i32) ; CHECK: @non_leaf_sign_all ; CHECK: paciasp ; CHECK: autiasp -; CHECK: ret +; CHECK-NEXT: ret define i32 @non_leaf_sign_all(i32 %x) "sign-return-address"="all" { %call = call i32 @foo(i32 %x) ret i32 %call @@ -53,10 +53,10 @@ define i32 @non_leaf_sign_all(i32 %x) "sign-return-address"="all" { ; CHECK: @non_leaf_sign_non_leaf ; CHECK: paciasp -; CHECK: str x30, [sp, #-16]! +; CHECK-NEXT: str x30, [sp, #-16]! ; CHECK: ldr x30, [sp], #16 -; CHECK: autiasp -; CHECK: ret +; CHECK-NEXT: autiasp +; CHECK-NEXT: ret define i32 @non_leaf_sign_non_leaf(i32 %x) "sign-return-address"="non-leaf" { %call = call i32 @foo(i32 %x) ret i32 %call @@ -65,7 +65,7 @@ define i32 @non_leaf_sign_non_leaf(i32 %x) "sign-return-address"="non-leaf" { ; CHECK-LABEL: @leaf_sign_all_v83 ; CHECK: paciasp ; CHECK-NOT: ret -; CHECK: retaa +; CHECK-NEXT: retaa ; CHECK-NOT: ret define i32 @leaf_sign_all_v83(i32 %x) "sign-return-address"="all" "target-features"="+v8.3a" { ret i32 %x @@ -75,10 +75,10 @@ declare fastcc i64 @bar(i64) ; CHECK-LABEL: @spill_lr_and_tail_call ; CHECK: paciasp -; CHECK: str x30, [sp, #-16]! +; CHECK-NEXT: str x30, [sp, #-16]! ; CHECK: ldr x30, [sp], #16 -; CHECK: autiasp -; CHECK: b bar +; CHECK-NEXT: autiasp +; CHECK-NEXT: b bar define fastcc void @spill_lr_and_tail_call(i64 %x) "sign-return-address"="all" { call void asm sideeffect "mov x30, $0", "r,~{lr}"(i64 %x) #1 tail call fastcc i64 @bar(i64 %x) diff --git a/llvm/test/CodeGen/MIR/AArch64/cfi.mir b/llvm/test/CodeGen/MIR/AArch64/cfi.mir index 04380e07f3ee..747d58eb3201 100644 --- a/llvm/test/CodeGen/MIR/AArch64/cfi.mir +++ b/llvm/test/CodeGen/MIR/AArch64/cfi.mir @@ -45,6 +45,4 @@ body: | ; CHECK: CFI_INSTRUCTION escape 0x61, 0x62, 0x63 CFI_INSTRUCTION window_save ; CHECK: CFI_INSTRUCTION window_save - CFI_INSTRUCTION negate_ra_sign_state - ; CHECK: CFI_INSTRUCTION negate_ra_sign_state RET_ReallyLR diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 05557c6682e7..e3fa5c3d7413 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -393,7 +393,7 @@ bool collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx, static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, Twine Filename, raw_ostream &OS) { - logAllUnhandledErrors(DICtx.loadArchitectureInfo(Obj), errs(), + logAllUnhandledErrors(DICtx.loadRegisterInfo(Obj), errs(), Filename.str() + ": "); // The UUID dump already contains all the same information. if (!(DumpType & DIDT_UUID) || DumpType == DIDT_All) diff --git a/llvm/tools/llvm-readobj/DwarfCFIEHPrinter.h b/llvm/tools/llvm-readobj/DwarfCFIEHPrinter.h index d91d764c4d0a..5a1eef1d007d 100644 --- a/llvm/tools/llvm-readobj/DwarfCFIEHPrinter.h +++ b/llvm/tools/llvm-readobj/DwarfCFIEHPrinter.h @@ -16,7 +16,6 @@ #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/Object/ELF.h" #include "llvm/Object/ELFTypes.h" -#include "llvm/Object/ELFObjectFile.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/Debug.h" @@ -32,15 +31,15 @@ namespace DwarfCFIEH { template class PrinterContext { ScopedPrinter &W; - const object::ELFObjectFile *ObjF; + const object::ELFFile *Obj; void printEHFrameHdr(uint64_t Offset, uint64_t Address, uint64_t Size) const; void printEHFrame(const typename ELFT::Shdr *EHFrameShdr) const; public: - PrinterContext(ScopedPrinter &W, const object::ELFObjectFile *ObjF) - : W(W), ObjF(ObjF) {} + PrinterContext(ScopedPrinter &W, const object::ELFFile *Obj) + : W(W), Obj(Obj) {} void printUnwindInformation() const; }; @@ -60,7 +59,6 @@ static const typename ELFO::Elf_Shdr *findSectionByAddress(const ELFO *Obj, template void PrinterContext::printUnwindInformation() const { - const object::ELFFile *Obj = ObjF->getELFFile(); const typename ELFT::Phdr *EHFramePhdr = nullptr; auto PHs = Obj->program_headers(); @@ -103,7 +101,6 @@ void PrinterContext::printEHFrameHdr(uint64_t EHFrameHdrOffset, W.startLine() << format("Offset: 0x%" PRIx64 "\n", EHFrameHdrOffset); W.startLine() << format("Size: 0x%" PRIx64 "\n", EHFrameHdrSize); - const object::ELFFile *Obj = ObjF->getELFFile(); const auto *EHFrameHdrShdr = findSectionByAddress(Obj, EHFrameHdrAddress); if (EHFrameHdrShdr) { auto SectionName = Obj->getSectionName(EHFrameHdrShdr); @@ -176,7 +173,6 @@ void PrinterContext::printEHFrame( ShOffset, Address); W.indent(); - const object::ELFFile *Obj = ObjF->getELFFile(); auto Result = Obj->getSectionContents(EHFrameShdr); if (Error E = Result.takeError()) reportError(toString(std::move(E))); @@ -187,8 +183,7 @@ void PrinterContext::printEHFrame( Contents.size()), ELFT::TargetEndianness == support::endianness::little, ELFT::Is64Bits ? 8 : 4); - DWARFDebugFrame EHFrame(Triple::ArchType(ObjF->getArch()), /*IsEH=*/true, - /*EHFrameAddress=*/Address); + DWARFDebugFrame EHFrame(/*IsEH=*/true, /*EHFrameAddress=*/Address); EHFrame.parse(DE); for (const auto &Entry : EHFrame) { diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp index 96d5b7304a5e..6f71d2d8b6b2 100644 --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -139,7 +139,7 @@ struct DynRegionInfo { template class ELFDumper : public ObjDumper { public: - ELFDumper(const object::ELFObjectFile *ObjF, ScopedPrinter &Writer); + ELFDumper(const ELFFile *Obj, ScopedPrinter &Writer); void printFileHeaders() override; void printSections() override; @@ -181,7 +181,6 @@ private: TYPEDEF_ELF_TYPES(ELFT) DynRegionInfo checkDRI(DynRegionInfo DRI) { - const ELFFile *Obj = ObjF->getELFFile(); if (DRI.Addr < Obj->base() || (const uint8_t *)DRI.Addr + DRI.Size > Obj->base() + Obj->getBufSize()) error(llvm::object::object_error::parse_failed); @@ -189,11 +188,11 @@ private: } DynRegionInfo createDRIFrom(const Elf_Phdr *P, uintX_t EntSize) { - return checkDRI({ObjF->getELFFile()->base() + P->p_offset, P->p_filesz, EntSize}); + return checkDRI({Obj->base() + P->p_offset, P->p_filesz, EntSize}); } DynRegionInfo createDRIFrom(const Elf_Shdr *S) { - return checkDRI({ObjF->getELFFile()->base() + S->sh_offset, S->sh_size, S->sh_entsize}); + return checkDRI({Obj->base() + S->sh_offset, S->sh_size, S->sh_entsize}); } void parseDynamicTable(ArrayRef LoadSegments); @@ -207,7 +206,7 @@ private: void LoadVersionNeeds(const Elf_Shdr *ec) const; void LoadVersionDefs(const Elf_Shdr *sec) const; - const object::ELFObjectFile *ObjF; + const ELFO *Obj; DynRegionInfo DynRelRegion; DynRegionInfo DynRelaRegion; DynRegionInfo DynRelrRegion; @@ -290,7 +289,6 @@ void ELFDumper::printSymbolsHelper(bool IsDynamic) const { StringRef StrTable, SymtabName; size_t Entries = 0; Elf_Sym_Range Syms(nullptr, nullptr); - const ELFFile *Obj = ObjF->getELFFile(); if (IsDynamic) { StrTable = DynamicStringTable; Syms = dynamic_symbols(); @@ -453,7 +451,7 @@ private: namespace llvm { template -static std::error_code createELFDumper(const ELFObjectFile *Obj, +static std::error_code createELFDumper(const ELFFile *Obj, ScopedPrinter &Writer, std::unique_ptr &Result) { Result.reset(new ELFDumper(Obj, Writer)); @@ -465,19 +463,19 @@ std::error_code createELFDumper(const object::ObjectFile *Obj, std::unique_ptr &Result) { // Little-endian 32-bit if (const ELF32LEObjectFile *ELFObj = dyn_cast(Obj)) - return createELFDumper(ELFObj, Writer, Result); + return createELFDumper(ELFObj->getELFFile(), Writer, Result); // Big-endian 32-bit if (const ELF32BEObjectFile *ELFObj = dyn_cast(Obj)) - return createELFDumper(ELFObj, Writer, Result); + return createELFDumper(ELFObj->getELFFile(), Writer, Result); // Little-endian 64-bit if (const ELF64LEObjectFile *ELFObj = dyn_cast(Obj)) - return createELFDumper(ELFObj, Writer, Result); + return createELFDumper(ELFObj->getELFFile(), Writer, Result); // Big-endian 64-bit if (const ELF64BEObjectFile *ELFObj = dyn_cast(Obj)) - return createELFDumper(ELFObj, Writer, Result); + return createELFDumper(ELFObj->getELFFile(), Writer, Result); return readobj_error::unsupported_obj_file_format; } @@ -490,7 +488,7 @@ template void ELFDumper::LoadVersionNeeds(const Elf_Shdr *sec) const { unsigned vn_size = sec->sh_size; // Size of section in bytes unsigned vn_count = sec->sh_info; // Number of Verneed entries - const char *sec_start = (const char *)ObjF->getELFFile()->base() + sec->sh_offset; + const char *sec_start = (const char *)Obj->base() + sec->sh_offset; const char *sec_end = sec_start + vn_size; // The first Verneed entry is at the start of the section. const char *p = sec_start; @@ -524,7 +522,7 @@ template void ELFDumper::LoadVersionDefs(const Elf_Shdr *sec) const { unsigned vd_size = sec->sh_size; // Size of section in bytes unsigned vd_count = sec->sh_info; // Number of Verdef entries - const char *sec_start = (const char *)ObjF->getELFFile()->base() + sec->sh_offset; + const char *sec_start = (const char *)Obj->base() + sec->sh_offset; const char *sec_end = sec_start + vd_size; // The first Verdef entry is at the start of the section. const char *p = sec_start; @@ -702,13 +700,13 @@ static void printVersionDependencySection(ELFDumper *Dumper, template void ELFDumper::printVersionInfo() { // Dump version symbol section. - printVersionSymbolSection(this, ObjF->getELFFile(), dot_gnu_version_sec, W); + printVersionSymbolSection(this, Obj, dot_gnu_version_sec, W); // Dump version definition section. - printVersionDefinitionSection(this, ObjF->getELFFile(), dot_gnu_version_d_sec, W); + printVersionDefinitionSection(this, Obj, dot_gnu_version_d_sec, W); // Dump version dependency section. - printVersionDependencySection(this, ObjF->getELFFile(), dot_gnu_version_r_sec, W); + printVersionDependencySection(this, Obj, dot_gnu_version_r_sec, W); } template @@ -729,7 +727,7 @@ StringRef ELFDumper::getSymbolVersion(StringRef StrTab, // Get the corresponding version index entry const Elf_Versym *vs = unwrapOrError( - ObjF->getELFFile()->template getEntry(dot_gnu_version_sec, entry_index)); + Obj->template getEntry(dot_gnu_version_sec, entry_index)); size_t version_index = vs->vs_index & ELF::VERSYM_VERSION; // Special markers for unversioned symbols. @@ -762,7 +760,6 @@ StringRef ELFDumper::getSymbolVersion(StringRef StrTab, template StringRef ELFDumper::getStaticSymbolName(uint32_t Index) const { - const ELFFile *Obj = ObjF->getELFFile(); StringRef StrTable = unwrapOrError(Obj->getStringTableForSymtab(*DotSymtabSec)); Elf_Sym_Range Syms = unwrapOrError(Obj->symbols(DotSymtabSec)); if (Index >= Syms.size()) @@ -810,7 +807,6 @@ void ELFDumper::getSectionNameIndex(const Elf_Sym *Symbol, if (SectionIndex == SHN_XINDEX) SectionIndex = unwrapOrError(object::getExtendedSymbolTableIndex( Symbol, FirstSym, ShndxTable)); - const ELFFile *Obj = ObjF->getELFFile(); const typename ELFT::Shdr *Sec = unwrapOrError(Obj->getSection(SectionIndex)); SectionName = unwrapOrError(Obj->getSectionName(Sec)); @@ -1379,11 +1375,9 @@ static const char *getElfMipsOptionsOdkType(unsigned Odk) { } template -ELFDumper::ELFDumper(const object::ELFObjectFile *ObjF, - ScopedPrinter &Writer) - : ObjDumper(Writer), ObjF(ObjF) { +ELFDumper::ELFDumper(const ELFFile *Obj, ScopedPrinter &Writer) + : ObjDumper(Writer), Obj(Obj) { SmallVector LoadSegments; - const ELFFile *Obj = ObjF->getELFFile(); for (const Elf_Phdr &Phdr : unwrapOrError(Obj->program_headers())) { if (Phdr.p_type == ELF::PT_DYNAMIC) { DynamicTable = createDRIFrom(&Phdr, sizeof(Elf_Dyn)); @@ -1464,7 +1458,7 @@ void ELFDumper::parseDynamicTable( uint64_t Delta = VAddr - Phdr.p_vaddr; if (Delta >= Phdr.p_filesz) report_fatal_error("Virtual address is not in any segment"); - return ObjF->getELFFile()->base() + Phdr.p_offset + Delta; + return Obj->base() + Phdr.p_offset + Delta; }; uint64_t SONameOffset = 0; @@ -1563,51 +1557,51 @@ typename ELFDumper::Elf_Relr_Range ELFDumper::dyn_relrs() const { template void ELFDumper::printFileHeaders() { - ELFDumperStyle->printFileHeaders(ObjF->getELFFile()); + ELFDumperStyle->printFileHeaders(Obj); } template void ELFDumper::printSections() { - ELFDumperStyle->printSections(ObjF->getELFFile()); + ELFDumperStyle->printSections(Obj); } template void ELFDumper::printRelocations() { - ELFDumperStyle->printRelocations(ObjF->getELFFile()); + ELFDumperStyle->printRelocations(Obj); } template void ELFDumper::printProgramHeaders() { - ELFDumperStyle->printProgramHeaders(ObjF->getELFFile()); + ELFDumperStyle->printProgramHeaders(Obj); } template void ELFDumper::printDynamicRelocations() { - ELFDumperStyle->printDynamicRelocations(ObjF->getELFFile()); + ELFDumperStyle->printDynamicRelocations(Obj); } template void ELFDumper::printSymbols() { - ELFDumperStyle->printSymbols(ObjF->getELFFile()); + ELFDumperStyle->printSymbols(Obj); } template void ELFDumper::printDynamicSymbols() { - ELFDumperStyle->printDynamicSymbols(ObjF->getELFFile()); + ELFDumperStyle->printDynamicSymbols(Obj); } template void ELFDumper::printHashHistogram() { - ELFDumperStyle->printHashHistogram(ObjF->getELFFile()); + ELFDumperStyle->printHashHistogram(Obj); } template void ELFDumper::printCGProfile() { - ELFDumperStyle->printCGProfile(ObjF->getELFFile()); + ELFDumperStyle->printCGProfile(Obj); } template void ELFDumper::printNotes() { - ELFDumperStyle->printNotes(ObjF->getELFFile()); + ELFDumperStyle->printNotes(Obj); } template void ELFDumper::printELFLinkerOptions() { - ELFDumperStyle->printELFLinkerOptions(ObjF->getELFFile()); + ELFDumperStyle->printELFLinkerOptions(Obj); } static const char *getTypeString(unsigned Arch, uint64_t Type) { @@ -1848,9 +1842,9 @@ void ELFDumper::printValue(uint64_t Type, uint64_t Value) { template void ELFDumper::printUnwindInfo() { - const unsigned Machine = ObjF->getELFFile()->getHeader()->e_machine; + const unsigned Machine = Obj->getHeader()->e_machine; if (Machine == EM_386 || Machine == EM_X86_64) { - DwarfCFIEH::PrinterContext Ctx(W, ObjF); + DwarfCFIEH::PrinterContext Ctx(W, Obj); return Ctx.printUnwindInformation(); } W.startLine() << "UnwindInfo not implemented.\n"; @@ -1859,7 +1853,6 @@ void ELFDumper::printUnwindInfo() { namespace { template <> void ELFDumper::printUnwindInfo() { - const ELFFile *Obj = ObjF->getELFFile(); const unsigned Machine = Obj->getHeader()->e_machine; if (Machine == EM_ARM) { ARM::EHABI::PrinterContext Ctx(W, Obj, DotSymtabSec); @@ -1902,7 +1895,7 @@ void ELFDumper::printDynamicTable() { uintX_t Tag = Entry.getTag(); ++I; W.startLine() << " " << format_hex(Tag, Is64 ? 18 : 10, opts::Output != opts::GNU) << " " - << format("%-21s", getTypeString(ObjF->getELFFile()->getHeader()->e_machine, Tag)); + << format("%-21s", getTypeString(Obj->getHeader()->e_machine, Tag)); printValue(Tag, Entry.getVal()); OS << "\n"; } @@ -1969,7 +1962,6 @@ void ELFDumper::printAttributes() { namespace { template <> void ELFDumper::printAttributes() { - const ELFFile *Obj = ObjF->getELFFile(); if (Obj->getHeader()->e_machine != EM_ARM) { W.startLine() << "Attributes not implemented.\n"; return; @@ -2255,7 +2247,6 @@ MipsGOTParser::getPltSym(const Entry *E) const { } template void ELFDumper::printMipsPLTGOT() { - const ELFFile *Obj = ObjF->getELFFile(); if (Obj->getHeader()->e_machine != EM_MIPS) reportError("MIPS PLT GOT is available for MIPS targets only"); @@ -2340,7 +2331,6 @@ static int getMipsRegisterSize(uint8_t Flag) { } template void ELFDumper::printMipsABIFlags() { - const ELFFile *Obj = ObjF->getELFFile(); const Elf_Shdr *Shdr = findSectionByName(*Obj, ".MIPS.abiflags"); if (!Shdr) { W.startLine() << "There is no .MIPS.abiflags section in the file.\n"; @@ -2386,7 +2376,6 @@ static void printMipsReginfoData(ScopedPrinter &W, } template void ELFDumper::printMipsReginfo() { - const ELFFile *Obj = ObjF->getELFFile(); const Elf_Shdr *Shdr = findSectionByName(*Obj, ".reginfo"); if (!Shdr) { W.startLine() << "There is no .reginfo section in the file.\n"; @@ -2404,7 +2393,6 @@ template void ELFDumper::printMipsReginfo() { } template void ELFDumper::printMipsOptions() { - const ELFFile *Obj = ObjF->getELFFile(); const Elf_Shdr *Shdr = findSectionByName(*Obj, ".MIPS.options"); if (!Shdr) { W.startLine() << "There is no .MIPS.options section in the file.\n"; @@ -2434,7 +2422,6 @@ template void ELFDumper::printMipsOptions() { } template void ELFDumper::printStackMap() const { - const ELFFile *Obj = ObjF->getELFFile(); const Elf_Shdr *StackMapSection = nullptr; for (const auto &Sec : unwrapOrError(Obj->sections())) { StringRef Name = unwrapOrError(Obj->getSectionName(&Sec)); @@ -2455,11 +2442,11 @@ template void ELFDumper::printStackMap() const { } template void ELFDumper::printGroupSections() { - ELFDumperStyle->printGroupSections(ObjF->getELFFile()); + ELFDumperStyle->printGroupSections(Obj); } template void ELFDumper::printAddrsig() { - ELFDumperStyle->printAddrsig(ObjF->getELFFile()); + ELFDumperStyle->printAddrsig(Obj); } static inline void printFields(formatted_raw_ostream &OS, StringRef Str1,