diff options
Diffstat (limited to 'lib/MC/MCDwarf.cpp')
-rw-r--r-- | lib/MC/MCDwarf.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp index 90f96e2cef54..4ae2bcfab72b 100644 --- a/lib/MC/MCDwarf.cpp +++ b/lib/MC/MCDwarf.cpp @@ -1461,7 +1461,7 @@ namespace { bool IsSignalFrame; bool IsSimple; }; -} +} // namespace namespace llvm { template <> @@ -1488,7 +1488,7 @@ namespace llvm { LHS.IsSimple == RHS.IsSimple; } }; -} +} // namespace llvm void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB, bool IsEH) { @@ -1590,18 +1590,17 @@ void MCDwarfFrameEmitter::EncodeAdvanceLoc(MCContext &Context, OS << uint8_t(dwarf::DW_CFA_advance_loc1); OS << uint8_t(AddrDelta); } else if (isUInt<16>(AddrDelta)) { - // FIXME: check what is the correct behavior on a big endian machine. OS << uint8_t(dwarf::DW_CFA_advance_loc2); - OS << uint8_t( AddrDelta & 0xff); - OS << uint8_t((AddrDelta >> 8) & 0xff); + if (Context.getAsmInfo()->isLittleEndian()) + support::endian::Writer<support::little>(OS).write<uint16_t>(AddrDelta); + else + support::endian::Writer<support::big>(OS).write<uint16_t>(AddrDelta); } else { - // FIXME: check what is the correct behavior on a big endian machine. assert(isUInt<32>(AddrDelta)); OS << uint8_t(dwarf::DW_CFA_advance_loc4); - OS << uint8_t( AddrDelta & 0xff); - OS << uint8_t((AddrDelta >> 8) & 0xff); - OS << uint8_t((AddrDelta >> 16) & 0xff); - OS << uint8_t((AddrDelta >> 24) & 0xff); - + if (Context.getAsmInfo()->isLittleEndian()) + support::endian::Writer<support::little>(OS).write<uint32_t>(AddrDelta); + else + support::endian::Writer<support::big>(OS).write<uint32_t>(AddrDelta); } } |