Skip to content

Commit 1b664fe

Browse files
[lldb][AIX] Updating XCOFF,PPC entry in LLDB ArchSpec (#105523)
This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: 1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 2. #101657 The complete changes for porting are present in this draft PR: #102601 The changes in this PR are intended to update the Architecture entry for LLDB with XCOFF,PPC. 1. Added new ArchitectureType `eArchTypeXCOFF` 2. Added a new `ArchDefinitionEntry g_xcoff_arch_entries[]` 3. Added a new case for `XCOFF in ArchSpec::SetArchitecture(..)` 4. Updated `ArchDefinition *g_arch_definitions[]`
1 parent b4ac5c4 commit 1b664fe

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lldb/include/lldb/lldb-private-enumerations.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ enum ArchitectureType {
6565
eArchTypeMachO,
6666
eArchTypeELF,
6767
eArchTypeCOFF,
68+
eArchTypeXCOFF,
6869
kNumArchTypes
6970
};
7071

lldb/source/Utility/ArchSpec.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "llvm/BinaryFormat/COFF.h"
1717
#include "llvm/BinaryFormat/ELF.h"
1818
#include "llvm/BinaryFormat/MachO.h"
19+
#include "llvm/BinaryFormat/XCOFF.h"
1920
#include "llvm/Support/Compiler.h"
2021
#include "llvm/TargetParser/ARMTargetParser.h"
2122

@@ -459,10 +460,23 @@ static const ArchDefinition g_coff_arch_def = {
459460
"pe-coff",
460461
};
461462

463+
static const ArchDefinitionEntry g_xcoff_arch_entries[] = {
464+
{ArchSpec::eCore_ppc_generic, llvm::XCOFF::TCPU_COM, LLDB_INVALID_CPUTYPE,
465+
0xFFFFFFFFu, 0xFFFFFFFFu},
466+
{ArchSpec::eCore_ppc64_generic, llvm::XCOFF::TCPU_PPC64,
467+
LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu}};
468+
469+
static const ArchDefinition g_xcoff_arch_def = {
470+
eArchTypeXCOFF,
471+
std::size(g_xcoff_arch_entries),
472+
g_xcoff_arch_entries,
473+
"xcoff",
474+
};
475+
462476
//===----------------------------------------------------------------------===//
463477
// Table of all ArchDefinitions
464478
static const ArchDefinition *g_arch_definitions[] = {
465-
&g_macho_arch_def, &g_elf_arch_def, &g_coff_arch_def};
479+
&g_macho_arch_def, &g_elf_arch_def, &g_coff_arch_def, &g_xcoff_arch_def};
466480

467481
//===----------------------------------------------------------------------===//
468482
// Static helper functions.
@@ -903,6 +917,9 @@ bool ArchSpec::SetArchitecture(ArchitectureType arch_type, uint32_t cpu,
903917
} else if (arch_type == eArchTypeCOFF && os == llvm::Triple::Win32) {
904918
m_triple.setVendor(llvm::Triple::PC);
905919
m_triple.setOS(llvm::Triple::Win32);
920+
} else if (arch_type == eArchTypeXCOFF && os == llvm::Triple::AIX) {
921+
m_triple.setVendor(llvm::Triple::IBM);
922+
m_triple.setOS(llvm::Triple::AIX);
906923
} else {
907924
m_triple.setVendor(llvm::Triple::UnknownVendor);
908925
m_triple.setOS(llvm::Triple::UnknownOS);

0 commit comments

Comments
 (0)