llvm.org GIT mirror llvm / 398ecdf
Fix a bugs with using some Mach-O command line flags like "-arch armv7m". The Mach-O command line flag like "-arch armv7m" does not match the arch name part of its llvm Triple which is "thumbv7m-apple-darwin”. I think the best way to fix this is to have llvm::object::MachOObjectFile::getArchTriple() optionally return the name of the Mach-O arch flag that would be used with -arch that matches the CPUType and CPUSubType. Then change llvm::object::MachOUniversalBinary::ObjectForArch::getArchTypeName() to use that and change it to getArchFlagName() as the type name is really part of the Triple and the -arch flag name is a Mach-O thing for a specific Triple with a specific Mcpu value. rdar://29663637 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290001 91177308-0d34-0410-b5e6-96231b3b80d8 Kevin Enderby 3 years ago
11 changed file(s) with 112 addition(s) and 59 deletion(s). Raw diff Collapse all Expand all
412412
413413 static Triple::ArchType getArch(uint32_t CPUType);
414414 static Triple getArchTriple(uint32_t CPUType, uint32_t CPUSubType,
415 const char **McpuDefault = nullptr);
415 const char **McpuDefault = nullptr,
416 const char **ArchFlag = nullptr);
416417 static bool isValidArch(StringRef ArchFlag);
417418 static Triple getHostArch();
418419
8888 else // Parent->getMagic() == MachO::FAT_MAGIC_64
8989 return Header64.reserved;
9090 }
91 std::string getArchTypeName() const {
91 std::string getArchFlagName() const {
92 const char *McpuDefault, *ArchFlag;
9293 if (Parent->getMagic() == MachO::FAT_MAGIC) {
9394 Triple T =
94 MachOObjectFile::getArchTriple(Header.cputype, Header.cpusubtype);
95 return T.getArchName();
95 MachOObjectFile::getArchTriple(Header.cputype, Header.cpusubtype,
96 &McpuDefault, &ArchFlag);
9697 } else { // Parent->getMagic() == MachO::FAT_MAGIC_64
9798 Triple T =
9899 MachOObjectFile::getArchTriple(Header64.cputype,
99 Header64.cpusubtype);
100 return T.getArchName();
100 Header64.cpusubtype,
101 &McpuDefault, &ArchFlag);
102 }
103 if (ArchFlag) {
104 std::string ArchFlagName(ArchFlag);
105 return ArchFlagName;
106 } else {
107 std::string ArchFlagName("");
108 return ArchFlagName;
101109 }
102110 }
103111
23172317 }
23182318
23192319 Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType,
2320 const char **McpuDefault) {
2320 const char **McpuDefault,
2321 const char **ArchFlag) {
23212322 if (McpuDefault)
23222323 *McpuDefault = nullptr;
2324 if (ArchFlag)
2325 *ArchFlag = nullptr;
23232326
23242327 switch (CPUType) {
23252328 case MachO::CPU_TYPE_I386:
23262329 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) {
23272330 case MachO::CPU_SUBTYPE_I386_ALL:
2331 if (ArchFlag)
2332 *ArchFlag = "i386";
23282333 return Triple("i386-apple-darwin");
23292334 default:
23302335 return Triple();
23322337 case MachO::CPU_TYPE_X86_64:
23332338 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) {
23342339 case MachO::CPU_SUBTYPE_X86_64_ALL:
2340 if (ArchFlag)
2341 *ArchFlag = "x86_64";
23352342 return Triple("x86_64-apple-darwin");
23362343 case MachO::CPU_SUBTYPE_X86_64_H:
2344 if (ArchFlag)
2345 *ArchFlag = "x86_64h";
23372346 return Triple("x86_64h-apple-darwin");
23382347 default:
23392348 return Triple();
23412350 case MachO::CPU_TYPE_ARM:
23422351 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) {
23432352 case MachO::CPU_SUBTYPE_ARM_V4T:
2353 if (ArchFlag)
2354 *ArchFlag = "armv4t";
23442355 return Triple("armv4t-apple-darwin");
23452356 case MachO::CPU_SUBTYPE_ARM_V5TEJ:
2357 if (ArchFlag)
2358 *ArchFlag = "armv5e";
23462359 return Triple("armv5e-apple-darwin");
23472360 case MachO::CPU_SUBTYPE_ARM_XSCALE:
2361 if (ArchFlag)
2362 *ArchFlag = "xscale";
23482363 return Triple("xscale-apple-darwin");
23492364 case MachO::CPU_SUBTYPE_ARM_V6:
2365 if (ArchFlag)
2366 *ArchFlag = "armv6";
23502367 return Triple("armv6-apple-darwin");
23512368 case MachO::CPU_SUBTYPE_ARM_V6M:
23522369 if (McpuDefault)
23532370 *McpuDefault = "cortex-m0";
2371 if (ArchFlag)
2372 *ArchFlag = "armv6m";
23542373 return Triple("armv6m-apple-darwin");
23552374 case MachO::CPU_SUBTYPE_ARM_V7:
2375 if (ArchFlag)
2376 *ArchFlag = "armv7";
23562377 return Triple("armv7-apple-darwin");
23572378 case MachO::CPU_SUBTYPE_ARM_V7EM:
23582379 if (McpuDefault)
23592380 *McpuDefault = "cortex-m4";
2381 if (ArchFlag)
2382 *ArchFlag = "armv7em";
23602383 return Triple("thumbv7em-apple-darwin");
23612384 case MachO::CPU_SUBTYPE_ARM_V7K:
2385 if (ArchFlag)
2386 *ArchFlag = "armv7k";
23622387 return Triple("armv7k-apple-darwin");
23632388 case MachO::CPU_SUBTYPE_ARM_V7M:
23642389 if (McpuDefault)
23652390 *McpuDefault = "cortex-m3";
2391 if (ArchFlag)
2392 *ArchFlag = "armv7m";
23662393 return Triple("thumbv7m-apple-darwin");
23672394 case MachO::CPU_SUBTYPE_ARM_V7S:
2395 if (ArchFlag)
2396 *ArchFlag = "armv7s";
23682397 return Triple("armv7s-apple-darwin");
23692398 default:
23702399 return Triple();
23722401 case MachO::CPU_TYPE_ARM64:
23732402 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) {
23742403 case MachO::CPU_SUBTYPE_ARM64_ALL:
2404 if (ArchFlag)
2405 *ArchFlag = "arm64";
23752406 return Triple("arm64-apple-darwin");
23762407 default:
23772408 return Triple();
23792410 case MachO::CPU_TYPE_POWERPC:
23802411 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) {
23812412 case MachO::CPU_SUBTYPE_POWERPC_ALL:
2413 if (ArchFlag)
2414 *ArchFlag = "ppc";
23822415 return Triple("ppc-apple-darwin");
23832416 default:
23842417 return Triple();
23862419 case MachO::CPU_TYPE_POWERPC64:
23872420 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) {
23882421 case MachO::CPU_SUBTYPE_POWERPC_ALL:
2422 if (ArchFlag)
2423 *ArchFlag = "ppc64";
23892424 return Triple("ppc64-apple-darwin");
23902425 default:
23912426 return Triple();
218218 object_error::arch_not_found);
219219
220220 for (auto &Obj : objects())
221 if (Obj.getArchTypeName() == ArchName)
221 if (Obj.getArchFlagName() == ArchName)
222222 return Obj.getAsObjectFile();
223223 return make_error("fat file does not "
224224 "contain " +
0 @ RUN: llvm-objdump -macho -d -arch armv7m %p/Inputs/fat-armv7m.o | FileCheck %s
1 @ CHECK: fat-armv7m.o:
2 @ CHECK: (__TEXT,__text) section
3 @ CHECK: foo:
4 @ CHECK: 00 bf nop
0 RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=x86_64 | FileCheck --check-prefix=X86_64 %s
11 RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=x86_64h | FileCheck --check-prefix=X86_64H %s
22 RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=armv7 | FileCheck --check-prefix=ARMV7 %s
3 RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=thumbv7em | FileCheck --check-prefix=ARMV7EM %s
4 RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=thumbv7m | FileCheck --check-prefix=ARMV7M %s
3 RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=armv7em | FileCheck --check-prefix=ARMV7EM %s
4 RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=armv7m | FileCheck --check-prefix=ARMV7M %s
55
66 X86_64: x86_64_function
77 X86_64H: x86_64h_function
111111 auto MachOOrErr = ObjForArch.getAsObjectFile();
112112 error(Filename, errorToErrorCode(MachOOrErr.takeError()));
113113 DumpObjectFile(**MachOOrErr,
114 Filename + " (" + ObjForArch.getArchTypeName() + ")");
114 Filename + " (" + ObjForArch.getArchFlagName() + ")");
115115 }
116116 }
117117
11471147 for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
11481148 E = UB->end_objects();
11491149 I != E; ++I) {
1150 if (ArchFlags[i] == I->getArchTypeName()) {
1150 if (ArchFlags[i] == I->getArchFlagName()) {
11511151 ArchFound = true;
11521152 Expected> ObjOrErr =
11531153 I->getAsObjectFile();
11591159 ObjectFile &Obj = *ObjOrErr.get();
11601160 if (ArchFlags.size() > 1) {
11611161 if (PrintFileName)
1162 ArchitectureName = I->getArchTypeName();
1162 ArchitectureName = I->getArchFlagName();
11631163 else
11641164 outs() << "\n" << Obj.getFileName() << " (for architecture "
1165 << I->getArchTypeName() << ")"
1165 << I->getArchFlagName() << ")"
11661166 << ":\n";
11671167 }
11681168 dumpSymbolNamesFromObject(Obj, false, ArchiveName,
11701170 } else if (auto E = isNotObjectErrorInvalidFileType(
11711171 ObjOrErr.takeError())) {
11721172 error(std::move(E), Filename, ArchFlags.size() > 1 ?
1173 StringRef(I->getArchTypeName()) : StringRef());
1173 StringRef(I->getArchFlagName()) : StringRef());
11741174 continue;
11751175 } else if (Expected> AOrErr =
11761176 I->getAsArchive()) {
11831183 if (auto E = isNotObjectErrorInvalidFileType(
11841184 ChildOrErr.takeError())) {
11851185 error(std::move(E), Filename, C, ArchFlags.size() > 1 ?
1186 StringRef(I->getArchTypeName()) : StringRef());
1186 StringRef(I->getArchFlagName()) : StringRef());
11871187 }
11881188 continue;
11891189 }
11921192 if (PrintFileName) {
11931193 ArchiveName = A->getFileName();
11941194 if (ArchFlags.size() > 1)
1195 ArchitectureName = I->getArchTypeName();
1195 ArchitectureName = I->getArchFlagName();
11961196 } else {
11971197 outs() << "\n" << A->getFileName();
11981198 outs() << "(" << O->getFileName() << ")";
11991199 if (ArchFlags.size() > 1) {
1200 outs() << " (for architecture " << I->getArchTypeName()
1200 outs() << " (for architecture " << I->getArchFlagName()
12011201 << ")";
12021202 }
12031203 outs() << ":\n";
12111211 } else {
12121212 consumeError(AOrErr.takeError());
12131213 error(Filename + " for architecture " +
1214 StringRef(I->getArchTypeName()) +
1214 StringRef(I->getArchFlagName()) +
12151215 " is not a Mach-O file or an archive file",
12161216 "Mach-O universal file");
12171217 }
12321232 for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
12331233 E = UB->end_objects();
12341234 I != E; ++I) {
1235 if (HostArchName == I->getArchTypeName()) {
1235 if (HostArchName == I->getArchFlagName()) {
12361236 Expected> ObjOrErr = I->getAsObjectFile();
12371237 std::string ArchiveName;
12381238 ArchiveName.clear();
12721272 } else {
12731273 consumeError(AOrErr.takeError());
12741274 error(Filename + " for architecture " +
1275 StringRef(I->getArchTypeName()) +
1275 StringRef(I->getArchFlagName()) +
12761276 " is not a Mach-O file or an archive file",
12771277 "Mach-O universal file");
12781278 }
12951295 ObjectFile &Obj = *ObjOrErr.get();
12961296 if (PrintFileName) {
12971297 if (isa(Obj) && moreThanOneArch)
1298 ArchitectureName = I->getArchTypeName();
1298 ArchitectureName = I->getArchFlagName();
12991299 } else {
13001300 if (moreThanOneArch)
13011301 outs() << "\n";
13021302 outs() << Obj.getFileName();
13031303 if (isa(Obj) && moreThanOneArch)
1304 outs() << " (for architecture " << I->getArchTypeName() << ")";
1304 outs() << " (for architecture " << I->getArchFlagName() << ")";
13051305 outs() << ":\n";
13061306 }
13071307 dumpSymbolNamesFromObject(Obj, false, ArchiveName, ArchitectureName);
13081308 } else if (auto E = isNotObjectErrorInvalidFileType(
13091309 ObjOrErr.takeError())) {
13101310 error(std::move(E), Filename, moreThanOneArch ?
1311 StringRef(I->getArchTypeName()) : StringRef());
1311 StringRef(I->getArchFlagName()) : StringRef());
13121312 continue;
13131313 } else if (Expected> AOrErr =
13141314 I->getAsArchive()) {
13281328 if (PrintFileName) {
13291329 ArchiveName = A->getFileName();
13301330 if (isa(O) && moreThanOneArch)
1331 ArchitectureName = I->getArchTypeName();
1331 ArchitectureName = I->getArchFlagName();
13321332 } else {
13331333 outs() << "\n" << A->getFileName();
13341334 if (isa(O)) {
13351335 outs() << "(" << O->getFileName() << ")";
13361336 if (moreThanOneArch)
1337 outs() << " (for architecture " << I->getArchTypeName()
1337 outs() << " (for architecture " << I->getArchFlagName()
13381338 << ")";
13391339 } else
13401340 outs() << ":" << O->getFileName();
13481348 } else {
13491349 consumeError(AOrErr.takeError());
13501350 error(Filename + " for architecture " +
1351 StringRef(I->getArchTypeName()) +
1351 StringRef(I->getArchFlagName()) +
13521352 " is not a Mach-O file or an archive file",
13531353 "Mach-O universal file");
13541354 }
11611161 MachO::mach_header H;
11621162 MachO::mach_header_64 H_64;
11631163 Triple T;
1164 const char *McpuDefault, *ArchFlag;
11641165 if (MachO->is64Bit()) {
11651166 H_64 = MachO->MachOObjectFile::getHeader64();
1166 T = MachOObjectFile::getArchTriple(H_64.cputype, H_64.cpusubtype);
1167 T = MachOObjectFile::getArchTriple(H_64.cputype, H_64.cpusubtype,
1168 &McpuDefault, &ArchFlag);
11671169 } else {
11681170 H = MachO->MachOObjectFile::getHeader();
1169 T = MachOObjectFile::getArchTriple(H.cputype, H.cpusubtype);
1170 }
1171 T = MachOObjectFile::getArchTriple(H.cputype, H.cpusubtype,
1172 &McpuDefault, &ArchFlag);
1173 }
1174 const std::string ArchFlagName(ArchFlag);
11711175 if (none_of(ArchFlags, [&](const std::string &Name) {
1172 return Name == T.getArchName();
1176 return Name == ArchFlagName;
11731177 })) {
11741178 errs() << "llvm-objdump: " + Filename + ": No architecture specified.\n";
11751179 return false;
14181422 }
14191423 }
14201424 if (verbose) {
1421 outs() << OFA.getArchTypeName() << "\n";
1425 outs() << OFA.getArchFlagName() << "\n";
14221426 printCPUType(cputype, cpusubtype & ~MachO::CPU_SUBTYPE_MASK);
14231427 } else {
14241428 outs() << i << "\n";
16021606 for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
16031607 E = UB->end_objects();
16041608 I != E; ++I) {
1605 if (ArchFlags[i] == I->getArchTypeName()) {
1609 if (ArchFlags[i] == I->getArchFlagName()) {
16061610 ArchFound = true;
16071611 Expected> ObjOrErr =
16081612 I->getAsObjectFile();
16091613 std::string ArchitectureName = "";
16101614 if (ArchFlags.size() > 1)
1611 ArchitectureName = I->getArchTypeName();
1615 ArchitectureName = I->getArchFlagName();
16121616 if (ObjOrErr) {
16131617 ObjectFile &O = *ObjOrErr.get();
16141618 if (MachOObjectFile *MachOOF = dyn_cast(&O))
16451649 } else {
16461650 consumeError(AOrErr.takeError());
16471651 error("Mach-O universal file: " + Filename + " for " +
1648 "architecture " + StringRef(I->getArchTypeName()) +
1652 "architecture " + StringRef(I->getArchFlagName()) +
16491653 " is not a Mach-O file or an archive file");
16501654 }
16511655 }
16651669 E = UB->end_objects();
16661670 I != E; ++I) {
16671671 if (MachOObjectFile::getHostArch().getArchName() ==
1668 I->getArchTypeName()) {
1672 I->getArchFlagName()) {
16691673 Expected> ObjOrErr = I->getAsObjectFile();
16701674 std::string ArchiveName;
16711675 ArchiveName.clear();
17011705 } else {
17021706 consumeError(AOrErr.takeError());
17031707 error("Mach-O universal file: " + Filename + " for architecture " +
1704 StringRef(I->getArchTypeName()) +
1708 StringRef(I->getArchFlagName()) +
17051709 " is not a Mach-O file or an archive file");
17061710 }
17071711 return;
17171721 Expected> ObjOrErr = I->getAsObjectFile();
17181722 std::string ArchitectureName = "";
17191723 if (moreThanOneArch)
1720 ArchitectureName = I->getArchTypeName();
1724 ArchitectureName = I->getArchFlagName();
17211725 if (ObjOrErr) {
17221726 ObjectFile &Obj = *ObjOrErr.get();
17231727 if (MachOObjectFile *MachOOF = dyn_cast(&Obj))
17561760 } else {
17571761 consumeError(AOrErr.takeError());
17581762 error("Mach-O universal file: " + Filename + " for architecture " +
1759 StringRef(I->getArchTypeName()) +
1763 StringRef(I->getArchFlagName()) +
17601764 " is not a Mach-O file or an archive file");
17611765 }
17621766 }
579579 for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
580580 E = UB->end_objects();
581581 I != E; ++I) {
582 if (ArchFlags[i] == I->getArchTypeName()) {
582 if (ArchFlags[i] == I->getArchFlagName()) {
583583 ArchFound = true;
584584 Expected> UO = I->getAsObjectFile();
585585 if (UO) {
590590 else if (MachO && OutputFormat == darwin) {
591591 if (MoreThanOneFile || ArchFlags.size() > 1)
592592 outs() << o->getFileName() << " (for architecture "
593 << I->getArchTypeName() << "): \n";
593 << I->getArchFlagName() << "): \n";
594594 }
595595 printObjectSectionSizes(o);
596596 if (OutputFormat == berkeley) {
597597 if (!MachO || MoreThanOneFile || ArchFlags.size() > 1)
598598 outs() << o->getFileName() << " (for architecture "
599 << I->getArchTypeName() << ")";
599 << I->getArchFlagName() << ")";
600600 outs() << "\n";
601601 }
602602 }
603603 } else if (auto E = isNotObjectErrorInvalidFileType(
604604 UO.takeError())) {
605605 error(std::move(E), file, ArchFlags.size() > 1 ?
606 StringRef(I->getArchTypeName()) : StringRef());
606 StringRef(I->getArchFlagName()) : StringRef());
607607 return;
608608 } else if (Expected> AOrErr =
609609 I->getAsArchive()) {
618618 ChildOrErr.takeError()))
619619 error(std::move(E), UA->getFileName(), C,
620620 ArchFlags.size() > 1 ?
621 StringRef(I->getArchTypeName()) : StringRef());
621 StringRef(I->getArchFlagName()) : StringRef());
622622 continue;
623623 }
624624 if (ObjectFile *o = dyn_cast(&*ChildOrErr.get())) {
629629 else if (MachO && OutputFormat == darwin)
630630 outs() << UA->getFileName() << "(" << o->getFileName()
631631 << ")"
632 << " (for architecture " << I->getArchTypeName()
632 << " (for architecture " << I->getArchFlagName()
633633 << "):\n";
634634 printObjectSectionSizes(o);
635635 if (OutputFormat == berkeley) {
637637 outs() << UA->getFileName() << "(" << o->getFileName()
638638 << ")";
639639 if (ArchFlags.size() > 1)
640 outs() << " (for architecture " << I->getArchTypeName()
640 outs() << " (for architecture " << I->getArchFlagName()
641641 << ")";
642642 outs() << "\n";
643643 } else
651651 } else {
652652 consumeError(AOrErr.takeError());
653653 error("Mach-O universal file: " + file + " for architecture " +
654 StringRef(I->getArchTypeName()) +
654 StringRef(I->getArchFlagName()) +
655655 " is not a Mach-O file or an archive file");
656656 }
657657 }
671671 for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
672672 E = UB->end_objects();
673673 I != E; ++I) {
674 if (HostArchName == I->getArchTypeName()) {
674 if (HostArchName == I->getArchFlagName()) {
675675 Expected> UO = I->getAsObjectFile();
676676 if (UO) {
677677 if (ObjectFile *o = dyn_cast(&*UO.get())) {
681681 else if (MachO && OutputFormat == darwin) {
682682 if (MoreThanOneFile)
683683 outs() << o->getFileName() << " (for architecture "
684 << I->getArchTypeName() << "):\n";
684 << I->getArchFlagName() << "):\n";
685685 }
686686 printObjectSectionSizes(o);
687687 if (OutputFormat == berkeley) {
688688 if (!MachO || MoreThanOneFile)
689689 outs() << o->getFileName() << " (for architecture "
690 << I->getArchTypeName() << ")";
690 << I->getArchFlagName() << ")";
691691 outs() << "\n";
692692 }
693693 }
715715 << "):\n";
716716 else if (MachO && OutputFormat == darwin)
717717 outs() << UA->getFileName() << "(" << o->getFileName() << ")"
718 << " (for architecture " << I->getArchTypeName()
718 << " (for architecture " << I->getArchFlagName()
719719 << "):\n";
720720 printObjectSectionSizes(o);
721721 if (OutputFormat == berkeley) {
733733 } else {
734734 consumeError(AOrErr.takeError());
735735 error("Mach-O universal file: " + file + " for architecture " +
736 StringRef(I->getArchTypeName()) +
736 StringRef(I->getArchFlagName()) +
737737 " is not a Mach-O file or an archive file");
738738 }
739739 return;
755755 else if (MachO && OutputFormat == darwin) {
756756 if (MoreThanOneFile || MoreThanOneArch)
757757 outs() << o->getFileName() << " (for architecture "
758 << I->getArchTypeName() << "):";
758 << I->getArchFlagName() << "):";
759759 outs() << "\n";
760760 }
761761 printObjectSectionSizes(o);
762762 if (OutputFormat == berkeley) {
763763 if (!MachO || MoreThanOneFile || MoreThanOneArch)
764764 outs() << o->getFileName() << " (for architecture "
765 << I->getArchTypeName() << ")";
765 << I->getArchFlagName() << ")";
766766 outs() << "\n";
767767 }
768768 }
769769 } else if (auto E = isNotObjectErrorInvalidFileType(UO.takeError())) {
770770 error(std::move(E), file, MoreThanOneArch ?
771 StringRef(I->getArchTypeName()) : StringRef());
771 StringRef(I->getArchFlagName()) : StringRef());
772772 return;
773773 } else if (Expected> AOrErr =
774774 I->getAsArchive()) {
781781 if (auto E = isNotObjectErrorInvalidFileType(
782782 ChildOrErr.takeError()))
783783 error(std::move(E), UA->getFileName(), C, MoreThanOneArch ?
784 StringRef(I->getArchTypeName()) : StringRef());
784 StringRef(I->getArchFlagName()) : StringRef());
785785 continue;
786786 }
787787 if (ObjectFile *o = dyn_cast(&*ChildOrErr.get())) {
791791 << "):\n";
792792 else if (MachO && OutputFormat == darwin)
793793 outs() << UA->getFileName() << "(" << o->getFileName() << ")"
794 << " (for architecture " << I->getArchTypeName() << "):\n";
794 << " (for architecture " << I->getArchFlagName() << "):\n";
795795 printObjectSectionSizes(o);
796796 if (OutputFormat == berkeley) {
797797 if (MachO)
798798 outs() << UA->getFileName() << "(" << o->getFileName() << ")"
799 << " (for architecture " << I->getArchTypeName()
799 << " (for architecture " << I->getArchFlagName()
800800 << ")\n";
801801 else
802802 outs() << o->getFileName() << " (ex " << UA->getFileName()
809809 } else {
810810 consumeError(AOrErr.takeError());
811811 error("Mach-O universal file: " + file + " for architecture " +
812 StringRef(I->getArchTypeName()) +
812 StringRef(I->getArchFlagName()) +
813813 " is not a Mach-O file or an archive file");
814814 }
815815 }