Skip to content

Commit

Permalink
[ORC] Use BinaryFormat to convert Triple to MachO cputype / cpusubtyp…
Browse files Browse the repository at this point in the history
…e values.
  • Loading branch information
lhames committed Jan 19, 2025
1 parent de58693 commit 6301394
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("");

Expand Down

0 comments on commit 6301394

Please sign in to comment.