This file was deleted.

54 changes: 0 additions & 54 deletions llvm/test/tools/llvm-dwarfutil/ELF/X86/warning-skipped-macro.test

This file was deleted.

54 changes: 0 additions & 54 deletions llvm/test/tools/llvm-dwarfutil/ELF/X86/warning-skipped-names.test

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,7 @@ bool DwarfLinkerForBinary::link(const DebugMap &Map) {
}

// link debug info for loaded object files.
if (Error E = GeneralLinker.link())
return error(toString(std::move(E)));
GeneralLinker.link();

StringRef ArchName = Map.getTriple().getArchName();
if (Error E = emitRemarks(Options, Map.getBinaryPath(), ArchName, RL))
Expand Down
49 changes: 6 additions & 43 deletions llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "DebugInfoLinker.h"
#include "Error.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/DWARFLinker/DWARFLinker.h"
#include "llvm/DWARFLinker/DWARFStreamer.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
Expand Down Expand Up @@ -211,29 +210,8 @@ class ObjFileAddressMap : public AddressesMap {
const Options &Opts;
};

static bool knownByDWARFUtil(StringRef SecName) {
return llvm::StringSwitch<bool>(SecName)
.Case(".debug_info", true)
.Case(".debug_types", true)
.Case(".debug_abbrev", true)
.Case(".debug_loc", true)
.Case(".debug_loclists", true)
.Case(".debug_frame", true)
.Case(".debug_aranges", true)
.Case(".debug_ranges", true)
.Case(".debug_rnglists", true)
.Case(".debug_line", true)
.Case(".debug_line_str", true)
.Case(".debug_addr", true)
.Case(".debug_macro", true)
.Case(".debug_macinfo", true)
.Case(".debug_str", true)
.Case(".debug_str_offsets", true)
.Default(false);
}

Error linkDebugInfo(object::ObjectFile &File, const Options &Options,
raw_pwrite_stream &OutStream) {
bool linkDebugInfo(object::ObjectFile &File, const Options &Options,
raw_pwrite_stream &OutStream) {

auto ReportWarn = [&](const Twine &Message, StringRef Context,
const DWARFDie *Die) {
Expand All @@ -257,11 +235,8 @@ Error linkDebugInfo(object::ObjectFile &File, const Options &Options,
// Create output streamer.
DwarfStreamer OutStreamer(OutputFileType::Object, OutStream, nullptr,
ReportWarn, ReportWarn);
Triple TargetTriple = File.makeTriple();
if (!OutStreamer.init(TargetTriple, formatv("cannot create a stream for {0}",
TargetTriple.getTriple())
.str()))
return createStringError(std::errc::invalid_argument, "");
if (!OutStreamer.init(File.makeTriple(), ""))
return false;

// Create DWARF linker.
DWARFLinker DebugInfoLinker(&OutStreamer, DwarfLinkerClient::LLD);
Expand All @@ -281,16 +256,6 @@ Error linkDebugInfo(object::ObjectFile &File, const Options &Options,

std::unique_ptr<DWARFContext> Context = DWARFContext::create(File);

// Unknown debug sections would be removed. Display warning
// for such sections.
for (SectionName Sec : Context->getDWARFObj().getSectionNames()) {
if (isDebugSection(Sec.Name) && !knownByDWARFUtil(Sec.Name))
warning(
formatv("'{0}' is not currently supported: section will be skipped",
Sec.Name),
Options.InputFileName);
}

// Add object files to the DWARFLinker.
AddresssMapForLinking[0] =
std::make_unique<ObjFileAddressMap>(*Context, Options, File);
Expand All @@ -303,11 +268,9 @@ Error linkDebugInfo(object::ObjectFile &File, const Options &Options,
DebugInfoLinker.addObjectFile(*ObjectsForLinking[I]);

// Link debug info.
if (Error Err = DebugInfoLinker.link())
return Err;

DebugInfoLinker.link();
OutStreamer.finish();
return Error::success();
return true;
}

} // end of namespace dwarfutil
Expand Down
4 changes: 2 additions & 2 deletions llvm/tools/llvm-dwarfutil/DebugInfoLinker.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ inline bool isDebugSection(StringRef SecName) {
SecName == ".gdb_index";
}

Error linkDebugInfo(object::ObjectFile &file, const Options &Options,
raw_pwrite_stream &OutStream);
bool linkDebugInfo(object::ObjectFile &file, const Options &Options,
raw_pwrite_stream &OutStream);

} // end of namespace dwarfutil
} // end of namespace llvm
Expand Down
14 changes: 8 additions & 6 deletions llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,16 @@ static Error applyCLOptions(const struct Options &Opts, ObjectFile &InputFile) {
DebugInfoBits LinkedDebugInfo;
raw_svector_ostream OutStream(LinkedDebugInfo);

if (Error Err = linkDebugInfo(InputFile, Opts, OutStream))
return Err;
if (linkDebugInfo(InputFile, Opts, OutStream)) {
if (Error Err =
saveLinkedDebugInfo(Opts, InputFile, std::move(LinkedDebugInfo)))
return Err;

if (Error Err =
saveLinkedDebugInfo(Opts, InputFile, std::move(LinkedDebugInfo)))
return Err;
return Error::success();
}

return Error::success();
return createStringError(std::errc::invalid_argument,
"possible broken debug info");
} else if (Opts.BuildSeparateDebugFile) {
if (Error Err = splitDebugIntoSeparateFile(Opts, InputFile))
return Err;
Expand Down