[llvm] 6301394 - [ORC] Use BinaryFormat to convert Triple to MachO cputype / cpusubtype values.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 19 15:26:37 PST 2025
Author: Lang Hames
Date: 2025-01-20T10:25:37+11:00
New Revision: 630139460ea7fe8c4b6e6ea2973830117a8048ee
URL: https://github.com/llvm/llvm-project/commit/630139460ea7fe8c4b6e6ea2973830117a8048ee
DIFF: https://github.com/llvm/llvm-project/commit/630139460ea7fe8c4b6e6ea2973830117a8048ee.diff
LOG: [ORC] Use BinaryFormat to convert Triple to MachO cputype / cpusubtype values.
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
index 0d9a912e25606c..1bafed79d6968c 100644
--- a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
@@ -121,18 +121,14 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
// Write MachO header and debug section load commands.
Builder.Header.filetype = MachO::MH_OBJECT;
- switch (G.getTargetTriple().getArch()) {
- case Triple::x86_64:
- Builder.Header.cputype = MachO::CPU_TYPE_X86_64;
- Builder.Header.cpusubtype = MachO::CPU_SUBTYPE_X86_64_ALL;
- break;
- case Triple::aarch64:
- Builder.Header.cputype = MachO::CPU_TYPE_ARM64;
- Builder.Header.cpusubtype = MachO::CPU_SUBTYPE_ARM64_ALL;
- break;
- default:
- llvm_unreachable("Unsupported architecture");
- }
+ if (auto CPUType = MachO::getCPUType(G.getTargetTriple()))
+ Builder.Header.cputype = *CPUType;
+ else
+ return CPUType.takeError();
+ if (auto CPUSubType = MachO::getCPUSubType(G.getTargetTriple()))
+ Builder.Header.cpusubtype = *CPUSubType;
+ else
+ return CPUSubType.takeError();
Seg = &Builder.addSegment("");
More information about the llvm-commits
mailing list