diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index d74e91a1a1c..8c33ec8fd60 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -413,7 +413,8 @@ public: static Triple::ArchType getArch(uint32_t CPUType); static Triple getArchTriple(uint32_t CPUType, uint32_t CPUSubType, - const char **McpuDefault = nullptr); + const char **McpuDefault = nullptr, + const char **ArchFlag = nullptr); static bool isValidArch(StringRef ArchFlag); static Triple getHostArch(); diff --git a/include/llvm/Object/MachOUniversal.h b/include/llvm/Object/MachOUniversal.h index 7eb2af944f3..a14c4ca0122 100644 --- a/include/llvm/Object/MachOUniversal.h +++ b/include/llvm/Object/MachOUniversal.h @@ -89,16 +89,24 @@ public: else // Parent->getMagic() == MachO::FAT_MAGIC_64 return Header64.reserved; } - std::string getArchTypeName() const { + std::string getArchFlagName() const { + const char *McpuDefault, *ArchFlag; if (Parent->getMagic() == MachO::FAT_MAGIC) { Triple T = - MachOObjectFile::getArchTriple(Header.cputype, Header.cpusubtype); - return T.getArchName(); + MachOObjectFile::getArchTriple(Header.cputype, Header.cpusubtype, + &McpuDefault, &ArchFlag); } else { // Parent->getMagic() == MachO::FAT_MAGIC_64 Triple T = MachOObjectFile::getArchTriple(Header64.cputype, - Header64.cpusubtype); - return T.getArchName(); + Header64.cpusubtype, + &McpuDefault, &ArchFlag); + } + if (ArchFlag) { + std::string ArchFlagName(ArchFlag); + return ArchFlagName; + } else { + std::string ArchFlagName(""); + return ArchFlagName; } } diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp index 6e686cced5b..40105000c56 100644 --- a/lib/Object/MachOObjectFile.cpp +++ b/lib/Object/MachOObjectFile.cpp @@ -2318,14 +2318,19 @@ Triple::ArchType MachOObjectFile::getArch(uint32_t CPUType) { } Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType, - const char **McpuDefault) { + const char **McpuDefault, + const char **ArchFlag) { if (McpuDefault) *McpuDefault = nullptr; + if (ArchFlag) + *ArchFlag = nullptr; switch (CPUType) { case MachO::CPU_TYPE_I386: switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { case MachO::CPU_SUBTYPE_I386_ALL: + if (ArchFlag) + *ArchFlag = "i386"; return Triple("i386-apple-darwin"); default: return Triple(); @@ -2333,8 +2338,12 @@ Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType, case MachO::CPU_TYPE_X86_64: switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { case MachO::CPU_SUBTYPE_X86_64_ALL: + if (ArchFlag) + *ArchFlag = "x86_64"; return Triple("x86_64-apple-darwin"); case MachO::CPU_SUBTYPE_X86_64_H: + if (ArchFlag) + *ArchFlag = "x86_64h"; return Triple("x86_64h-apple-darwin"); default: return Triple(); @@ -2342,30 +2351,50 @@ Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType, case MachO::CPU_TYPE_ARM: switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { case MachO::CPU_SUBTYPE_ARM_V4T: + if (ArchFlag) + *ArchFlag = "armv4t"; return Triple("armv4t-apple-darwin"); case MachO::CPU_SUBTYPE_ARM_V5TEJ: + if (ArchFlag) + *ArchFlag = "armv5e"; return Triple("armv5e-apple-darwin"); case MachO::CPU_SUBTYPE_ARM_XSCALE: + if (ArchFlag) + *ArchFlag = "xscale"; return Triple("xscale-apple-darwin"); case MachO::CPU_SUBTYPE_ARM_V6: + if (ArchFlag) + *ArchFlag = "armv6"; return Triple("armv6-apple-darwin"); case MachO::CPU_SUBTYPE_ARM_V6M: if (McpuDefault) *McpuDefault = "cortex-m0"; + if (ArchFlag) + *ArchFlag = "armv6m"; return Triple("armv6m-apple-darwin"); case MachO::CPU_SUBTYPE_ARM_V7: + if (ArchFlag) + *ArchFlag = "armv7"; return Triple("armv7-apple-darwin"); case MachO::CPU_SUBTYPE_ARM_V7EM: if (McpuDefault) *McpuDefault = "cortex-m4"; + if (ArchFlag) + *ArchFlag = "armv7em"; return Triple("thumbv7em-apple-darwin"); case MachO::CPU_SUBTYPE_ARM_V7K: + if (ArchFlag) + *ArchFlag = "armv7k"; return Triple("armv7k-apple-darwin"); case MachO::CPU_SUBTYPE_ARM_V7M: if (McpuDefault) *McpuDefault = "cortex-m3"; + if (ArchFlag) + *ArchFlag = "armv7m"; return Triple("thumbv7m-apple-darwin"); case MachO::CPU_SUBTYPE_ARM_V7S: + if (ArchFlag) + *ArchFlag = "armv7s"; return Triple("armv7s-apple-darwin"); default: return Triple(); @@ -2373,6 +2402,8 @@ Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType, case MachO::CPU_TYPE_ARM64: switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { case MachO::CPU_SUBTYPE_ARM64_ALL: + if (ArchFlag) + *ArchFlag = "arm64"; return Triple("arm64-apple-darwin"); default: return Triple(); @@ -2380,6 +2411,8 @@ Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType, case MachO::CPU_TYPE_POWERPC: switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { case MachO::CPU_SUBTYPE_POWERPC_ALL: + if (ArchFlag) + *ArchFlag = "ppc"; return Triple("ppc-apple-darwin"); default: return Triple(); @@ -2387,6 +2420,8 @@ Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType, case MachO::CPU_TYPE_POWERPC64: switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { case MachO::CPU_SUBTYPE_POWERPC_ALL: + if (ArchFlag) + *ArchFlag = "ppc64"; return Triple("ppc64-apple-darwin"); default: return Triple(); diff --git a/lib/Object/MachOUniversal.cpp b/lib/Object/MachOUniversal.cpp index 7ddc427dede..309708e9b37 100644 --- a/lib/Object/MachOUniversal.cpp +++ b/lib/Object/MachOUniversal.cpp @@ -219,7 +219,7 @@ MachOUniversalBinary::getObjectForArch(StringRef ArchName) const { object_error::arch_not_found); for (auto &Obj : objects()) - if (Obj.getArchTypeName() == ArchName) + if (Obj.getArchFlagName() == ArchName) return Obj.getAsObjectFile(); return make_error("fat file does not " "contain " + diff --git a/test/tools/llvm-objdump/ARM/Inputs/fat-armv7m.o b/test/tools/llvm-objdump/ARM/Inputs/fat-armv7m.o new file mode 100644 index 00000000000..2b478e36c45 Binary files /dev/null and b/test/tools/llvm-objdump/ARM/Inputs/fat-armv7m.o differ diff --git a/test/tools/llvm-objdump/ARM/macho-arch-armv7m-flag.test b/test/tools/llvm-objdump/ARM/macho-arch-armv7m-flag.test new file mode 100644 index 00000000000..6a19e306666 --- /dev/null +++ b/test/tools/llvm-objdump/ARM/macho-arch-armv7m-flag.test @@ -0,0 +1,5 @@ +@ RUN: llvm-objdump -macho -d -arch armv7m %p/Inputs/fat-armv7m.o | FileCheck %s +@ CHECK: fat-armv7m.o: +@ CHECK: (__TEXT,__text) section +@ CHECK: foo: +@ CHECK: 00 bf nop diff --git a/test/tools/llvm-symbolizer/fat.test b/test/tools/llvm-symbolizer/fat.test index f943150441f..1ecd1abb356 100644 --- a/test/tools/llvm-symbolizer/fat.test +++ b/test/tools/llvm-symbolizer/fat.test @@ -1,8 +1,8 @@ RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=x86_64 | FileCheck --check-prefix=X86_64 %s RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=x86_64h | FileCheck --check-prefix=X86_64H %s RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=armv7 | FileCheck --check-prefix=ARMV7 %s -RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=thumbv7em | FileCheck --check-prefix=ARMV7EM %s -RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=thumbv7m | FileCheck --check-prefix=ARMV7M %s +RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=armv7em | FileCheck --check-prefix=ARMV7EM %s +RUN: echo 0 | llvm-symbolizer -obj=%p/Inputs/fat.o -default-arch=armv7m | FileCheck --check-prefix=ARMV7M %s X86_64: x86_64_function X86_64H: x86_64h_function diff --git a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index f3e16dc6f00..84fa0e4d2d9 100644 --- a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -112,7 +112,7 @@ static void DumpInput(StringRef Filename) { auto MachOOrErr = ObjForArch.getAsObjectFile(); error(Filename, errorToErrorCode(MachOOrErr.takeError())); DumpObjectFile(**MachOOrErr, - Filename + " (" + ObjForArch.getArchTypeName() + ")"); + Filename + " (" + ObjForArch.getArchFlagName() + ")"); } } diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index 381bca4514e..aa89f89c31d 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -1148,7 +1148,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { for (MachOUniversalBinary::object_iterator I = UB->begin_objects(), E = UB->end_objects(); I != E; ++I) { - if (ArchFlags[i] == I->getArchTypeName()) { + if (ArchFlags[i] == I->getArchFlagName()) { ArchFound = true; Expected> ObjOrErr = I->getAsObjectFile(); @@ -1160,10 +1160,10 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { ObjectFile &Obj = *ObjOrErr.get(); if (ArchFlags.size() > 1) { if (PrintFileName) - ArchitectureName = I->getArchTypeName(); + ArchitectureName = I->getArchFlagName(); else outs() << "\n" << Obj.getFileName() << " (for architecture " - << I->getArchTypeName() << ")" + << I->getArchFlagName() << ")" << ":\n"; } dumpSymbolNamesFromObject(Obj, false, ArchiveName, @@ -1171,7 +1171,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { } else if (auto E = isNotObjectErrorInvalidFileType( ObjOrErr.takeError())) { error(std::move(E), Filename, ArchFlags.size() > 1 ? - StringRef(I->getArchTypeName()) : StringRef()); + StringRef(I->getArchFlagName()) : StringRef()); continue; } else if (Expected> AOrErr = I->getAsArchive()) { @@ -1184,7 +1184,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { if (auto E = isNotObjectErrorInvalidFileType( ChildOrErr.takeError())) { error(std::move(E), Filename, C, ArchFlags.size() > 1 ? - StringRef(I->getArchTypeName()) : StringRef()); + StringRef(I->getArchFlagName()) : StringRef()); } continue; } @@ -1193,12 +1193,12 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { if (PrintFileName) { ArchiveName = A->getFileName(); if (ArchFlags.size() > 1) - ArchitectureName = I->getArchTypeName(); + ArchitectureName = I->getArchFlagName(); } else { outs() << "\n" << A->getFileName(); outs() << "(" << O->getFileName() << ")"; if (ArchFlags.size() > 1) { - outs() << " (for architecture " << I->getArchTypeName() + outs() << " (for architecture " << I->getArchFlagName() << ")"; } outs() << ":\n"; @@ -1212,7 +1212,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { } else { consumeError(AOrErr.takeError()); error(Filename + " for architecture " + - StringRef(I->getArchTypeName()) + + StringRef(I->getArchFlagName()) + " is not a Mach-O file or an archive file", "Mach-O universal file"); } @@ -1233,7 +1233,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { for (MachOUniversalBinary::object_iterator I = UB->begin_objects(), E = UB->end_objects(); I != E; ++I) { - if (HostArchName == I->getArchTypeName()) { + if (HostArchName == I->getArchFlagName()) { Expected> ObjOrErr = I->getAsObjectFile(); std::string ArchiveName; ArchiveName.clear(); @@ -1273,7 +1273,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { } else { consumeError(AOrErr.takeError()); error(Filename + " for architecture " + - StringRef(I->getArchTypeName()) + + StringRef(I->getArchFlagName()) + " is not a Mach-O file or an archive file", "Mach-O universal file"); } @@ -1296,20 +1296,20 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { ObjectFile &Obj = *ObjOrErr.get(); if (PrintFileName) { if (isa(Obj) && moreThanOneArch) - ArchitectureName = I->getArchTypeName(); + ArchitectureName = I->getArchFlagName(); } else { if (moreThanOneArch) outs() << "\n"; outs() << Obj.getFileName(); if (isa(Obj) && moreThanOneArch) - outs() << " (for architecture " << I->getArchTypeName() << ")"; + outs() << " (for architecture " << I->getArchFlagName() << ")"; outs() << ":\n"; } dumpSymbolNamesFromObject(Obj, false, ArchiveName, ArchitectureName); } else if (auto E = isNotObjectErrorInvalidFileType( ObjOrErr.takeError())) { error(std::move(E), Filename, moreThanOneArch ? - StringRef(I->getArchTypeName()) : StringRef()); + StringRef(I->getArchFlagName()) : StringRef()); continue; } else if (Expected> AOrErr = I->getAsArchive()) { @@ -1329,13 +1329,13 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { if (PrintFileName) { ArchiveName = A->getFileName(); if (isa(O) && moreThanOneArch) - ArchitectureName = I->getArchTypeName(); + ArchitectureName = I->getArchFlagName(); } else { outs() << "\n" << A->getFileName(); if (isa(O)) { outs() << "(" << O->getFileName() << ")"; if (moreThanOneArch) - outs() << " (for architecture " << I->getArchTypeName() + outs() << " (for architecture " << I->getArchFlagName() << ")"; } else outs() << ":" << O->getFileName(); @@ -1349,7 +1349,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { } else { consumeError(AOrErr.takeError()); error(Filename + " for architecture " + - StringRef(I->getArchTypeName()) + + StringRef(I->getArchFlagName()) + " is not a Mach-O file or an archive file", "Mach-O universal file"); } diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index b196170d4f7..c43ccc21181 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -1162,15 +1162,19 @@ static bool checkMachOAndArchFlags(ObjectFile *O, StringRef Filename) { MachO::mach_header H; MachO::mach_header_64 H_64; Triple T; + const char *McpuDefault, *ArchFlag; if (MachO->is64Bit()) { H_64 = MachO->MachOObjectFile::getHeader64(); - T = MachOObjectFile::getArchTriple(H_64.cputype, H_64.cpusubtype); + T = MachOObjectFile::getArchTriple(H_64.cputype, H_64.cpusubtype, + &McpuDefault, &ArchFlag); } else { H = MachO->MachOObjectFile::getHeader(); - T = MachOObjectFile::getArchTriple(H.cputype, H.cpusubtype); + T = MachOObjectFile::getArchTriple(H.cputype, H.cpusubtype, + &McpuDefault, &ArchFlag); } + const std::string ArchFlagName(ArchFlag); if (none_of(ArchFlags, [&](const std::string &Name) { - return Name == T.getArchName(); + return Name == ArchFlagName; })) { errs() << "llvm-objdump: " + Filename + ": No architecture specified.\n"; return false; @@ -1419,7 +1423,7 @@ static void printMachOUniversalHeaders(const object::MachOUniversalBinary *UB, } } if (verbose) { - outs() << OFA.getArchTypeName() << "\n"; + outs() << OFA.getArchFlagName() << "\n"; printCPUType(cputype, cpusubtype & ~MachO::CPU_SUBTYPE_MASK); } else { outs() << i << "\n"; @@ -1603,13 +1607,13 @@ void llvm::ParseInputMachO(StringRef Filename) { for (MachOUniversalBinary::object_iterator I = UB->begin_objects(), E = UB->end_objects(); I != E; ++I) { - if (ArchFlags[i] == I->getArchTypeName()) { + if (ArchFlags[i] == I->getArchFlagName()) { ArchFound = true; Expected> ObjOrErr = I->getAsObjectFile(); std::string ArchitectureName = ""; if (ArchFlags.size() > 1) - ArchitectureName = I->getArchTypeName(); + ArchitectureName = I->getArchFlagName(); if (ObjOrErr) { ObjectFile &O = *ObjOrErr.get(); if (MachOObjectFile *MachOOF = dyn_cast(&O)) @@ -1646,7 +1650,7 @@ void llvm::ParseInputMachO(StringRef Filename) { } else { consumeError(AOrErr.takeError()); error("Mach-O universal file: " + Filename + " for " + - "architecture " + StringRef(I->getArchTypeName()) + + "architecture " + StringRef(I->getArchFlagName()) + " is not a Mach-O file or an archive file"); } } @@ -1666,7 +1670,7 @@ void llvm::ParseInputMachO(StringRef Filename) { E = UB->end_objects(); I != E; ++I) { if (MachOObjectFile::getHostArch().getArchName() == - I->getArchTypeName()) { + I->getArchFlagName()) { Expected> ObjOrErr = I->getAsObjectFile(); std::string ArchiveName; ArchiveName.clear(); @@ -1702,7 +1706,7 @@ void llvm::ParseInputMachO(StringRef Filename) { } else { consumeError(AOrErr.takeError()); error("Mach-O universal file: " + Filename + " for architecture " + - StringRef(I->getArchTypeName()) + + StringRef(I->getArchFlagName()) + " is not a Mach-O file or an archive file"); } return; @@ -1718,7 +1722,7 @@ void llvm::ParseInputMachO(StringRef Filename) { Expected> ObjOrErr = I->getAsObjectFile(); std::string ArchitectureName = ""; if (moreThanOneArch) - ArchitectureName = I->getArchTypeName(); + ArchitectureName = I->getArchFlagName(); if (ObjOrErr) { ObjectFile &Obj = *ObjOrErr.get(); if (MachOObjectFile *MachOOF = dyn_cast(&Obj)) @@ -1757,7 +1761,7 @@ void llvm::ParseInputMachO(StringRef Filename) { } else { consumeError(AOrErr.takeError()); error("Mach-O universal file: " + Filename + " for architecture " + - StringRef(I->getArchTypeName()) + + StringRef(I->getArchFlagName()) + " is not a Mach-O file or an archive file"); } } diff --git a/tools/llvm-size/llvm-size.cpp b/tools/llvm-size/llvm-size.cpp index 903e950bc73..e47cfca8c81 100644 --- a/tools/llvm-size/llvm-size.cpp +++ b/tools/llvm-size/llvm-size.cpp @@ -580,7 +580,7 @@ static void printFileSectionSizes(StringRef file) { for (MachOUniversalBinary::object_iterator I = UB->begin_objects(), E = UB->end_objects(); I != E; ++I) { - if (ArchFlags[i] == I->getArchTypeName()) { + if (ArchFlags[i] == I->getArchFlagName()) { ArchFound = true; Expected> UO = I->getAsObjectFile(); if (UO) { @@ -591,20 +591,20 @@ static void printFileSectionSizes(StringRef file) { else if (MachO && OutputFormat == darwin) { if (MoreThanOneFile || ArchFlags.size() > 1) outs() << o->getFileName() << " (for architecture " - << I->getArchTypeName() << "): \n"; + << I->getArchFlagName() << "): \n"; } printObjectSectionSizes(o); if (OutputFormat == berkeley) { if (!MachO || MoreThanOneFile || ArchFlags.size() > 1) outs() << o->getFileName() << " (for architecture " - << I->getArchTypeName() << ")"; + << I->getArchFlagName() << ")"; outs() << "\n"; } } } else if (auto E = isNotObjectErrorInvalidFileType( UO.takeError())) { error(std::move(E), file, ArchFlags.size() > 1 ? - StringRef(I->getArchTypeName()) : StringRef()); + StringRef(I->getArchFlagName()) : StringRef()); return; } else if (Expected> AOrErr = I->getAsArchive()) { @@ -619,7 +619,7 @@ static void printFileSectionSizes(StringRef file) { ChildOrErr.takeError())) error(std::move(E), UA->getFileName(), C, ArchFlags.size() > 1 ? - StringRef(I->getArchTypeName()) : StringRef()); + StringRef(I->getArchFlagName()) : StringRef()); continue; } if (ObjectFile *o = dyn_cast(&*ChildOrErr.get())) { @@ -630,7 +630,7 @@ static void printFileSectionSizes(StringRef file) { else if (MachO && OutputFormat == darwin) outs() << UA->getFileName() << "(" << o->getFileName() << ")" - << " (for architecture " << I->getArchTypeName() + << " (for architecture " << I->getArchFlagName() << "):\n"; printObjectSectionSizes(o); if (OutputFormat == berkeley) { @@ -638,7 +638,7 @@ static void printFileSectionSizes(StringRef file) { outs() << UA->getFileName() << "(" << o->getFileName() << ")"; if (ArchFlags.size() > 1) - outs() << " (for architecture " << I->getArchTypeName() + outs() << " (for architecture " << I->getArchFlagName() << ")"; outs() << "\n"; } else @@ -652,7 +652,7 @@ static void printFileSectionSizes(StringRef file) { } else { consumeError(AOrErr.takeError()); error("Mach-O universal file: " + file + " for architecture " + - StringRef(I->getArchTypeName()) + + StringRef(I->getArchFlagName()) + " is not a Mach-O file or an archive file"); } } @@ -672,7 +672,7 @@ static void printFileSectionSizes(StringRef file) { for (MachOUniversalBinary::object_iterator I = UB->begin_objects(), E = UB->end_objects(); I != E; ++I) { - if (HostArchName == I->getArchTypeName()) { + if (HostArchName == I->getArchFlagName()) { Expected> UO = I->getAsObjectFile(); if (UO) { if (ObjectFile *o = dyn_cast(&*UO.get())) { @@ -682,13 +682,13 @@ static void printFileSectionSizes(StringRef file) { else if (MachO && OutputFormat == darwin) { if (MoreThanOneFile) outs() << o->getFileName() << " (for architecture " - << I->getArchTypeName() << "):\n"; + << I->getArchFlagName() << "):\n"; } printObjectSectionSizes(o); if (OutputFormat == berkeley) { if (!MachO || MoreThanOneFile) outs() << o->getFileName() << " (for architecture " - << I->getArchTypeName() << ")"; + << I->getArchFlagName() << ")"; outs() << "\n"; } } @@ -716,7 +716,7 @@ static void printFileSectionSizes(StringRef file) { << "):\n"; else if (MachO && OutputFormat == darwin) outs() << UA->getFileName() << "(" << o->getFileName() << ")" - << " (for architecture " << I->getArchTypeName() + << " (for architecture " << I->getArchFlagName() << "):\n"; printObjectSectionSizes(o); if (OutputFormat == berkeley) { @@ -734,7 +734,7 @@ static void printFileSectionSizes(StringRef file) { } else { consumeError(AOrErr.takeError()); error("Mach-O universal file: " + file + " for architecture " + - StringRef(I->getArchTypeName()) + + StringRef(I->getArchFlagName()) + " is not a Mach-O file or an archive file"); } return; @@ -756,20 +756,20 @@ static void printFileSectionSizes(StringRef file) { else if (MachO && OutputFormat == darwin) { if (MoreThanOneFile || MoreThanOneArch) outs() << o->getFileName() << " (for architecture " - << I->getArchTypeName() << "):"; + << I->getArchFlagName() << "):"; outs() << "\n"; } printObjectSectionSizes(o); if (OutputFormat == berkeley) { if (!MachO || MoreThanOneFile || MoreThanOneArch) outs() << o->getFileName() << " (for architecture " - << I->getArchTypeName() << ")"; + << I->getArchFlagName() << ")"; outs() << "\n"; } } } else if (auto E = isNotObjectErrorInvalidFileType(UO.takeError())) { error(std::move(E), file, MoreThanOneArch ? - StringRef(I->getArchTypeName()) : StringRef()); + StringRef(I->getArchFlagName()) : StringRef()); return; } else if (Expected> AOrErr = I->getAsArchive()) { @@ -782,7 +782,7 @@ static void printFileSectionSizes(StringRef file) { if (auto E = isNotObjectErrorInvalidFileType( ChildOrErr.takeError())) error(std::move(E), UA->getFileName(), C, MoreThanOneArch ? - StringRef(I->getArchTypeName()) : StringRef()); + StringRef(I->getArchFlagName()) : StringRef()); continue; } if (ObjectFile *o = dyn_cast(&*ChildOrErr.get())) { @@ -792,12 +792,12 @@ static void printFileSectionSizes(StringRef file) { << "):\n"; else if (MachO && OutputFormat == darwin) outs() << UA->getFileName() << "(" << o->getFileName() << ")" - << " (for architecture " << I->getArchTypeName() << "):\n"; + << " (for architecture " << I->getArchFlagName() << "):\n"; printObjectSectionSizes(o); if (OutputFormat == berkeley) { if (MachO) outs() << UA->getFileName() << "(" << o->getFileName() << ")" - << " (for architecture " << I->getArchTypeName() + << " (for architecture " << I->getArchFlagName() << ")\n"; else outs() << o->getFileName() << " (ex " << UA->getFileName() @@ -810,7 +810,7 @@ static void printFileSectionSizes(StringRef file) { } else { consumeError(AOrErr.takeError()); error("Mach-O universal file: " + file + " for architecture " + - StringRef(I->getArchTypeName()) + + StringRef(I->getArchFlagName()) + " is not a Mach-O file or an archive file"); } }