diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4765,7 +4765,8 @@ // Add the split debug info name to the command lines here so we // can propagate it to the backend. bool SplitDWARF = (DwarfFission != DwarfFissionKind::None) && - (TC.getTriple().isOSBinFormatELF() || TC.getTriple().isOSBinFormatWasm()) && + (TC.getTriple().isOSBinFormatELF() || + TC.getTriple().isOSBinFormatWasm()) && (isa(JA) || isa(JA) || isa(JA)); if (SplitDWARF) { diff --git a/llvm/lib/MC/MCAsmBackend.cpp b/llvm/lib/MC/MCAsmBackend.cpp --- a/llvm/lib/MC/MCAsmBackend.cpp +++ b/llvm/lib/MC/MCAsmBackend.cpp @@ -55,16 +55,16 @@ raw_pwrite_stream &DwoOS) const { auto TW = createObjectTargetWriter(); switch (TW->getFormat()) { - case Triple::ELF: - return createELFDwoObjectWriter(cast(std::move(TW)), - OS, DwoOS, Endian == support::little); - case Triple::Wasm: - return createWasmDwoObjectWriter(cast(std::move(TW)), - OS, DwoOS); - default: - report_fatal_error("dwo only supported with ELF"); + case Triple::ELF: + return createELFDwoObjectWriter( + cast(std::move(TW)), OS, DwoOS, + Endian == support::little); + case Triple::Wasm: + return createWasmDwoObjectWriter( + cast(std::move(TW)), OS, DwoOS); + default: + report_fatal_error("dwo only supported with ELF"); } - } Optional MCAsmBackend::getFixupKind(StringRef Name) const { diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -796,8 +796,10 @@ DwarfFrameSection = Ctx->getWasmSection(".debug_frame", SectionKind::getMetadata()); DwarfPubNamesSection = Ctx->getWasmSection(".debug_pubnames", SectionKind::getMetadata()); DwarfPubTypesSection = Ctx->getWasmSection(".debug_pubtypes", SectionKind::getMetadata()); - DwarfGnuPubNamesSection = Ctx->getWasmSection(".debug_gnu_pubnames", SectionKind::getMetadata()); - DwarfGnuPubTypesSection = Ctx->getWasmSection(".debug_gnu_pubtypes", SectionKind::getMetadata()); + DwarfGnuPubNamesSection = + Ctx->getWasmSection(".debug_gnu_pubnames", SectionKind::getMetadata()); + DwarfGnuPubTypesSection = + Ctx->getWasmSection(".debug_gnu_pubtypes", SectionKind::getMetadata()); DwarfDebugNamesSection = Ctx->getWasmSection(".debug_names", SectionKind::getMetadata()); @@ -817,15 +819,15 @@ Ctx->getWasmSection(".debug_types.dwo", SectionKind::getMetadata()); DwarfAbbrevDWOSection = Ctx->getWasmSection(".debug_abbrev.dwo", SectionKind::getMetadata()); - DwarfStrDWOSection = Ctx->getWasmSection( - ".debug_str.dwo", SectionKind::getMetadata()); - //ELF::SHF_MERGE | ELF::SHF_STRINGS | ELF::SHF_EXCLUDE, 1, ""); + DwarfStrDWOSection = + Ctx->getWasmSection(".debug_str.dwo", SectionKind::getMetadata()); + // ELF::SHF_MERGE | ELF::SHF_STRINGS | ELF::SHF_EXCLUDE, 1, ""); DwarfLineDWOSection = Ctx->getWasmSection(".debug_line.dwo", SectionKind::getMetadata()); DwarfLocDWOSection = Ctx->getWasmSection(".debug_loc.dwo", SectionKind::getMetadata()); - DwarfStrOffDWOSection = Ctx->getWasmSection(".debug_str_offsets.dwo", - SectionKind::getMetadata()); + DwarfStrOffDWOSection = + Ctx->getWasmSection(".debug_str_offsets.dwo", SectionKind::getMetadata()); DwarfRnglistsDWOSection = Ctx->getWasmSection(".debug_rnglists.dwo", SectionKind::getMetadata()); DwarfMacinfoDWOSection = @@ -842,7 +844,6 @@ DwarfTUIndexSection = Ctx->getWasmSection(".debug_tu_index", SectionKind::getMetadata(), 0); - // Wasm use data section for LSDA. // TODO Consider putting each function's exception table in a separate // section, as in -function-sections, to facilitate lld's --gc-section. diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -270,8 +270,8 @@ DwoOnly, }; bool IsSplitDwarf = false; - raw_pwrite_stream* OS = nullptr; - raw_pwrite_stream* DwoOS = nullptr; + raw_pwrite_stream *OS = nullptr; + raw_pwrite_stream *DwoOS = nullptr; // TargetObjectWriter wranppers. bool is64Bit() const { return TargetObjectWriter->is64Bit(); } @@ -287,9 +287,8 @@ : TargetObjectWriter(std::move(MOTW)), OS(&OS_) {} WasmObjectWriter(std::unique_ptr MOTW, raw_pwrite_stream &OS_, raw_pwrite_stream &DwoOS_) - : TargetObjectWriter(std::move(MOTW)), - IsSplitDwarf(true), OS(&OS_), DwoOS(&DwoOS_) {} - + : TargetObjectWriter(std::move(MOTW)), IsSplitDwarf(true), OS(&OS_), + DwoOS(&DwoOS_) {} private: void reset() override { @@ -324,8 +323,8 @@ uint64_t writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override; - uint64_t writeOneObject(MCAssembler &Asm, const MCAsmLayout &Layout, DwoMode Mode); - + uint64_t writeOneObject(MCAssembler &Asm, const MCAsmLayout &Layout, + DwoMode Mode); void writeString(const StringRef Str) { encodeULEB128(Str.size(), W->OS); @@ -781,7 +780,7 @@ break; case wasm::WASM_EXTERNAL_MEMORY: encodeULEB128(Import.Memory.Flags, W->OS); - encodeULEB128(NumPages, W->OS); // initial + encodeULEB128(NumPages, W->OS); // initial break; case wasm::WASM_EXTERNAL_TABLE: W->OS << char(Import.Table.ElemType); @@ -961,8 +960,8 @@ encodeULEB128(0, W->OS); // memory index if ((Segment.InitFlags & wasm::WASM_SEGMENT_IS_PASSIVE) == 0) { W->OS << char(Segment.Offset > std::numeric_limits().max() - ? wasm::WASM_OPCODE_I64_CONST - : wasm::WASM_OPCODE_I32_CONST); + ? wasm::WASM_OPCODE_I64_CONST + : wasm::WASM_OPCODE_I32_CONST); encodeSLEB128(Segment.Offset, W->OS); // offset W->OS << char(wasm::WASM_OPCODE_END); } @@ -1771,6 +1770,7 @@ std::unique_ptr llvm::createWasmDwoObjectWriter(std::unique_ptr MOTW, - raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS) { + raw_pwrite_stream &OS, + raw_pwrite_stream &DwoOS) { return std::make_unique(std::move(MOTW), OS); }