[Lldb-commits] [lldb] de252e7 - [lldb] Add amd64 ArchSpec (#122533)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 13 11:37:10 PST 2025
Author: Brad Smith
Date: 2025-01-13T14:37:06-05:00
New Revision: de252e7777c1c6b45626a58aa34ea99dee58cc40
URL: https://github.com/llvm/llvm-project/commit/de252e7777c1c6b45626a58aa34ea99dee58cc40
DIFF: https://github.com/llvm/llvm-project/commit/de252e7777c1c6b45626a58aa34ea99dee58cc40.diff
LOG: [lldb] Add amd64 ArchSpec (#122533)
amd64 is used on OpenBSD.
Added:
Modified:
lldb/include/lldb/Utility/ArchSpec.h
lldb/source/Utility/ArchSpec.cpp
lldb/unittests/Utility/ArchSpecTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Utility/ArchSpec.h b/lldb/include/lldb/Utility/ArchSpec.h
index 2a74058673bae5..7e9bc23a75acbb 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -215,6 +215,8 @@ class ArchSpec {
eCore_x86_64_x86_64,
eCore_x86_64_x86_64h, // Haswell enabled x86_64
+ eCore_x86_64_amd64,
+
eCore_hexagon_generic,
eCore_hexagon_hexagonv4,
eCore_hexagon_hexagonv5,
diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp
index 85bb85044ec156..b13e8ff1ec373d 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -218,6 +218,9 @@ static const CoreDefinition g_core_definitions[] = {
ArchSpec::eCore_x86_64_x86_64, "x86_64"},
{eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64,
ArchSpec::eCore_x86_64_x86_64h, "x86_64h"},
+ {eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64,
+ ArchSpec::eCore_x86_64_amd64, "amd64"},
+
{eByteOrderLittle, 4, 4, 4, llvm::Triple::hexagon,
ArchSpec::eCore_hexagon_generic, "hexagon"},
{eByteOrderLittle, 4, 4, 4, llvm::Triple::hexagon,
@@ -1227,6 +1230,7 @@ static bool cores_match(const ArchSpec::Core core1, const ArchSpec::Core core2,
break;
case ArchSpec::eCore_x86_64_x86_64h:
+ case ArchSpec::eCore_x86_64_amd64:
if (!enforce_exact_match) {
try_inverse = false;
if (core2 == ArchSpec::eCore_x86_64_x86_64)
diff --git a/lldb/unittests/Utility/ArchSpecTest.cpp b/lldb/unittests/Utility/ArchSpecTest.cpp
index de3590b73bbaa4..74a4b48456b016 100644
--- a/lldb/unittests/Utility/ArchSpecTest.cpp
+++ b/lldb/unittests/Utility/ArchSpecTest.cpp
@@ -129,6 +129,12 @@ TEST(ArchSpecTest, TestSetTriple) {
EXPECT_STREQ("msp430", AS.GetArchitectureName());
EXPECT_EQ(ArchSpec::eCore_msp430, AS.GetCore());
+ AS = ArchSpec();
+ EXPECT_TRUE(AS.SetTriple("amd64-unknown-openbsd"));
+ EXPECT_EQ(llvm::Triple::x86_64, AS.GetTriple().getArch());
+ EXPECT_STREQ("amd64", AS.GetArchitectureName());
+ EXPECT_EQ(ArchSpec::eCore_x86_64_amd64, AS.GetCore());
+
// Various flavors of invalid triples.
AS = ArchSpec();
EXPECT_FALSE(AS.SetTriple("unknown-unknown-unknown"));
More information about the lldb-commits
mailing list