[Lldb-commits] [lldb] [llvm] [SPARC][NFC] Add missing dynamic tags handling in LLVM and LLDB (PR #206316)
via lldb-commits
lldb-commits at lists.llvm.org
Sun Jun 28 00:25:50 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Phoebe Wang (phoebewang)
<details>
<summary>Changes</summary>
It seems it's missed from #<!-- -->137916. It blocks when adding dynamic tags for new target. Split from #<!-- -->206002.
---
Full diff: https://github.com/llvm/llvm-project/pull/206316.diff
3 Files Affected:
- (modified) lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (+12)
- (modified) llvm/include/llvm/BinaryFormat/DynamicTags.def (+4)
- (modified) llvm/lib/Object/ELF.cpp (+12)
``````````diff
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 16dd2fc122906..1ad98d70bcb7a 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -3800,6 +3800,16 @@ std::string static getDynamicTagAsString(uint16_t Arch, uint64_t Type) {
#undef RISCV_DYNAMIC_TAG
}
break;
+
+ case llvm::ELF::EM_SPARC:
+ case llvm::ELF::EM_SPARC32PLUS:
+ case llvm::ELF::EM_SPARCV9:
+ switch (Type) {
+#define SPARC_DYNAMIC_TAG(name, value) DYNAMIC_STRINGIFY_ENUM(name, value)
+#include "llvm/BinaryFormat/DynamicTags.def"
+#undef SPARC_DYNAMIC_TAG
+ }
+ break;
}
#undef DYNAMIC_TAG
switch (Type) {
@@ -3810,6 +3820,7 @@ std::string static getDynamicTagAsString(uint16_t Arch, uint64_t Type) {
#define PPC_DYNAMIC_TAG(name, value)
#define PPC64_DYNAMIC_TAG(name, value)
#define RISCV_DYNAMIC_TAG(name, value)
+#define SPARC_DYNAMIC_TAG(name, value)
// Also ignore marker tags such as DT_HIOS (maps to DT_VERNEEDNUM), etc.
#define DYNAMIC_TAG_MARKER(name, value)
#define DYNAMIC_TAG(name, value) \
@@ -3823,6 +3834,7 @@ std::string static getDynamicTagAsString(uint16_t Arch, uint64_t Type) {
#undef PPC_DYNAMIC_TAG
#undef PPC64_DYNAMIC_TAG
#undef RISCV_DYNAMIC_TAG
+#undef SPARC_DYNAMIC_TAG
#undef DYNAMIC_TAG_MARKER
#undef DYNAMIC_STRINGIFY_ENUM
default:
diff --git a/llvm/include/llvm/BinaryFormat/DynamicTags.def b/llvm/include/llvm/BinaryFormat/DynamicTags.def
index 1e9b87e1e58a7..75606e58da80d 100644
--- a/llvm/include/llvm/BinaryFormat/DynamicTags.def
+++ b/llvm/include/llvm/BinaryFormat/DynamicTags.def
@@ -282,3 +282,7 @@ DYNAMIC_TAG(FILTER, 0x7FFFFFFF) // Shared object to get values from
#undef RISCV_DYNAMIC_TAG
#undef RISCV_DYNAMIC_TAG_DEFINED
#endif
+#ifdef SPARC_DYNAMIC_TAG_DEFINED
+#undef SPARC_DYNAMIC_TAG
+#undef SPARC_DYNAMIC_TAG_DEFINED
+#endif
diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp
index f159fd82e7117..5dbdecc9915b0 100644
--- a/llvm/lib/Object/ELF.cpp
+++ b/llvm/lib/Object/ELF.cpp
@@ -588,6 +588,16 @@ std::string ELFFile<ELFT>::getDynamicTagAsString(unsigned Arch,
#undef RISCV_DYNAMIC_TAG
}
break;
+
+ case ELF::EM_SPARC:
+ case ELF::EM_SPARC32PLUS:
+ case ELF::EM_SPARCV9:
+ switch (Type) {
+#define SPARC_DYNAMIC_TAG(name, value) DYNAMIC_STRINGIFY_ENUM(name, value)
+#include "llvm/BinaryFormat/DynamicTags.def"
+#undef SPARC_DYNAMIC_TAG
+ }
+ break;
}
#undef DYNAMIC_TAG
switch (Type) {
@@ -598,6 +608,7 @@ std::string ELFFile<ELFT>::getDynamicTagAsString(unsigned Arch,
#define PPC_DYNAMIC_TAG(name, value)
#define PPC64_DYNAMIC_TAG(name, value)
#define RISCV_DYNAMIC_TAG(name, value)
+#define SPARC_DYNAMIC_TAG(name, value)
// Also ignore marker tags such as DT_HIOS (maps to DT_VERNEEDNUM), etc.
#define DYNAMIC_TAG_MARKER(name, value)
#define DYNAMIC_TAG(name, value) case value: return #name;
@@ -609,6 +620,7 @@ std::string ELFFile<ELFT>::getDynamicTagAsString(unsigned Arch,
#undef PPC_DYNAMIC_TAG
#undef PPC64_DYNAMIC_TAG
#undef RISCV_DYNAMIC_TAG
+#undef SPARC_DYNAMIC_TAG
#undef DYNAMIC_TAG_MARKER
#undef DYNAMIC_STRINGIFY_ENUM
default:
``````````
</details>
https://github.com/llvm/llvm-project/pull/206316
More information about the lldb-commits
mailing list