Skip to content

Commit 627f7d3

Browse files
committed
[lldb] Don't set the OS for ARMGetSupportedArchitectureAtIndex
Don't set the OS when computing supported architectures in PlatformDarwin::ARMGetSupportedArchitectureAtIndex. Differential revision: https://reviews.llvm.org/D113159 (cherry picked from commit cd7a2bf)
1 parent f0f0299 commit 627f7d3

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,15 @@ static llvm::ArrayRef<const char *> GetCompatibleArchs(ArchSpec::Core core) {
559559
switch (core) {
560560
default:
561561
LLVM_FALLTHROUGH;
562+
case ArchSpec::eCore_arm_arm64e: {
563+
static const char *g_arm64e_compatible_archs[] = {
564+
"arm64e", "arm64", "armv7", "armv7f", "armv7k", "armv7s",
565+
"armv7m", "armv7em", "armv6m", "armv6", "armv5", "armv4",
566+
"arm", "thumbv7", "thumbv7f", "thumbv7k", "thumbv7s", "thumbv7m",
567+
"thumbv7em", "thumbv6m", "thumbv6", "thumbv5", "thumbv4t", "thumb",
568+
};
569+
return {g_arm64e_compatible_archs};
570+
}
562571
case ArchSpec::eCore_arm_arm64: {
563572
static const char *g_arm64_compatible_archs[] = {
564573
"arm64", "armv7", "armv7f", "armv7k", "armv7s", "armv7m",
@@ -662,38 +671,15 @@ const char *PlatformDarwin::GetCompatibleArch(ArchSpec::Core core, size_t idx) {
662671
/// processor.
663672
bool PlatformDarwin::ARMGetSupportedArchitectureAtIndex(uint32_t idx,
664673
ArchSpec &arch) {
665-
#if TARGET_OS_OSX
666-
if (IsHost()) {
667-
if (idx == 0) {
668-
arch.SetTriple("arm64e-apple-macosx");
669-
return true;
670-
} else if (idx == 1) {
671-
arch.SetTriple("arm64-apple-macosx");
672-
return true;
673-
}
674-
arch.Clear();
675-
return false;
676-
}
677-
#endif
678-
679-
#if defined(TARGET_OS_TV) && TARGET_OS_TV == 1
680-
#define OSNAME "tvos"
681-
#elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1
682-
#define OSNAME "watchos"
683-
#elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
684-
#define OSNAME "bridgeos"
685-
#elif defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1
686-
#define OSNAME "macosx"
687-
#else
688-
#define OSNAME "ios"
689-
#endif
690-
691674
const ArchSpec system_arch = GetSystemArchitecture();
692675
const ArchSpec::Core system_core = system_arch.GetCore();
676+
693677
if (const char *compatible_arch = GetCompatibleArch(system_core, idx)) {
694-
std::string triple =
695-
llvm::formatv("{0}-apple-" OSNAME, compatible_arch).str();
678+
llvm::Triple triple;
679+
triple.setArchName(compatible_arch);
680+
triple.setVendor(llvm::Triple::VendorType::Apple);
696681
arch.SetTriple(triple);
682+
return true;
697683
}
698684

699685
arch.Clear();

0 commit comments

Comments
 (0)