1 //===-- llvm-dwarfdump.cpp - Debug info dumping utility for llvm ----------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This program is a utility that works like "dwarfdump".
11 //===----------------------------------------------------------------------===//
13 #include "llvm-dwarfdump.h"
14 #include "llvm/ADT/STLExtras.h"
15 #include "llvm/ADT/StringSet.h"
16 #include "llvm/ADT/Triple.h"
17 #include "llvm/DebugInfo/DIContext.h"
18 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
19 #include "llvm/Object/Archive.h"
20 #include "llvm/Object/MachOUniversal.h"
21 #include "llvm/Object/ObjectFile.h"
22 #include "llvm/Support/CommandLine.h"
23 #include "llvm/Support/Debug.h"
24 #include "llvm/Support/Format.h"
25 #include "llvm/Support/InitLLVM.h"
26 #include "llvm/Support/MemoryBuffer.h"
27 #include "llvm/Support/Path.h"
28 #include "llvm/Support/Regex.h"
29 #include "llvm/Support/TargetSelect.h"
30 #include "llvm/Support/ToolOutputFile.h"
31 #include "llvm/Support/WithColor.h"
32 #include "llvm/Support/raw_ostream.h"
36 using namespace llvm::dwarfdump;
37 using namespace llvm::object;
40 /// Parser for options that take an optional offest argument.
44 bool HasValue = false;
45 bool IsRequested = false;
47 struct BoolOption : public OffsetOption {};
53 class parser<OffsetOption> final : public basic_parser<OffsetOption> {
55 parser(Option &O) : basic_parser(O) {}
57 /// Return true on error.
58 bool parse(Option &O, StringRef ArgName, StringRef Arg, OffsetOption &Val) {
62 Val.IsRequested = true;
65 if (Arg.getAsInteger(0, Val.Val))
66 return O.error("'" + Arg + "' value invalid for integer argument");
68 Val.IsRequested = true;
72 enum ValueExpected getValueExpectedFlagDefault() const {
76 StringRef getValueName() const override { return StringRef("offset"); }
78 void printOptionDiff(const Option &O, OffsetOption V, OptVal Default,
79 size_t GlobalWidth) const {
80 printOptionName(O, GlobalWidth);
81 outs() << "[=offset]";
85 template <> class parser<BoolOption> final : public basic_parser<BoolOption> {
87 parser(Option &O) : basic_parser(O) {}
89 /// Return true on error.
90 bool parse(Option &O, StringRef ArgName, StringRef Arg, BoolOption &Val) {
92 return O.error("this is a flag and does not take a value");
95 Val.IsRequested = true;
99 enum ValueExpected getValueExpectedFlagDefault() const {
100 return ValueOptional;
103 StringRef getValueName() const override { return StringRef(); }
105 void printOptionDiff(const Option &O, OffsetOption V, OptVal Default,
106 size_t GlobalWidth) const {
107 printOptionName(O, GlobalWidth);
114 /// Command line options.
120 OptionCategory DwarfDumpCategory("Specific Options");
121 static list<std::string>
122 InputFilenames(Positional, desc("<input object files or .dSYM bundles>"),
123 ZeroOrMore, cat(DwarfDumpCategory));
125 cl::OptionCategory SectionCategory("Section-specific Dump Options",
126 "These control which sections are dumped. "
127 "Where applicable these parameters take an "
128 "optional =<offset> argument to dump only "
129 "the entry at the specified offset.");
131 static opt<bool> DumpAll("all", desc("Dump all debug info sections"),
132 cat(SectionCategory));
133 static alias DumpAllAlias("a", desc("Alias for -all"), aliasopt(DumpAll));
135 // Options for dumping specific sections.
136 static unsigned DumpType = DIDT_Null;
137 static std::array<llvm::Optional<uint64_t>, (unsigned)DIDT_ID_Count>
139 #define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME, OPTION) \
140 static opt<OPTION> Dump##ENUM_NAME(CMDLINE_NAME, \
141 desc("Dump the " ELF_NAME " section"), \
142 cat(SectionCategory));
143 #include "llvm/BinaryFormat/Dwarf.def"
144 #undef HANDLE_DWARF_SECTION
146 static alias DumpDebugFrameAlias("eh-frame", desc("Alias for -debug-frame"),
147 NotHidden, cat(SectionCategory),
148 aliasopt(DumpDebugFrame));
149 static list<std::string>
151 desc("Dump debug information for the specified CPU "
152 "architecture only. Architectures may be specified by "
153 "name or by number. This option can be specified "
154 "multiple times, once for each desired architecture."),
155 cat(DwarfDumpCategory));
158 desc("Emit diff-friendly output by omitting offsets and addresses."),
159 cat(DwarfDumpCategory));
160 static list<std::string>
162 desc("Search for the exact match for <name> in the accelerator tables "
163 "and print the matching debug information entries. When no "
164 "accelerator tables are available, the slower but more complete "
165 "-name option can be used instead."),
166 value_desc("name"), cat(DwarfDumpCategory));
167 static alias FindAlias("f", desc("Alias for -find."), aliasopt(Find));
168 static opt<bool> IgnoreCase("ignore-case",
169 desc("Ignore case distinctions when searching."),
170 value_desc("i"), cat(DwarfDumpCategory));
171 static alias IgnoreCaseAlias("i", desc("Alias for -ignore-case."),
172 aliasopt(IgnoreCase));
173 static list<std::string> Name(
175 desc("Find and print all debug info entries whose name (DW_AT_name "
176 "attribute) matches the exact text in <pattern>. When used with the "
177 "the -regex option <pattern> is interpreted as a regular expression."),
178 value_desc("pattern"), cat(DwarfDumpCategory));
179 static alias NameAlias("n", desc("Alias for -name"), aliasopt(Name));
182 desc("Lookup <address> in the debug information and print out any "
183 "available file, function, block and line table details."),
184 value_desc("address"), cat(DwarfDumpCategory));
185 static opt<std::string>
186 OutputFilename("o", cl::init("-"),
187 cl::desc("Redirect output to the specified file."),
188 cl::value_desc("filename"), cat(DwarfDumpCategory));
189 static alias OutputFilenameAlias("out-file", desc("Alias for -o."),
190 aliasopt(OutputFilename));
193 desc("Treat any <pattern> strings as regular expressions when "
194 "searching instead of just as an exact string match."),
195 cat(DwarfDumpCategory));
196 static alias RegexAlias("x", desc("Alias for -regex"), aliasopt(UseRegex));
198 ShowChildren("show-children",
199 desc("Show a debug info entry's children when selectively "
200 "printing entries."),
201 cat(DwarfDumpCategory));
202 static alias ShowChildrenAlias("c", desc("Alias for -show-children."),
203 aliasopt(ShowChildren));
205 ShowParents("show-parents",
206 desc("Show a debug info entry's parents when selectively "
207 "printing entries."),
208 cat(DwarfDumpCategory));
209 static alias ShowParentsAlias("p", desc("Alias for -show-parents."),
210 aliasopt(ShowParents));
212 ShowForm("show-form",
213 desc("Show DWARF form types after the DWARF attribute types."),
214 cat(DwarfDumpCategory));
215 static alias ShowFormAlias("F", desc("Alias for -show-form."),
216 aliasopt(ShowForm), cat(DwarfDumpCategory));
218 ChildRecurseDepth("recurse-depth",
219 desc("Only recurse to a depth of N when displaying "
220 "children of debug info entries."),
221 cat(DwarfDumpCategory), init(-1U), value_desc("N"));
222 static alias ChildRecurseDepthAlias("r", desc("Alias for -recurse-depth."),
223 aliasopt(ChildRecurseDepth));
225 ParentRecurseDepth("parent-recurse-depth",
226 desc("Only recurse to a depth of N when displaying "
227 "parents of debug info entries."),
228 cat(DwarfDumpCategory), init(-1U), value_desc("N"));
230 SummarizeTypes("summarize-types",
231 desc("Abbreviate the description of type unit entries."),
232 cat(DwarfDumpCategory));
234 Statistics("statistics",
235 cl::desc("Emit JSON-formatted debug info quality metrics."),
236 cat(DwarfDumpCategory));
238 ShowSectionSizes("show-section-sizes",
239 cl::desc("Show the sizes of all debug sections, "
240 "expressed in bytes."),
241 cat(DwarfDumpCategory));
242 static opt<bool> Verify("verify", desc("Verify the DWARF debug info."),
243 cat(DwarfDumpCategory));
244 static opt<bool> Quiet("quiet", desc("Use with -verify to not emit to STDOUT."),
245 cat(DwarfDumpCategory));
246 static opt<bool> DumpUUID("uuid", desc("Show the UUID for each architecture."),
247 cat(DwarfDumpCategory));
248 static alias DumpUUIDAlias("u", desc("Alias for -uuid."), aliasopt(DumpUUID));
249 static opt<bool> Verbose("verbose",
250 desc("Print more low-level encoding details."),
251 cat(DwarfDumpCategory));
252 static alias VerboseAlias("v", desc("Alias for -verbose."), aliasopt(Verbose),
253 cat(DwarfDumpCategory));
255 HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
258 //===----------------------------------------------------------------------===//
260 static void error(StringRef Prefix, std::error_code EC) {
263 WithColor::error() << Prefix << ": " << EC.message() << "\n";
267 static DIDumpOptions getDumpOpts(DWARFContext &C) {
268 DIDumpOptions DumpOpts;
269 DumpOpts.DumpType = DumpType;
270 DumpOpts.ChildRecurseDepth = ChildRecurseDepth;
271 DumpOpts.ParentRecurseDepth = ParentRecurseDepth;
272 DumpOpts.ShowAddresses = !Diff;
273 DumpOpts.ShowChildren = ShowChildren;
274 DumpOpts.ShowParents = ShowParents;
275 DumpOpts.ShowForm = ShowForm;
276 DumpOpts.SummarizeTypes = SummarizeTypes;
277 DumpOpts.Verbose = Verbose;
278 DumpOpts.RecoverableErrorHandler = C.getRecoverableErrorHandler();
279 // In -verify mode, print DIEs without children in error messages.
281 return DumpOpts.noImplicitRecursion();
285 static uint32_t getCPUType(MachOObjectFile &MachO) {
287 return MachO.getHeader64().cputype;
289 return MachO.getHeader().cputype;
292 /// Return true if the object file has not been filtered by an --arch option.
293 static bool filterArch(ObjectFile &Obj) {
294 if (ArchFilters.empty())
297 if (auto *MachO = dyn_cast<MachOObjectFile>(&Obj)) {
298 for (auto Arch : ArchFilters) {
299 // Match architecture number.
301 if (!StringRef(Arch).getAsInteger(0, Value))
302 if (Value == getCPUType(*MachO))
306 if (MachO->getArchTriple().getArchName() == Triple(Arch).getArchName())
313 using HandlerFn = std::function<bool(ObjectFile &, DWARFContext &DICtx,
314 const Twine &, raw_ostream &)>;
316 /// Print only DIEs that have a certain name.
317 static bool filterByName(const StringSet<> &Names, DWARFDie Die,
318 StringRef NameRef, raw_ostream &OS) {
319 DIDumpOptions DumpOpts = getDumpOpts(Die.getDwarfUnit()->getContext());
321 (IgnoreCase && !UseRegex) ? NameRef.lower() : NameRef.str();
323 // Match regular expression.
324 for (auto Pattern : Names.keys()) {
325 Regex RE(Pattern, IgnoreCase ? Regex::IgnoreCase : Regex::NoFlags);
327 if (!RE.isValid(Error)) {
328 errs() << "error in regular expression: " << Error << "\n";
331 if (RE.match(Name)) {
332 Die.dump(OS, 0, DumpOpts);
336 } else if (Names.count(Name)) {
338 Die.dump(OS, 0, DumpOpts);
344 /// Print only DIEs that have a certain name.
345 static void filterByName(const StringSet<> &Names,
346 DWARFContext::unit_iterator_range CUs,
348 for (const auto &CU : CUs)
349 for (const auto &Entry : CU->dies()) {
350 DWARFDie Die = {CU.get(), &Entry};
351 if (const char *Name = Die.getName(DINameKind::ShortName))
352 if (filterByName(Names, Die, Name, OS))
354 if (const char *Name = Die.getName(DINameKind::LinkageName))
355 filterByName(Names, Die, Name, OS);
359 static void getDies(DWARFContext &DICtx, const AppleAcceleratorTable &Accel,
360 StringRef Name, SmallVectorImpl<DWARFDie> &Dies) {
361 for (const auto &Entry : Accel.equal_range(Name)) {
362 if (llvm::Optional<uint64_t> Off = Entry.getDIESectionOffset()) {
363 if (DWARFDie Die = DICtx.getDIEForOffset(*Off))
369 static DWARFDie toDie(const DWARFDebugNames::Entry &Entry,
370 DWARFContext &DICtx) {
371 llvm::Optional<uint64_t> CUOff = Entry.getCUOffset();
372 llvm::Optional<uint64_t> Off = Entry.getDIEUnitOffset();
376 DWARFCompileUnit *CU = DICtx.getCompileUnitForOffset(*CUOff);
380 if (llvm::Optional<uint64_t> DWOId = CU->getDWOId()) {
381 // This is a skeleton unit. Look up the DIE in the DWO unit.
382 CU = DICtx.getDWOCompileUnitForHash(*DWOId);
387 return CU->getDIEForOffset(CU->getOffset() + *Off);
390 static void getDies(DWARFContext &DICtx, const DWARFDebugNames &Accel,
391 StringRef Name, SmallVectorImpl<DWARFDie> &Dies) {
392 for (const auto &Entry : Accel.equal_range(Name)) {
393 if (DWARFDie Die = toDie(Entry, DICtx))
398 /// Print only DIEs that have a certain name.
399 static void filterByAccelName(ArrayRef<std::string> Names, DWARFContext &DICtx,
401 SmallVector<DWARFDie, 4> Dies;
402 for (const auto &Name : Names) {
403 getDies(DICtx, DICtx.getAppleNames(), Name, Dies);
404 getDies(DICtx, DICtx.getAppleTypes(), Name, Dies);
405 getDies(DICtx, DICtx.getAppleNamespaces(), Name, Dies);
406 getDies(DICtx, DICtx.getDebugNames(), Name, Dies);
409 Dies.erase(std::unique(Dies.begin(), Dies.end()), Dies.end());
411 DIDumpOptions DumpOpts = getDumpOpts(DICtx);
412 for (DWARFDie Die : Dies)
413 Die.dump(OS, 0, DumpOpts);
416 /// Handle the --lookup option and dump the DIEs and line info for the given
418 /// TODO: specified Address for --lookup option could relate for several
419 /// different sections(in case not-linked object file). llvm-dwarfdump
420 /// need to do something with this: extend lookup option with section
421 /// information or probably display all matched entries, or something else...
422 static bool lookup(ObjectFile &Obj, DWARFContext &DICtx, uint64_t Address,
424 auto DIEsForAddr = DICtx.getDIEsForAddress(Lookup);
429 DIDumpOptions DumpOpts = getDumpOpts(DICtx);
430 DumpOpts.ChildRecurseDepth = 0;
431 DIEsForAddr.CompileUnit->dump(OS, DumpOpts);
432 if (DIEsForAddr.FunctionDIE) {
433 DIEsForAddr.FunctionDIE.dump(OS, 2, DumpOpts);
434 if (DIEsForAddr.BlockDIE)
435 DIEsForAddr.BlockDIE.dump(OS, 4, DumpOpts);
438 // TODO: it is neccessary to set proper SectionIndex here.
439 // object::SectionedAddress::UndefSection works for only absolute addresses.
440 if (DILineInfo LineInfo = DICtx.getLineInfoForAddress(
441 {Lookup, object::SectionedAddress::UndefSection}))
447 static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
448 const Twine &Filename, raw_ostream &OS) {
449 logAllUnhandledErrors(DICtx.loadRegisterInfo(Obj), errs(),
450 Filename.str() + ": ");
451 // The UUID dump already contains all the same information.
452 if (!(DumpType & DIDT_UUID) || DumpType == DIDT_All)
453 OS << Filename << ":\tfile format " << Obj.getFileFormatName() << '\n';
455 // Handle the --lookup option.
457 return lookup(Obj, DICtx, Lookup, OS);
459 // Handle the --name option.
462 for (auto name : Name)
463 Names.insert((IgnoreCase && !UseRegex) ? StringRef(name).lower() : name);
465 filterByName(Names, DICtx.normal_units(), OS);
466 filterByName(Names, DICtx.dwo_units(), OS);
470 // Handle the --find option and lower it to --debug-info=<offset>.
472 filterByAccelName(Find, DICtx, OS);
476 // Dump the complete DWARF structure.
477 DICtx.dump(OS, getDumpOpts(DICtx), DumpOffsets);
481 static bool verifyObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
482 const Twine &Filename, raw_ostream &OS) {
483 // Verify the DWARF and exit with non-zero exit status if verification
485 raw_ostream &stream = Quiet ? nulls() : OS;
486 stream << "Verifying " << Filename.str() << ":\tfile format "
487 << Obj.getFileFormatName() << "\n";
488 bool Result = DICtx.verify(stream, getDumpOpts(DICtx));
490 stream << "No errors.\n";
492 stream << "Errors detected.\n";
496 static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
497 HandlerFn HandleObj, raw_ostream &OS);
499 static bool handleArchive(StringRef Filename, Archive &Arch,
500 HandlerFn HandleObj, raw_ostream &OS) {
502 Error Err = Error::success();
503 for (auto Child : Arch.children(Err)) {
504 auto BuffOrErr = Child.getMemoryBufferRef();
505 error(Filename, errorToErrorCode(BuffOrErr.takeError()));
506 auto NameOrErr = Child.getName();
507 error(Filename, errorToErrorCode(NameOrErr.takeError()));
508 std::string Name = (Filename + "(" + NameOrErr.get() + ")").str();
509 Result &= handleBuffer(Name, BuffOrErr.get(), HandleObj, OS);
511 error(Filename, errorToErrorCode(std::move(Err)));
516 static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
517 HandlerFn HandleObj, raw_ostream &OS) {
518 Expected<std::unique_ptr<Binary>> BinOrErr = object::createBinary(Buffer);
519 error(Filename, errorToErrorCode(BinOrErr.takeError()));
522 auto RecoverableErrorHandler = [&](Error E) {
524 WithColor::defaultErrorHandler(std::move(E));
526 if (auto *Obj = dyn_cast<ObjectFile>(BinOrErr->get())) {
527 if (filterArch(*Obj)) {
528 std::unique_ptr<DWARFContext> DICtx =
529 DWARFContext::create(*Obj, nullptr, "", RecoverableErrorHandler);
530 if (!HandleObj(*Obj, *DICtx, Filename, OS))
534 else if (auto *Fat = dyn_cast<MachOUniversalBinary>(BinOrErr->get()))
535 for (auto &ObjForArch : Fat->objects()) {
536 std::string ObjName =
537 (Filename + "(" + ObjForArch.getArchFlagName() + ")").str();
538 if (auto MachOOrErr = ObjForArch.getAsObjectFile()) {
539 auto &Obj = **MachOOrErr;
540 if (filterArch(Obj)) {
541 std::unique_ptr<DWARFContext> DICtx =
542 DWARFContext::create(Obj, nullptr, "", RecoverableErrorHandler);
543 if (!HandleObj(Obj, *DICtx, ObjName, OS))
548 consumeError(MachOOrErr.takeError());
549 if (auto ArchiveOrErr = ObjForArch.getAsArchive()) {
550 error(ObjName, errorToErrorCode(ArchiveOrErr.takeError()));
551 if (!handleArchive(ObjName, *ArchiveOrErr.get(), HandleObj, OS))
555 consumeError(ArchiveOrErr.takeError());
557 else if (auto *Arch = dyn_cast<Archive>(BinOrErr->get()))
558 Result = handleArchive(Filename, *Arch, HandleObj, OS);
562 static bool handleFile(StringRef Filename, HandlerFn HandleObj,
564 ErrorOr<std::unique_ptr<MemoryBuffer>> BuffOrErr =
565 MemoryBuffer::getFileOrSTDIN(Filename);
566 error(Filename, BuffOrErr.getError());
567 std::unique_ptr<MemoryBuffer> Buffer = std::move(BuffOrErr.get());
568 return handleBuffer(Filename, *Buffer, HandleObj, OS);
571 /// If the input path is a .dSYM bundle (as created by the dsymutil tool),
572 /// replace it with individual entries for each of the object files inside the
573 /// bundle otherwise return the input path.
574 static std::vector<std::string> expandBundle(const std::string &InputPath) {
575 std::vector<std::string> BundlePaths;
576 SmallString<256> BundlePath(InputPath);
577 // Normalize input path. This is necessary to accept `bundle.dSYM/`.
578 sys::path::remove_dots(BundlePath);
579 // Manually open up the bundle to avoid introducing additional dependencies.
580 if (sys::fs::is_directory(BundlePath) &&
581 sys::path::extension(BundlePath) == ".dSYM") {
583 sys::path::append(BundlePath, "Contents", "Resources", "DWARF");
584 for (sys::fs::directory_iterator Dir(BundlePath, EC), DirEnd;
585 Dir != DirEnd && !EC; Dir.increment(EC)) {
586 const std::string &Path = Dir->path();
587 sys::fs::file_status Status;
588 EC = sys::fs::status(Path, Status);
590 switch (Status.type()) {
591 case sys::fs::file_type::regular_file:
592 case sys::fs::file_type::symlink_file:
593 case sys::fs::file_type::type_unknown:
594 BundlePaths.push_back(Path);
599 error(BundlePath, EC);
601 if (!BundlePaths.size())
602 BundlePaths.push_back(InputPath);
606 int main(int argc, char **argv) {
607 InitLLVM X(argc, argv);
609 // Flush outs() when printing to errs(). This avoids interleaving output
613 llvm::InitializeAllTargetInfos();
614 llvm::InitializeAllTargetMCs();
616 HideUnrelatedOptions({&DwarfDumpCategory, &SectionCategory, &ColorCategory});
617 cl::ParseCommandLineOptions(
619 "pretty-print DWARF debug information in object files"
620 " and debug info archives.\n");
622 // FIXME: Audit interactions between these two options and make them
624 if (Diff && Verbose) {
625 WithColor::error() << "incompatible arguments: specifying both -diff and "
626 "-verbose is currently not supported";
631 ToolOutputFile OutputFile(OutputFilename, EC, sys::fs::OF_Text);
632 error("Unable to open output file" + OutputFilename, EC);
633 // Don't remove output file if we exit with an error.
636 bool OffsetRequested = false;
638 // Defaults to dumping all sections, unless brief mode is specified in which
639 // case only the .debug_info section in dumped.
640 #define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME, OPTION) \
641 if (Dump##ENUM_NAME.IsRequested) { \
642 DumpType |= DIDT_##ENUM_NAME; \
643 if (Dump##ENUM_NAME.HasValue) { \
644 DumpOffsets[DIDT_ID_##ENUM_NAME] = Dump##ENUM_NAME.Val; \
645 OffsetRequested = true; \
648 #include "llvm/BinaryFormat/Dwarf.def"
649 #undef HANDLE_DWARF_SECTION
651 DumpType |= DIDT_UUID;
654 if (DumpType == DIDT_Null) {
658 DumpType = DIDT_DebugInfo;
661 // Unless dumping a specific DIE, default to --show-children.
662 if (!ShowChildren && !Verify && !OffsetRequested && Name.empty() && Find.empty())
665 // Defaults to a.out if no filenames specified.
666 if (InputFilenames.empty())
667 InputFilenames.push_back("a.out");
669 // Expand any .dSYM bundles to the individual object files contained therein.
670 std::vector<std::string> Objects;
671 for (const auto &F : InputFilenames) {
672 auto Objs = expandBundle(F);
673 Objects.insert(Objects.end(), Objs.begin(), Objs.end());
678 for (auto Object : Objects)
679 Success &= handleFile(Object, verifyObjectFile, OutputFile.os());
680 } else if (Statistics) {
681 for (auto Object : Objects)
682 Success &= handleFile(Object, collectStatsForObjectFile, OutputFile.os());
683 } else if (ShowSectionSizes) {
684 for (auto Object : Objects)
685 Success &= handleFile(Object, collectObjectSectionSizes, OutputFile.os());
687 for (auto Object : Objects)
688 Success &= handleFile(Object, dumpObjectFile, OutputFile.os());
691 return Success ? EXIT_SUCCESS : EXIT_FAILURE;