Skip to content

Commit de252e7

Browse files
authored
[lldb] Add amd64 ArchSpec (#122533)
amd64 is used on OpenBSD.
1 parent 2f7ade4 commit de252e7

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

lldb/include/lldb/Utility/ArchSpec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ class ArchSpec {
215215

216216
eCore_x86_64_x86_64,
217217
eCore_x86_64_x86_64h, // Haswell enabled x86_64
218+
eCore_x86_64_amd64,
219+
218220
eCore_hexagon_generic,
219221
eCore_hexagon_hexagonv4,
220222
eCore_hexagon_hexagonv5,

lldb/source/Utility/ArchSpec.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ static const CoreDefinition g_core_definitions[] = {
218218
ArchSpec::eCore_x86_64_x86_64, "x86_64"},
219219
{eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64,
220220
ArchSpec::eCore_x86_64_x86_64h, "x86_64h"},
221+
{eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64,
222+
ArchSpec::eCore_x86_64_amd64, "amd64"},
223+
221224
{eByteOrderLittle, 4, 4, 4, llvm::Triple::hexagon,
222225
ArchSpec::eCore_hexagon_generic, "hexagon"},
223226
{eByteOrderLittle, 4, 4, 4, llvm::Triple::hexagon,
@@ -1227,6 +1230,7 @@ static bool cores_match(const ArchSpec::Core core1, const ArchSpec::Core core2,
12271230
break;
12281231

12291232
case ArchSpec::eCore_x86_64_x86_64h:
1233+
case ArchSpec::eCore_x86_64_amd64:
12301234
if (!enforce_exact_match) {
12311235
try_inverse = false;
12321236
if (core2 == ArchSpec::eCore_x86_64_x86_64)

lldb/unittests/Utility/ArchSpecTest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ TEST(ArchSpecTest, TestSetTriple) {
129129
EXPECT_STREQ("msp430", AS.GetArchitectureName());
130130
EXPECT_EQ(ArchSpec::eCore_msp430, AS.GetCore());
131131

132+
AS = ArchSpec();
133+
EXPECT_TRUE(AS.SetTriple("amd64-unknown-openbsd"));
134+
EXPECT_EQ(llvm::Triple::x86_64, AS.GetTriple().getArch());
135+
EXPECT_STREQ("amd64", AS.GetArchitectureName());
136+
EXPECT_EQ(ArchSpec::eCore_x86_64_amd64, AS.GetCore());
137+
132138
// Various flavors of invalid triples.
133139
AS = ArchSpec();
134140
EXPECT_FALSE(AS.SetTriple("unknown-unknown-unknown"));

0 commit comments

Comments
 (0)