================
@@ -1284,6 +1285,54 @@
ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
return error;
}
+void ObjectFileELF::ParseRISCVAttributes(DataExtractor &data, uint64_t length,
+ ArchSpec &arch_spec) {
+ lldb::offset_t offset = 0;
+
+ uint8_t format_version = data.GetU8(&offset);
+ if (format_version != llvm::ELFAttrs::Format_Version)
+ return;
+
+ offset = offset + sizeof(uint32_t); // Section Length
+ llvm::StringRef vendor_name = data.GetCStr(&offset);
+
+ if (vendor_name != "riscv")
+ return;
+
+ llvm::StringRef attr = "";
+
+ while (offset < length) {
+ uint8_t Tag = data.GetU8(&offset);
+ uint32_t Size = data.GetU32(&offset);
+
+ if (Tag != llvm::ELFAttrs::File || Size == 0)
+ continue;
+
+ while (offset < length) {
+ uint64_t Tag = data.GetULEB128(&offset);
+ if (Tag == llvm::RISCVAttrs::ARCH) {
+ attr = data.GetCStr(&offset);
+ break;
+ } else {
+ data.GetULEB128(&offset);
+ }
+ }
+ }
+
+ // List of RISC-V architecture extensions to detect from ELF.
+ // These extensions are extracted from the ".riscv.attributes" section.
+ // New extensions can be added to this list for detection without
+ // modifying the core logic.
+ std::vector<std::string> riscv_extensions = {"xqci"};
----------------
santhoshe447 wrote:
I have updated the comment.
This is purely a configuration list. LLDB is only aware of the feature
attributes that are explicitly defined here, meaning it does not automatically
detect or interpret attributes beyond this configuration.
During validation, we check whether the configured feature attributes are
actually present in the ELF attribute section. This ensure that LLDB recognizes
and handles only those attributes that have been intentionally configured and
supported.
Please suggest if you have anything here.
https://github.com/llvm/llvm-project/pull/147990
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits